mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
Add ReactSpa template
This commit is contained in:
3
templates/ReactSpa/.babelrc
Normal file
3
templates/ReactSpa/.babelrc
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"presets": ["es2015", "react"]
|
||||||
|
}
|
||||||
233
templates/ReactSpa/.gitignore
vendored
Normal file
233
templates/ReactSpa/.gitignore
vendored
Normal file
@@ -0,0 +1,233 @@
|
|||||||
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
|
||||||
|
# User-specific files
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.userosscache
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
|
*.userprefs
|
||||||
|
|
||||||
|
# Build results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Dd]ebugPublic/
|
||||||
|
[Rr]elease/
|
||||||
|
[Rr]eleases/
|
||||||
|
x64/
|
||||||
|
x86/
|
||||||
|
build/
|
||||||
|
bld/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
|
||||||
|
# Visual Studio 2015 cache/options directory
|
||||||
|
.vs/
|
||||||
|
/wwwroot/dist/
|
||||||
|
|
||||||
|
# MSTest test Results
|
||||||
|
[Tt]est[Rr]esult*/
|
||||||
|
[Bb]uild[Ll]og.*
|
||||||
|
|
||||||
|
# NUNIT
|
||||||
|
*.VisualState.xml
|
||||||
|
TestResult.xml
|
||||||
|
|
||||||
|
# Build Results of an ATL Project
|
||||||
|
[Dd]ebugPS/
|
||||||
|
[Rr]eleasePS/
|
||||||
|
dlldata.c
|
||||||
|
|
||||||
|
# DNX
|
||||||
|
project.lock.json
|
||||||
|
artifacts/
|
||||||
|
|
||||||
|
*_i.c
|
||||||
|
*_p.c
|
||||||
|
*_i.h
|
||||||
|
*.ilk
|
||||||
|
*.meta
|
||||||
|
*.obj
|
||||||
|
*.pch
|
||||||
|
*.pdb
|
||||||
|
*.pgc
|
||||||
|
*.pgd
|
||||||
|
*.rsp
|
||||||
|
*.sbr
|
||||||
|
*.tlb
|
||||||
|
*.tli
|
||||||
|
*.tlh
|
||||||
|
*.tmp
|
||||||
|
*.tmp_proj
|
||||||
|
*.log
|
||||||
|
*.vspscc
|
||||||
|
*.vssscc
|
||||||
|
.builds
|
||||||
|
*.pidb
|
||||||
|
*.svclog
|
||||||
|
*.scc
|
||||||
|
|
||||||
|
# Chutzpah Test files
|
||||||
|
_Chutzpah*
|
||||||
|
|
||||||
|
# Visual C++ cache files
|
||||||
|
ipch/
|
||||||
|
*.aps
|
||||||
|
*.ncb
|
||||||
|
*.opendb
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
*.cachefile
|
||||||
|
|
||||||
|
# Visual Studio profiler
|
||||||
|
*.psess
|
||||||
|
*.vsp
|
||||||
|
*.vspx
|
||||||
|
*.sap
|
||||||
|
|
||||||
|
# TFS 2012 Local Workspace
|
||||||
|
$tf/
|
||||||
|
|
||||||
|
# Guidance Automation Toolkit
|
||||||
|
*.gpState
|
||||||
|
|
||||||
|
# ReSharper is a .NET coding add-in
|
||||||
|
_ReSharper*/
|
||||||
|
*.[Rr]e[Ss]harper
|
||||||
|
*.DotSettings.user
|
||||||
|
|
||||||
|
# JustCode is a .NET coding add-in
|
||||||
|
.JustCode
|
||||||
|
|
||||||
|
# TeamCity is a build add-in
|
||||||
|
_TeamCity*
|
||||||
|
|
||||||
|
# DotCover is a Code Coverage Tool
|
||||||
|
*.dotCover
|
||||||
|
|
||||||
|
# NCrunch
|
||||||
|
_NCrunch_*
|
||||||
|
.*crunch*.local.xml
|
||||||
|
nCrunchTemp_*
|
||||||
|
|
||||||
|
# MightyMoose
|
||||||
|
*.mm.*
|
||||||
|
AutoTest.Net/
|
||||||
|
|
||||||
|
# Web workbench (sass)
|
||||||
|
.sass-cache/
|
||||||
|
|
||||||
|
# Installshield output folder
|
||||||
|
[Ee]xpress/
|
||||||
|
|
||||||
|
# DocProject is a documentation generator add-in
|
||||||
|
DocProject/buildhelp/
|
||||||
|
DocProject/Help/*.HxT
|
||||||
|
DocProject/Help/*.HxC
|
||||||
|
DocProject/Help/*.hhc
|
||||||
|
DocProject/Help/*.hhk
|
||||||
|
DocProject/Help/*.hhp
|
||||||
|
DocProject/Help/Html2
|
||||||
|
DocProject/Help/html
|
||||||
|
|
||||||
|
# Click-Once directory
|
||||||
|
publish/
|
||||||
|
|
||||||
|
# Publish Web Output
|
||||||
|
*.[Pp]ublish.xml
|
||||||
|
*.azurePubxml
|
||||||
|
# TODO: Comment the next line if you want to checkin your web deploy settings
|
||||||
|
# but database connection strings (with potential passwords) will be unencrypted
|
||||||
|
*.pubxml
|
||||||
|
*.publishproj
|
||||||
|
|
||||||
|
# NuGet Packages
|
||||||
|
*.nupkg
|
||||||
|
# The packages folder can be ignored because of Package Restore
|
||||||
|
**/packages/*
|
||||||
|
# except build/, which is used as an MSBuild target.
|
||||||
|
!**/packages/build/
|
||||||
|
# Uncomment if necessary however generally it will be regenerated when needed
|
||||||
|
#!**/packages/repositories.config
|
||||||
|
|
||||||
|
# Microsoft Azure Build Output
|
||||||
|
csx/
|
||||||
|
*.build.csdef
|
||||||
|
|
||||||
|
# Microsoft Azure Emulator
|
||||||
|
ecf/
|
||||||
|
rcf/
|
||||||
|
|
||||||
|
# Microsoft Azure ApplicationInsights config file
|
||||||
|
ApplicationInsights.config
|
||||||
|
|
||||||
|
# Windows Store app package directory
|
||||||
|
AppPackages/
|
||||||
|
BundleArtifacts/
|
||||||
|
|
||||||
|
# Visual Studio cache files
|
||||||
|
# files ending in .cache can be ignored
|
||||||
|
*.[Cc]ache
|
||||||
|
# but keep track of directories ending in .cache
|
||||||
|
!*.[Cc]ache/
|
||||||
|
|
||||||
|
# Others
|
||||||
|
ClientBin/
|
||||||
|
~$*
|
||||||
|
*~
|
||||||
|
*.dbmdl
|
||||||
|
*.dbproj.schemaview
|
||||||
|
*.pfx
|
||||||
|
*.publishsettings
|
||||||
|
node_modules/
|
||||||
|
orleans.codegen.cs
|
||||||
|
|
||||||
|
# RIA/Silverlight projects
|
||||||
|
Generated_Code/
|
||||||
|
|
||||||
|
# Backup & report files from converting an old project file
|
||||||
|
# to a newer Visual Studio version. Backup files are not needed,
|
||||||
|
# because we have git ;-)
|
||||||
|
_UpgradeReport_Files/
|
||||||
|
Backup*/
|
||||||
|
UpgradeLog*.XML
|
||||||
|
UpgradeLog*.htm
|
||||||
|
|
||||||
|
# SQL Server files
|
||||||
|
*.mdf
|
||||||
|
*.ldf
|
||||||
|
|
||||||
|
# Business Intelligence projects
|
||||||
|
*.rdl.data
|
||||||
|
*.bim.layout
|
||||||
|
*.bim_*.settings
|
||||||
|
|
||||||
|
# Microsoft Fakes
|
||||||
|
FakesAssemblies/
|
||||||
|
|
||||||
|
# GhostDoc plugin setting file
|
||||||
|
*.GhostDoc.xml
|
||||||
|
|
||||||
|
# Node.js Tools for Visual Studio
|
||||||
|
.ntvs_analysis.dat
|
||||||
|
|
||||||
|
# Visual Studio 6 build log
|
||||||
|
*.plg
|
||||||
|
|
||||||
|
# Visual Studio 6 workspace options file
|
||||||
|
*.opt
|
||||||
|
|
||||||
|
# Visual Studio LightSwitch build output
|
||||||
|
**/*.HTMLClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/ModelManifest.xml
|
||||||
|
**/*.Server/GeneratedArtifacts
|
||||||
|
**/*.Server/ModelManifest.xml
|
||||||
|
_Pvt_Extensions
|
||||||
|
|
||||||
|
# Paket dependency manager
|
||||||
|
.paket/paket.exe
|
||||||
|
|
||||||
|
# FAKE - F# Make
|
||||||
|
.fake/
|
||||||
12
templates/ReactSpa/ClientApp/boot.tsx
Normal file
12
templates/ReactSpa/ClientApp/boot.tsx
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import 'bootstrap/dist/css/bootstrap.css';
|
||||||
|
import './css/site.css';
|
||||||
|
|
||||||
|
import * as React from 'react';
|
||||||
|
import * as ReactDOM from 'react-dom';
|
||||||
|
import { browserHistory, Router } from 'react-router';
|
||||||
|
import { routes } from './routes';
|
||||||
|
|
||||||
|
ReactDOM.render(
|
||||||
|
<Router history={ browserHistory } children={ routes } />,
|
||||||
|
document.getElementById('react-app')
|
||||||
|
);
|
||||||
11
templates/ReactSpa/ClientApp/components/About.tsx
Normal file
11
templates/ReactSpa/ClientApp/components/About.tsx
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
|
||||||
|
export class About extends React.Component<void, void> {
|
||||||
|
public render() {
|
||||||
|
return <div>
|
||||||
|
<h2>About</h2>
|
||||||
|
|
||||||
|
<p>Use this area to provide additional information.</p>
|
||||||
|
</div>;
|
||||||
|
}
|
||||||
|
}
|
||||||
30
templates/ReactSpa/ClientApp/components/Counter.tsx
Normal file
30
templates/ReactSpa/ClientApp/components/Counter.tsx
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
|
||||||
|
interface CounterState {
|
||||||
|
currentCount: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Counter extends React.Component<void, CounterState> {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
this.state = { currentCount: 0 };
|
||||||
|
}
|
||||||
|
|
||||||
|
public render() {
|
||||||
|
return <div>
|
||||||
|
<h2>Counter</h2>
|
||||||
|
|
||||||
|
<p>This is a simple example of a React component.</p>
|
||||||
|
|
||||||
|
<p>Current count: <strong>{ this.state.currentCount }</strong></p>
|
||||||
|
|
||||||
|
<button onClick={ () => { this.incrementCounter() } }>Increment</button>
|
||||||
|
</div>;
|
||||||
|
}
|
||||||
|
|
||||||
|
incrementCounter() {
|
||||||
|
this.setState({
|
||||||
|
currentCount: this.state.currentCount + 1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
53
templates/ReactSpa/ClientApp/components/Home.tsx
Normal file
53
templates/ReactSpa/ClientApp/components/Home.tsx
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
import { carouselItems } from '../data/CarouselItems';
|
||||||
|
import { linkLists } from '../data/HomepageLinkLists';
|
||||||
|
|
||||||
|
export class Home extends React.Component<void, void> {
|
||||||
|
public render() {
|
||||||
|
return <div>
|
||||||
|
{ /* Carousel */ }
|
||||||
|
<div id="myCarousel" className="carousel slide" data-ride="carousel" data-interval="6000">
|
||||||
|
<ol className="carousel-indicators">
|
||||||
|
{ carouselItems.map((item, index) =>
|
||||||
|
<li key={ index } data-target="#myCarousel" data-slide-to={ index } className={ index == 0 ? "active" : "" }></li>
|
||||||
|
)}
|
||||||
|
</ol>
|
||||||
|
<div className="carousel-inner" role="listbox">
|
||||||
|
{ carouselItems.map((item, index) =>
|
||||||
|
<div key={ index } className={ "item " + (index == 0 ? "active" : "") }>
|
||||||
|
<img src={ item.imageUrl } alt={ item.imageAlt } className="img-responsive" />
|
||||||
|
<div className="carousel-caption">
|
||||||
|
<p>
|
||||||
|
{ item.text }
|
||||||
|
<a className="btn btn-default" href={ item.learnMoreUrl }>Learn More</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<a className="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
|
||||||
|
<span className="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
|
||||||
|
<span className="sr-only">Previous</span>
|
||||||
|
</a>
|
||||||
|
<a className="right carousel-control" href="#myCarousel" role="button" data-slide="next">
|
||||||
|
<span className="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
|
||||||
|
<span className="sr-only">Next</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{ /* Lists of links */ }
|
||||||
|
<div className="row">
|
||||||
|
{ linkLists.map((list, listIndex) =>
|
||||||
|
<div key={listIndex} className="col-md-3">
|
||||||
|
<h2>{ list.title }</h2>
|
||||||
|
<ul>
|
||||||
|
{ list.entries.map((entry, entryIndex) =>
|
||||||
|
<li key={ entryIndex }>{ entry }</li>
|
||||||
|
)}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>;
|
||||||
|
}
|
||||||
|
}
|
||||||
26
templates/ReactSpa/ClientApp/components/NavMenu.tsx
Normal file
26
templates/ReactSpa/ClientApp/components/NavMenu.tsx
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
import { Link } from 'react-router';
|
||||||
|
export class NavMenu extends React.Component<void, void> {
|
||||||
|
public render() {
|
||||||
|
return <div className="navbar navbar-inverse navbar-fixed-top">
|
||||||
|
<div className="container">
|
||||||
|
<div className="navbar-header">
|
||||||
|
<button type="button" className="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||||
|
<span className="sr-only">Toggle navigation</span>
|
||||||
|
<span className="icon-bar"></span>
|
||||||
|
<span className="icon-bar"></span>
|
||||||
|
<span className="icon-bar"></span>
|
||||||
|
</button>
|
||||||
|
<Link className="navbar-brand" to={ '/' }>WebApplicationBasic</Link>
|
||||||
|
</div>
|
||||||
|
<div className="navbar-collapse collapse">
|
||||||
|
<ul className="nav navbar-nav">
|
||||||
|
<li><Link to={ '/' }>Home</Link></li>
|
||||||
|
<li><Link to={ '/about' }>About</Link></li>
|
||||||
|
<li><Link to={ '/counter' }>Counter</Link></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>;
|
||||||
|
}
|
||||||
|
}
|
||||||
24
templates/ReactSpa/ClientApp/css/site.css
Executable file
24
templates/ReactSpa/ClientApp/css/site.css
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
body {
|
||||||
|
padding-top: 50px;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Wrapping element */
|
||||||
|
/* Set some basic padding to keep content from hitting the edges */
|
||||||
|
.body-content {
|
||||||
|
padding-left: 15px;
|
||||||
|
padding-right: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set widths on the form inputs since otherwise they're 100% wide */
|
||||||
|
input,
|
||||||
|
select,
|
||||||
|
textarea {
|
||||||
|
max-width: 280px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Carousel */
|
||||||
|
.carousel-caption p {
|
||||||
|
font-size: 20px;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
28
templates/ReactSpa/ClientApp/data/CarouselItems.ts
Normal file
28
templates/ReactSpa/ClientApp/data/CarouselItems.ts
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
export interface CarouselItem {
|
||||||
|
imageUrl: string;
|
||||||
|
imageAlt: string;
|
||||||
|
text: string;
|
||||||
|
learnMoreUrl: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const carouselItems: CarouselItem[] = [{
|
||||||
|
imageUrl: "/images/ASP-NET-Banners-01.png",
|
||||||
|
imageAlt: "ASP.NET",
|
||||||
|
text: "Learn how to build ASP.NET apps that can run anywhere.",
|
||||||
|
learnMoreUrl: "http://go.microsoft.com/fwlink/?LinkID=525028&clcid=0x409"
|
||||||
|
}, {
|
||||||
|
imageUrl: "/images/Banner-02-VS.png",
|
||||||
|
imageAlt: "Visual Studio",
|
||||||
|
text: "There are powerful new features in Visual Studio for building modern web apps.",
|
||||||
|
learnMoreUrl: "http://go.microsoft.com/fwlink/?LinkID=525030&clcid=0x409"
|
||||||
|
}, {
|
||||||
|
imageUrl: "/images/ASP-NET-Banners-02.png",
|
||||||
|
imageAlt: "Package Management",
|
||||||
|
text: "Bring in libraries from NuGet, Bower, and npm, and automate tasks using Grunt or Gulp.",
|
||||||
|
learnMoreUrl: "http://go.microsoft.com/fwlink/?LinkID=525029&clcid=0x409"
|
||||||
|
}, {
|
||||||
|
imageUrl: "/images/Banner-01-Azure.png",
|
||||||
|
imageAlt: "Microsoft Azure",
|
||||||
|
text: "Learn how Microsoft's Azure cloud platform allows you to build, deploy, and scale web apps.",
|
||||||
|
learnMoreUrl: "http://go.microsoft.com/fwlink/?LinkID=525027&clcid=0x409"
|
||||||
|
}];
|
||||||
45
templates/ReactSpa/ClientApp/data/HomepageLinkLists.tsx
Normal file
45
templates/ReactSpa/ClientApp/data/HomepageLinkLists.tsx
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
|
||||||
|
export interface LinkList {
|
||||||
|
title: string;
|
||||||
|
entries: JSX.Element[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export const linkLists: LinkList[] = [{
|
||||||
|
title: "Application uses",
|
||||||
|
entries: [
|
||||||
|
<div>Sample pages using ASP.NET MVC 6</div>,
|
||||||
|
<div><a href="http://go.microsoft.com/fwlink/?LinkId=518007">Gulp</a> and <a href="http://go.microsoft.com/fwlink/?LinkId=518004">Bower</a> for managing client-side libraries</div>,
|
||||||
|
<div>Theming using <a href="http://go.microsoft.com/fwlink/?LinkID=398939">Bootstrap</a></div>
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
title: "How to",
|
||||||
|
entries: [
|
||||||
|
<div><a href="http://go.microsoft.com/fwlink/?LinkID=398600">Add a Controller and View</a></div>,
|
||||||
|
<div><a href="http://go.microsoft.com/fwlink/?LinkID=699314">Add an appsetting in config and access it in app.</a></div>,
|
||||||
|
<div><a href="http://go.microsoft.com/fwlink/?LinkId=699315">Manage User Secrets using Secret Manager.</a></div>,
|
||||||
|
<div><a href="http://go.microsoft.com/fwlink/?LinkId=699316">Use logging to log a message.</a></div>,
|
||||||
|
<div><a href="http://go.microsoft.com/fwlink/?LinkId=699317">Add packages using NuGet.</a></div>,
|
||||||
|
<div><a href="http://go.microsoft.com/fwlink/?LinkId=699318">Add client packages using Bower.</a></div>,
|
||||||
|
<div><a href="http://go.microsoft.com/fwlink/?LinkId=699319">Target development, staging or production environment.</a></div>
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
title: "Overview",
|
||||||
|
entries: [
|
||||||
|
<div><a href="http://go.microsoft.com/fwlink/?LinkId=518008">Conceptual overview of what is ASP.NET 5</a></div>,
|
||||||
|
<div><a href="http://go.microsoft.com/fwlink/?LinkId=699320">Fundamentals of ASP.NET 5 such as Startup and middleware.</a></div>,
|
||||||
|
<div><a href="http://go.microsoft.com/fwlink/?LinkId=398602">Working with Data</a></div>,
|
||||||
|
<div><a href="http://go.microsoft.com/fwlink/?LinkId=398603">Security</a></div>,
|
||||||
|
<div><a href="http://go.microsoft.com/fwlink/?LinkID=699321">Client side development</a></div>,
|
||||||
|
<div><a href="http://go.microsoft.com/fwlink/?LinkID=699322">Develop on different platforms</a></div>,
|
||||||
|
<div><a href="http://go.microsoft.com/fwlink/?LinkID=699323">Read more on the documentation site</a></div>
|
||||||
|
]
|
||||||
|
}, {
|
||||||
|
title: "Run & Deploy",
|
||||||
|
entries: [
|
||||||
|
<div><a href="http://go.microsoft.com/fwlink/?LinkID=517851">Run your app</a></div>,
|
||||||
|
<div><a href="http://go.microsoft.com/fwlink/?LinkID=517852">Run your app on .NET Core</a></div>,
|
||||||
|
<div><a href="http://go.microsoft.com/fwlink/?LinkID=517853">Run commands in your project.json</a></div>,
|
||||||
|
<div><a href="http://go.microsoft.com/fwlink/?LinkID=398609">Publish to Microsoft Azure Web Apps</a></div>
|
||||||
|
]
|
||||||
|
}];
|
||||||
27
templates/ReactSpa/ClientApp/routes.tsx
Normal file
27
templates/ReactSpa/ClientApp/routes.tsx
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import * as React from 'react';
|
||||||
|
import { Router, Route, HistoryBase } from 'react-router';
|
||||||
|
import { NavMenu } from './components/NavMenu';
|
||||||
|
import { Home } from './components/Home';
|
||||||
|
import { About } from './components/About';
|
||||||
|
import { Counter } from './components/Counter';
|
||||||
|
|
||||||
|
class Layout extends React.Component<{ body: React.ReactElement<any> }, void> {
|
||||||
|
public render() {
|
||||||
|
return <div>
|
||||||
|
<NavMenu />
|
||||||
|
<div className="container body-content">
|
||||||
|
{ this.props.body }
|
||||||
|
<hr />
|
||||||
|
<footer>
|
||||||
|
<p>© 2016 - WebApplicationBasic</p>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
</div>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const routes = <Route component={ Layout }>
|
||||||
|
<Route path="/" components={{ body: Home }} />
|
||||||
|
<Route path="/about" components={{ body: About }} />
|
||||||
|
<Route path="/counter" components={{ body: Counter }} />
|
||||||
|
</Route>;
|
||||||
21
templates/ReactSpa/Controllers/HomeController.cs
Executable file
21
templates/ReactSpa/Controllers/HomeController.cs
Executable file
@@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNet.Mvc;
|
||||||
|
|
||||||
|
namespace WebApplicationBasic.Controllers
|
||||||
|
{
|
||||||
|
public class HomeController : Controller
|
||||||
|
{
|
||||||
|
public IActionResult Index()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IActionResult Error()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
templates/ReactSpa/Dockerfile
Normal file
11
templates/ReactSpa/Dockerfile
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
FROM microsoft/aspnet:1.0.0-rc1-update1
|
||||||
|
|
||||||
|
RUN printf "deb http://ftp.us.debian.org/debian jessie main\n" >> /etc/apt/sources.list
|
||||||
|
RUN apt-get -qq update && apt-get install -qqy sqlite3 libsqlite3-dev && rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
COPY . /app
|
||||||
|
WORKDIR /app
|
||||||
|
RUN ["dnu", "restore"]
|
||||||
|
|
||||||
|
EXPOSE 5000/tcp
|
||||||
|
ENTRYPOINT ["dnx", "-p", "project.json", "web"]
|
||||||
40
templates/ReactSpa/README.md
Normal file
40
templates/ReactSpa/README.md
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
# Welcome to ASP.NET 5
|
||||||
|
|
||||||
|
We've made some big updates in this release, so it’s **important** that you spend a few minutes to learn what’s new.
|
||||||
|
|
||||||
|
You've created a new ASP.NET 5 project. [Learn what's new](http://go.microsoft.com/fwlink/?LinkId=518016)
|
||||||
|
|
||||||
|
## This application consists of:
|
||||||
|
|
||||||
|
* Sample pages using ASP.NET MVC 6
|
||||||
|
* [Gulp](http://go.microsoft.com/fwlink/?LinkId=518007) and [Bower](http://go.microsoft.com/fwlink/?LinkId=518004) for managing client-side libraries
|
||||||
|
* Theming using [Bootstrap](http://go.microsoft.com/fwlink/?LinkID=398939)
|
||||||
|
|
||||||
|
## How to
|
||||||
|
|
||||||
|
* [Add a Controller and View](http://go.microsoft.com/fwlink/?LinkID=398600)
|
||||||
|
* [Add an appsetting in config and access it in app.](http://go.microsoft.com/fwlink/?LinkID=699562)
|
||||||
|
* [Manage User Secrets using Secret Manager.](http://go.microsoft.com/fwlink/?LinkId=699315)
|
||||||
|
* [Use logging to log a message.](http://go.microsoft.com/fwlink/?LinkId=699316)
|
||||||
|
* [Add packages using NuGet.](http://go.microsoft.com/fwlink/?LinkId=699317)
|
||||||
|
* [Add client packages using Bower.](http://go.microsoft.com/fwlink/?LinkId=699318)
|
||||||
|
* [Target development, staging or production environment.](http://go.microsoft.com/fwlink/?LinkId=699319)
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
* [Conceptual overview of what is ASP.NET 5](http://go.microsoft.com/fwlink/?LinkId=518008)
|
||||||
|
* [Fundamentals of ASP.NET 5 such as Startup and middleware.](http://go.microsoft.com/fwlink/?LinkId=699320)
|
||||||
|
* [Working with Data](http://go.microsoft.com/fwlink/?LinkId=398602)
|
||||||
|
* [Security](http://go.microsoft.com/fwlink/?LinkId=398603)
|
||||||
|
* [Client side development](http://go.microsoft.com/fwlink/?LinkID=699321)
|
||||||
|
* [Develop on different platforms](http://go.microsoft.com/fwlink/?LinkID=699322)
|
||||||
|
* [Read more on the documentation site](http://go.microsoft.com/fwlink/?LinkID=699323)
|
||||||
|
|
||||||
|
## Run & Deploy
|
||||||
|
|
||||||
|
* [Run your app](http://go.microsoft.com/fwlink/?LinkID=517851)
|
||||||
|
* [Run your app on .NET Core](http://go.microsoft.com/fwlink/?LinkID=517852)
|
||||||
|
* [Run commands in your project.json](http://go.microsoft.com/fwlink/?LinkID=517853)
|
||||||
|
* [Publish to Microsoft Azure Web Apps](http://go.microsoft.com/fwlink/?LinkID=398609)
|
||||||
|
|
||||||
|
We would love to hear your [feedback](http://go.microsoft.com/fwlink/?LinkId=518015)
|
||||||
67
templates/ReactSpa/Startup.cs
Executable file
67
templates/ReactSpa/Startup.cs
Executable file
@@ -0,0 +1,67 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNet.Builder;
|
||||||
|
using Microsoft.AspNet.Hosting;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace WebApplicationBasic
|
||||||
|
{
|
||||||
|
public class Startup
|
||||||
|
{
|
||||||
|
public Startup(IHostingEnvironment env)
|
||||||
|
{
|
||||||
|
// Set up configuration sources.
|
||||||
|
var builder = new ConfigurationBuilder()
|
||||||
|
.AddJsonFile("appsettings.json")
|
||||||
|
.AddEnvironmentVariables();
|
||||||
|
Configuration = builder.Build();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IConfigurationRoot Configuration { get; set; }
|
||||||
|
|
||||||
|
// This method gets called by the runtime. Use this method to add services to the container.
|
||||||
|
public void ConfigureServices(IServiceCollection services)
|
||||||
|
{
|
||||||
|
// Add framework services.
|
||||||
|
services.AddMvc();
|
||||||
|
}
|
||||||
|
|
||||||
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||||
|
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
|
||||||
|
{
|
||||||
|
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
|
||||||
|
loggerFactory.AddDebug();
|
||||||
|
|
||||||
|
if (env.IsDevelopment())
|
||||||
|
{
|
||||||
|
app.UseDeveloperExceptionPage();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
app.UseExceptionHandler("/Home/Error");
|
||||||
|
}
|
||||||
|
|
||||||
|
app.UseIISPlatformHandler();
|
||||||
|
|
||||||
|
app.UseStaticFiles();
|
||||||
|
|
||||||
|
app.UseMvc(routes =>
|
||||||
|
{
|
||||||
|
routes.MapRoute(
|
||||||
|
name: "default",
|
||||||
|
template: "{controller=Home}/{action=Index}/{id?}");
|
||||||
|
|
||||||
|
routes.MapSpaFallbackRoute(
|
||||||
|
name: "spa-fallback",
|
||||||
|
defaults: new { controller = "Home", action = "Index" });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Entry point for the application.
|
||||||
|
public static void Main(string[] args) => Microsoft.AspNet.Hosting.WebApplication.Run<Startup>(args);
|
||||||
|
}
|
||||||
|
}
|
||||||
9
templates/ReactSpa/Views/Home/Index.cshtml
Normal file
9
templates/ReactSpa/Views/Home/Index.cshtml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "Home Page";
|
||||||
|
}
|
||||||
|
|
||||||
|
<div id="react-app">Loading...</div>
|
||||||
|
|
||||||
|
@section scripts {
|
||||||
|
<script src="~/dist/main.js" asp-append-version="true"></script>
|
||||||
|
}
|
||||||
6
templates/ReactSpa/Views/Shared/Error.cshtml
Executable file
6
templates/ReactSpa/Views/Shared/Error.cshtml
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "Error";
|
||||||
|
}
|
||||||
|
|
||||||
|
<h1 class="text-danger">Error.</h1>
|
||||||
|
<h2 class="text-danger">An error occurred while processing your request.</h2>
|
||||||
18
templates/ReactSpa/Views/Shared/_Layout.cshtml
Normal file
18
templates/ReactSpa/Views/Shared/_Layout.cshtml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>@ViewData["Title"] - WebApplicationBasic</title>
|
||||||
|
|
||||||
|
<environment names="Staging,Production">
|
||||||
|
<link rel="stylesheet" href="~/dist/site.css" />
|
||||||
|
</environment>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
@RenderBody()
|
||||||
|
|
||||||
|
<script src="~/dist/vendor.js" asp-append-version="true"></script>
|
||||||
|
@RenderSection("scripts", required: false)
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
2
templates/ReactSpa/Views/_ViewImports.cshtml
Executable file
2
templates/ReactSpa/Views/_ViewImports.cshtml
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
@using WebApplicationBasic
|
||||||
|
@addTagHelper "*, Microsoft.AspNet.Mvc.TagHelpers"
|
||||||
3
templates/ReactSpa/Views/_ViewStart.cshtml
Executable file
3
templates/ReactSpa/Views/_ViewStart.cshtml
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
@{
|
||||||
|
Layout = "_Layout";
|
||||||
|
}
|
||||||
10
templates/ReactSpa/appsettings.json
Executable file
10
templates/ReactSpa/appsettings.json
Executable file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"Logging": {
|
||||||
|
"IncludeScopes": false,
|
||||||
|
"LogLevel": {
|
||||||
|
"Default": "Verbose",
|
||||||
|
"System": "Information",
|
||||||
|
"Microsoft": "Information"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
26
templates/ReactSpa/package.json
Normal file
26
templates/ReactSpa/package.json
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"name": "WebApplicationBasic",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"devDependencies": {
|
||||||
|
"babel-loader": "^6.2.3",
|
||||||
|
"babel-preset-es2015": "^6.5.0",
|
||||||
|
"babel-preset-react": "^6.5.0",
|
||||||
|
"bootstrap": "^3.3.6",
|
||||||
|
"css-loader": "^0.23.1",
|
||||||
|
"extendify": "^1.0.0",
|
||||||
|
"extract-text-webpack-plugin": "^1.0.1",
|
||||||
|
"file-loader": "^0.8.5",
|
||||||
|
"jquery": "^2.2.1",
|
||||||
|
"style-loader": "^0.13.0",
|
||||||
|
"ts-loader": "^0.8.1",
|
||||||
|
"typescript": "^1.8.2",
|
||||||
|
"url-loader": "^0.5.7",
|
||||||
|
"webpack": "^1.12.14"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"babel-core": "^6.5.2",
|
||||||
|
"react": "^0.14.7",
|
||||||
|
"react-dom": "^0.14.7",
|
||||||
|
"react-router": "^2.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
51
templates/ReactSpa/project.json
Executable file
51
templates/ReactSpa/project.json
Executable file
@@ -0,0 +1,51 @@
|
|||||||
|
{
|
||||||
|
"version": "1.0.0-*",
|
||||||
|
"compilationOptions": {
|
||||||
|
"emitEntryPoint": true
|
||||||
|
},
|
||||||
|
"tooling": {
|
||||||
|
"defaultNamespace": "WebApplicationBasic"
|
||||||
|
},
|
||||||
|
|
||||||
|
"dependencies": {
|
||||||
|
"Microsoft.AspNet.Diagnostics": "1.0.0-rc1-final",
|
||||||
|
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
|
||||||
|
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
|
||||||
|
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
|
||||||
|
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
|
||||||
|
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
|
||||||
|
"Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final",
|
||||||
|
"Microsoft.Extensions.Configuration.FileProviderExtensions" : "1.0.0-rc1-final",
|
||||||
|
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
|
||||||
|
"Microsoft.Extensions.Logging": "1.0.0-rc1-final",
|
||||||
|
"Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
|
||||||
|
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
|
||||||
|
"Microsoft.AspNet.ReactServices": "1.0.0-alpha7"
|
||||||
|
},
|
||||||
|
|
||||||
|
"commands": {
|
||||||
|
"web": "Microsoft.AspNet.Server.Kestrel"
|
||||||
|
},
|
||||||
|
|
||||||
|
"frameworks": {
|
||||||
|
"dnx451": {},
|
||||||
|
"dnxcore50": {}
|
||||||
|
},
|
||||||
|
|
||||||
|
"exclude": [
|
||||||
|
"wwwroot",
|
||||||
|
"node_modules",
|
||||||
|
],
|
||||||
|
"publishExclude": [
|
||||||
|
"node_modules",
|
||||||
|
"**.xproj",
|
||||||
|
"**.user",
|
||||||
|
"**.vspscc"
|
||||||
|
],
|
||||||
|
"scripts": {
|
||||||
|
"prepublish": [
|
||||||
|
"npm install",
|
||||||
|
"webpack"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
11
templates/ReactSpa/tsconfig.json
Normal file
11
templates/ReactSpa/tsconfig.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"target": "es6",
|
||||||
|
"jsx": "preserve",
|
||||||
|
"sourceMap": true
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"node_modules"
|
||||||
|
]
|
||||||
|
}
|
||||||
21
templates/ReactSpa/tsd.json
Normal file
21
templates/ReactSpa/tsd.json
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"version": "v4",
|
||||||
|
"repo": "borisyankov/DefinitelyTyped",
|
||||||
|
"ref": "master",
|
||||||
|
"path": "typings",
|
||||||
|
"bundle": "typings/tsd.d.ts",
|
||||||
|
"installed": {
|
||||||
|
"react/react.d.ts": {
|
||||||
|
"commit": "dade4414712ce84e3c63393f1aae407e9e7e6af7"
|
||||||
|
},
|
||||||
|
"react-router/react-router.d.ts": {
|
||||||
|
"commit": "dade4414712ce84e3c63393f1aae407e9e7e6af7"
|
||||||
|
},
|
||||||
|
"react/react-dom.d.ts": {
|
||||||
|
"commit": "dade4414712ce84e3c63393f1aae407e9e7e6af7"
|
||||||
|
},
|
||||||
|
"react-router/history.d.ts": {
|
||||||
|
"commit": "dade4414712ce84e3c63393f1aae407e9e7e6af7"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
192
templates/ReactSpa/typings/react-router/history.d.ts
vendored
Normal file
192
templates/ReactSpa/typings/react-router/history.d.ts
vendored
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
// Type definitions for history v1.13.1
|
||||||
|
// Project: https://github.com/rackt/history
|
||||||
|
// Definitions by: Sergey Buturlakin <http://github.com/sergey-buturlakin>
|
||||||
|
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||||
|
|
||||||
|
|
||||||
|
declare namespace HistoryModule {
|
||||||
|
|
||||||
|
// types based on https://github.com/rackt/history/blob/master/docs/Terms.md
|
||||||
|
|
||||||
|
type Action = string
|
||||||
|
|
||||||
|
type BeforeUnloadHook = () => string | boolean
|
||||||
|
|
||||||
|
type CreateHistory<T> = (options?: HistoryOptions) => T
|
||||||
|
|
||||||
|
type CreateHistoryEnhancer<T, E> = (createHistory: CreateHistory<T>) => CreateHistory<T & E>
|
||||||
|
|
||||||
|
interface History {
|
||||||
|
listenBefore(hook: TransitionHook): Function
|
||||||
|
listen(listener: LocationListener): Function
|
||||||
|
transitionTo(location: Location): void
|
||||||
|
pushState(state: LocationState, path: Path): void
|
||||||
|
replaceState(state: LocationState, path: Path): void
|
||||||
|
push(path: Path): void
|
||||||
|
replace(path: Path): void
|
||||||
|
go(n: number): void
|
||||||
|
goBack(): void
|
||||||
|
goForward(): void
|
||||||
|
createKey(): LocationKey
|
||||||
|
createPath(path: Path): Path
|
||||||
|
createHref(path: Path): Href
|
||||||
|
createLocation(path?: Path, state?: LocationState, action?: Action, key?: LocationKey): Location
|
||||||
|
|
||||||
|
/** @deprecated use location.key to save state instead */
|
||||||
|
setState(state: LocationState): void
|
||||||
|
/** @deprecated use listenBefore instead */
|
||||||
|
registerTransitionHook(hook: TransitionHook): void
|
||||||
|
/** @deprecated use the callback returned from listenBefore instead */
|
||||||
|
unregisterTransitionHook(hook: TransitionHook): void
|
||||||
|
}
|
||||||
|
|
||||||
|
type HistoryOptions = Object
|
||||||
|
|
||||||
|
type Href = string
|
||||||
|
|
||||||
|
type Location = {
|
||||||
|
pathname: Pathname
|
||||||
|
search: QueryString
|
||||||
|
query: Query
|
||||||
|
state: LocationState
|
||||||
|
action: Action
|
||||||
|
key: LocationKey
|
||||||
|
}
|
||||||
|
|
||||||
|
type LocationKey = string
|
||||||
|
|
||||||
|
type LocationListener = (location: Location) => void
|
||||||
|
|
||||||
|
type LocationState = Object
|
||||||
|
|
||||||
|
type Path = string // Pathname + QueryString
|
||||||
|
|
||||||
|
type Pathname = string
|
||||||
|
|
||||||
|
type Query = Object
|
||||||
|
|
||||||
|
type QueryString = string
|
||||||
|
|
||||||
|
type TransitionHook = (location: Location, callback: Function) => any
|
||||||
|
|
||||||
|
|
||||||
|
interface HistoryBeforeUnload {
|
||||||
|
listenBeforeUnload(hook: BeforeUnloadHook): Function
|
||||||
|
}
|
||||||
|
|
||||||
|
interface HistoryQueries {
|
||||||
|
pushState(state: LocationState, pathname: Pathname | Path, query?: Query): void
|
||||||
|
replaceState(state: LocationState, pathname: Pathname | Path, query?: Query): void
|
||||||
|
createPath(path: Path, query?: Query): Path
|
||||||
|
createHref(path: Path, query?: Query): Href
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Global usage, without modules, needs the small trick, because lib.d.ts
|
||||||
|
// already has `history` and `History` global definitions:
|
||||||
|
// var createHistory = ((window as any).History as HistoryModule.Module).createHistory;
|
||||||
|
interface Module {
|
||||||
|
createHistory: CreateHistory<History>
|
||||||
|
createHashHistory: CreateHistory<History>
|
||||||
|
createMemoryHistory: CreateHistory<History>
|
||||||
|
createLocation(path?: Path, state?: LocationState, action?: Action, key?: LocationKey): Location
|
||||||
|
useBasename<T>(createHistory: CreateHistory<T>): CreateHistory<T>
|
||||||
|
useBeforeUnload<T>(createHistory: CreateHistory<T>): CreateHistory<T & HistoryBeforeUnload>
|
||||||
|
useQueries<T>(createHistory: CreateHistory<T>): CreateHistory<T & HistoryQueries>
|
||||||
|
actions: {
|
||||||
|
PUSH: string
|
||||||
|
REPLACE: string
|
||||||
|
POP: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
declare module "history/lib/createBrowserHistory" {
|
||||||
|
|
||||||
|
export default function createBrowserHistory(options?: HistoryModule.HistoryOptions): HistoryModule.History
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
declare module "history/lib/createHashHistory" {
|
||||||
|
|
||||||
|
export default function createHashHistory(options?: HistoryModule.HistoryOptions): HistoryModule.History
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
declare module "history/lib/createMemoryHistory" {
|
||||||
|
|
||||||
|
export default function createMemoryHistory(options?: HistoryModule.HistoryOptions): HistoryModule.History
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
declare module "history/lib/createLocation" {
|
||||||
|
|
||||||
|
export default function createLocation(path?: HistoryModule.Path, state?: HistoryModule.LocationState, action?: HistoryModule.Action, key?: HistoryModule.LocationKey): HistoryModule.Location
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
declare module "history/lib/useBasename" {
|
||||||
|
|
||||||
|
export default function useBasename<T>(createHistory: HistoryModule.CreateHistory<T>): HistoryModule.CreateHistory<T>
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
declare module "history/lib/useBeforeUnload" {
|
||||||
|
|
||||||
|
export default function useBeforeUnload<T>(createHistory: HistoryModule.CreateHistory<T>): HistoryModule.CreateHistory<T & HistoryModule.HistoryBeforeUnload>
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
declare module "history/lib/useQueries" {
|
||||||
|
|
||||||
|
export default function useQueries<T>(createHistory: HistoryModule.CreateHistory<T>): HistoryModule.CreateHistory<T & HistoryModule.HistoryQueries>
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
declare module "history/lib/actions" {
|
||||||
|
|
||||||
|
export const PUSH: string
|
||||||
|
|
||||||
|
export const REPLACE: string
|
||||||
|
|
||||||
|
export const POP: string
|
||||||
|
|
||||||
|
export default {
|
||||||
|
PUSH,
|
||||||
|
REPLACE,
|
||||||
|
POP
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
declare module "history" {
|
||||||
|
|
||||||
|
export { default as createHistory } from "history/lib/createBrowserHistory"
|
||||||
|
|
||||||
|
export { default as createHashHistory } from "history/lib/createHashHistory"
|
||||||
|
|
||||||
|
export { default as createMemoryHistory } from "history/lib/createMemoryHistory"
|
||||||
|
|
||||||
|
export { default as createLocation } from "history/lib/createLocation"
|
||||||
|
|
||||||
|
export { default as useBasename } from "history/lib/useBasename"
|
||||||
|
|
||||||
|
export { default as useBeforeUnload } from "history/lib/useBeforeUnload"
|
||||||
|
|
||||||
|
export { default as useQueries } from "history/lib/useQueries"
|
||||||
|
|
||||||
|
import * as Actions from "history/lib/actions"
|
||||||
|
|
||||||
|
export { Actions }
|
||||||
|
|
||||||
|
}
|
||||||
474
templates/ReactSpa/typings/react-router/react-router.d.ts
vendored
Normal file
474
templates/ReactSpa/typings/react-router/react-router.d.ts
vendored
Normal file
@@ -0,0 +1,474 @@
|
|||||||
|
// Type definitions for react-router v2.0.0-rc5
|
||||||
|
// Project: https://github.com/rackt/react-router
|
||||||
|
// Definitions by: Sergey Buturlakin <http://github.com/sergey-buturlakin>, Yuichi Murata <https://github.com/mrk21>, Václav Ostrožlík <https://github.com/vasek17>
|
||||||
|
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||||
|
|
||||||
|
|
||||||
|
/// <reference path="../react/react.d.ts" />
|
||||||
|
/// <reference path="./history.d.ts"/>
|
||||||
|
|
||||||
|
|
||||||
|
declare namespace ReactRouter {
|
||||||
|
|
||||||
|
import React = __React
|
||||||
|
|
||||||
|
import H = HistoryModule
|
||||||
|
|
||||||
|
// types based on https://github.com/rackt/react-router/blob/master/docs/Glossary.md
|
||||||
|
|
||||||
|
type Component = React.ReactType
|
||||||
|
|
||||||
|
type EnterHook = (nextState: RouterState, replaceState: RedirectFunction, callback?: Function) => any
|
||||||
|
|
||||||
|
type LeaveHook = () => any
|
||||||
|
|
||||||
|
type Params = Object
|
||||||
|
|
||||||
|
type ParseQueryString = (queryString: H.QueryString) => H.Query
|
||||||
|
|
||||||
|
type RedirectFunction = (state: H.LocationState, pathname: H.Pathname | H.Path, query?: H.Query) => void
|
||||||
|
|
||||||
|
type RouteComponent = Component
|
||||||
|
|
||||||
|
// use the following interface in an app code to get access to route param values, history, location...
|
||||||
|
// interface MyComponentProps extends ReactRouter.RouteComponentProps<{}, { id: number }> {}
|
||||||
|
// somewhere in MyComponent
|
||||||
|
// ...
|
||||||
|
// let id = this.props.routeParams.id
|
||||||
|
// ...
|
||||||
|
// this.props.history. ...
|
||||||
|
// ...
|
||||||
|
interface RouteComponentProps<P, R> {
|
||||||
|
history?: History
|
||||||
|
location?: H.Location
|
||||||
|
params?: P
|
||||||
|
route?: PlainRoute
|
||||||
|
routeParams?: R
|
||||||
|
routes?: PlainRoute[]
|
||||||
|
children?: React.ReactElement<any>
|
||||||
|
}
|
||||||
|
|
||||||
|
type RouteComponents = { [key: string]: RouteComponent }
|
||||||
|
|
||||||
|
type RouteConfig = React.ReactNode | PlainRoute | PlainRoute[]
|
||||||
|
|
||||||
|
type RouteHook = (nextLocation?: H.Location) => any
|
||||||
|
|
||||||
|
type RoutePattern = string
|
||||||
|
|
||||||
|
type StringifyQuery = (queryObject: H.Query) => H.QueryString
|
||||||
|
|
||||||
|
type RouterListener = (error: Error, nextState: RouterState) => void
|
||||||
|
|
||||||
|
interface RouterState {
|
||||||
|
location: H.Location
|
||||||
|
routes: PlainRoute[]
|
||||||
|
params: Params
|
||||||
|
components: RouteComponent[]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
interface HistoryBase extends H.History {
|
||||||
|
routes: PlainRoute[]
|
||||||
|
parseQueryString?: ParseQueryString
|
||||||
|
stringifyQuery?: StringifyQuery
|
||||||
|
}
|
||||||
|
|
||||||
|
type History = HistoryBase & H.HistoryQueries & HistoryRoutes
|
||||||
|
const browserHistory: History;
|
||||||
|
const hashHistory: History;
|
||||||
|
|
||||||
|
/* components */
|
||||||
|
|
||||||
|
interface RouterProps extends React.Props<Router> {
|
||||||
|
history?: H.History
|
||||||
|
routes?: RouteConfig // alias for children
|
||||||
|
createElement?: (component: RouteComponent, props: Object) => any
|
||||||
|
onError?: (error: any) => any
|
||||||
|
onUpdate?: () => any
|
||||||
|
parseQueryString?: ParseQueryString
|
||||||
|
stringifyQuery?: StringifyQuery
|
||||||
|
}
|
||||||
|
interface Router extends React.ComponentClass<RouterProps> {}
|
||||||
|
interface RouterElement extends React.ReactElement<RouterProps> {}
|
||||||
|
const Router: Router
|
||||||
|
|
||||||
|
|
||||||
|
interface LinkProps extends React.HTMLAttributes, React.Props<Link> {
|
||||||
|
activeStyle?: React.CSSProperties
|
||||||
|
activeClassName?: string
|
||||||
|
onlyActiveOnIndex?: boolean
|
||||||
|
to: RoutePattern
|
||||||
|
query?: H.Query
|
||||||
|
state?: H.LocationState
|
||||||
|
}
|
||||||
|
interface Link extends React.ComponentClass<LinkProps> {}
|
||||||
|
interface LinkElement extends React.ReactElement<LinkProps> {}
|
||||||
|
const Link: Link
|
||||||
|
|
||||||
|
|
||||||
|
const IndexLink: Link
|
||||||
|
|
||||||
|
|
||||||
|
interface RouterContextProps extends React.Props<RouterContext> {
|
||||||
|
history?: H.History
|
||||||
|
router: Router
|
||||||
|
createElement: (component: RouteComponent, props: Object) => any
|
||||||
|
location: H.Location
|
||||||
|
routes: RouteConfig
|
||||||
|
params: Params
|
||||||
|
components?: RouteComponent[]
|
||||||
|
}
|
||||||
|
interface RouterContext extends React.ComponentClass<RouterContextProps> {}
|
||||||
|
interface RouterContextElement extends React.ReactElement<RouterContextProps> {
|
||||||
|
history?: H.History
|
||||||
|
location: H.Location
|
||||||
|
router?: Router
|
||||||
|
}
|
||||||
|
const RouterContext: RouterContext
|
||||||
|
|
||||||
|
|
||||||
|
/* components (configuration) */
|
||||||
|
|
||||||
|
interface RouteProps extends React.Props<Route> {
|
||||||
|
path?: RoutePattern
|
||||||
|
component?: RouteComponent
|
||||||
|
components?: RouteComponents
|
||||||
|
getComponent?: (location: H.Location, cb: (error: any, component?: RouteComponent) => void) => void
|
||||||
|
getComponents?: (location: H.Location, cb: (error: any, components?: RouteComponents) => void) => void
|
||||||
|
onEnter?: EnterHook
|
||||||
|
onLeave?: LeaveHook
|
||||||
|
getIndexRoute?: (location: H.Location, cb: (error: any, indexRoute: RouteConfig) => void) => void
|
||||||
|
getChildRoutes?: (location: H.Location, cb: (error: any, childRoutes: RouteConfig) => void) => void
|
||||||
|
}
|
||||||
|
interface Route extends React.ComponentClass<RouteProps> {}
|
||||||
|
interface RouteElement extends React.ReactElement<RouteProps> {}
|
||||||
|
const Route: Route
|
||||||
|
|
||||||
|
|
||||||
|
interface PlainRoute {
|
||||||
|
path?: RoutePattern
|
||||||
|
component?: RouteComponent
|
||||||
|
components?: RouteComponents
|
||||||
|
getComponent?: (location: H.Location, cb: (error: any, component?: RouteComponent) => void) => void
|
||||||
|
getComponents?: (location: H.Location, cb: (error: any, components?: RouteComponents) => void) => void
|
||||||
|
onEnter?: EnterHook
|
||||||
|
onLeave?: LeaveHook
|
||||||
|
indexRoute?: PlainRoute
|
||||||
|
getIndexRoute?: (location: H.Location, cb: (error: any, indexRoute: RouteConfig) => void) => void
|
||||||
|
childRoutes?: PlainRoute[]
|
||||||
|
getChildRoutes?: (location: H.Location, cb: (error: any, childRoutes: RouteConfig) => void) => void
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
interface RedirectProps extends React.Props<Redirect> {
|
||||||
|
path?: RoutePattern
|
||||||
|
from?: RoutePattern // alias for path
|
||||||
|
to: RoutePattern
|
||||||
|
query?: H.Query
|
||||||
|
state?: H.LocationState
|
||||||
|
}
|
||||||
|
interface Redirect extends React.ComponentClass<RedirectProps> {}
|
||||||
|
interface RedirectElement extends React.ReactElement<RedirectProps> {}
|
||||||
|
const Redirect: Redirect
|
||||||
|
|
||||||
|
|
||||||
|
interface IndexRouteProps extends React.Props<IndexRoute> {
|
||||||
|
component?: RouteComponent
|
||||||
|
components?: RouteComponents
|
||||||
|
getComponent?: (location: H.Location, cb: (error: any, component?: RouteComponent) => void) => void
|
||||||
|
getComponents?: (location: H.Location, cb: (error: any, components?: RouteComponents) => void) => void
|
||||||
|
onEnter?: EnterHook
|
||||||
|
onLeave?: LeaveHook
|
||||||
|
}
|
||||||
|
interface IndexRoute extends React.ComponentClass<IndexRouteProps> {}
|
||||||
|
interface IndexRouteElement extends React.ReactElement<IndexRouteProps> {}
|
||||||
|
const IndexRoute: IndexRoute
|
||||||
|
|
||||||
|
|
||||||
|
interface IndexRedirectProps extends React.Props<IndexRedirect> {
|
||||||
|
to: RoutePattern
|
||||||
|
query?: H.Query
|
||||||
|
state?: H.LocationState
|
||||||
|
}
|
||||||
|
interface IndexRedirect extends React.ComponentClass<IndexRedirectProps> {}
|
||||||
|
interface IndexRedirectElement extends React.ReactElement<IndexRedirectProps> {}
|
||||||
|
const IndexRedirect: IndexRedirect
|
||||||
|
|
||||||
|
|
||||||
|
/* mixins */
|
||||||
|
|
||||||
|
interface HistoryMixin {
|
||||||
|
history: History
|
||||||
|
}
|
||||||
|
const History: React.Mixin<any, any>
|
||||||
|
|
||||||
|
|
||||||
|
interface LifecycleMixin {
|
||||||
|
routerWillLeave(nextLocation: H.Location): string | boolean
|
||||||
|
}
|
||||||
|
const Lifecycle: React.Mixin<any, any>
|
||||||
|
|
||||||
|
|
||||||
|
const RouteContext: React.Mixin<any, any>
|
||||||
|
|
||||||
|
|
||||||
|
/* utils */
|
||||||
|
|
||||||
|
interface HistoryRoutes {
|
||||||
|
listen(listener: RouterListener): Function
|
||||||
|
listenBeforeLeavingRoute(route: PlainRoute, hook: RouteHook): void
|
||||||
|
match(location: H.Location, callback: (error: any, nextState: RouterState, nextLocation: H.Location) => void): void
|
||||||
|
isActive(pathname: H.Pathname, query?: H.Query, indexOnly?: boolean): boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
function useRoutes<T>(createHistory: HistoryModule.CreateHistory<T>): HistoryModule.CreateHistory<T & HistoryRoutes>
|
||||||
|
|
||||||
|
|
||||||
|
function createRoutes(routes: RouteConfig): PlainRoute[]
|
||||||
|
|
||||||
|
|
||||||
|
interface MatchArgs {
|
||||||
|
routes?: RouteConfig
|
||||||
|
history?: H.History
|
||||||
|
location?: H.Location
|
||||||
|
parseQueryString?: ParseQueryString
|
||||||
|
stringifyQuery?: StringifyQuery
|
||||||
|
}
|
||||||
|
interface MatchState extends RouterState {
|
||||||
|
history: History
|
||||||
|
}
|
||||||
|
function match(args: MatchArgs, cb: (error: any, nextLocation: H.Location, nextState: MatchState) => void): void
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
declare module "react-router/lib/Router" {
|
||||||
|
|
||||||
|
export default ReactRouter.Router
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
declare module "react-router/lib/Link" {
|
||||||
|
|
||||||
|
export default ReactRouter.Link
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
declare module "react-router/lib/IndexLink" {
|
||||||
|
|
||||||
|
export default ReactRouter.IndexLink
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
declare module "react-router/lib/IndexRedirect" {
|
||||||
|
|
||||||
|
export default ReactRouter.IndexRedirect
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
declare module "react-router/lib/IndexRoute" {
|
||||||
|
|
||||||
|
export default ReactRouter.IndexRoute
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
declare module "react-router/lib/Redirect" {
|
||||||
|
|
||||||
|
export default ReactRouter.Redirect
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
declare module "react-router/lib/Route" {
|
||||||
|
|
||||||
|
export default ReactRouter.Route
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
declare module "react-router/lib/History" {
|
||||||
|
|
||||||
|
export default ReactRouter.History
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
declare module "react-router/lib/Lifecycle" {
|
||||||
|
|
||||||
|
export default ReactRouter.Lifecycle
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
declare module "react-router/lib/RouteContext" {
|
||||||
|
|
||||||
|
export default ReactRouter.RouteContext
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
declare module "react-router/lib/useRoutes" {
|
||||||
|
|
||||||
|
export default ReactRouter.useRoutes
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "react-router/lib/PatternUtils" {
|
||||||
|
|
||||||
|
export function formatPattern(pattern: string, params: {}): string;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "react-router/lib/RouteUtils" {
|
||||||
|
|
||||||
|
type E = __React.ReactElement<any>
|
||||||
|
|
||||||
|
export function isReactChildren(object: E | E[]): boolean
|
||||||
|
|
||||||
|
export function createRouteFromReactElement(element: E): ReactRouter.PlainRoute
|
||||||
|
|
||||||
|
export function createRoutesFromReactChildren(children: E | E[], parentRoute: ReactRouter.PlainRoute): ReactRouter.PlainRoute[]
|
||||||
|
|
||||||
|
export import createRoutes = ReactRouter.createRoutes
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
declare module "react-router/lib/RouterContext" {
|
||||||
|
|
||||||
|
export default ReactRouter.RouterContext
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
declare module "react-router/lib/PropTypes" {
|
||||||
|
|
||||||
|
import React = __React
|
||||||
|
|
||||||
|
export function falsy(props: any, propName: string, componentName: string): Error;
|
||||||
|
|
||||||
|
export const history: React.Requireable<any>
|
||||||
|
|
||||||
|
export const location: React.Requireable<any>
|
||||||
|
|
||||||
|
export const component: React.Requireable<any>
|
||||||
|
|
||||||
|
export const components: React.Requireable<any>
|
||||||
|
|
||||||
|
export const route: React.Requireable<any>
|
||||||
|
|
||||||
|
export const routes: React.Requireable<any>
|
||||||
|
|
||||||
|
export default {
|
||||||
|
falsy,
|
||||||
|
history,
|
||||||
|
location,
|
||||||
|
component,
|
||||||
|
components,
|
||||||
|
route
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "react-router/lib/browserHistory" {
|
||||||
|
export default ReactRouter.browserHistory;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "react-router/lib/hashHistory" {
|
||||||
|
export default ReactRouter.hashHistory;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "react-router/lib/match" {
|
||||||
|
|
||||||
|
export default ReactRouter.match
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
declare module "react-router" {
|
||||||
|
|
||||||
|
import Router from "react-router/lib/Router"
|
||||||
|
|
||||||
|
import Link from "react-router/lib/Link"
|
||||||
|
|
||||||
|
import IndexLink from "react-router/lib/IndexLink"
|
||||||
|
|
||||||
|
import IndexRedirect from "react-router/lib/IndexRedirect"
|
||||||
|
|
||||||
|
import IndexRoute from "react-router/lib/IndexRoute"
|
||||||
|
|
||||||
|
import Redirect from "react-router/lib/Redirect"
|
||||||
|
|
||||||
|
import Route from "react-router/lib/Route"
|
||||||
|
|
||||||
|
import History from "react-router/lib/History"
|
||||||
|
|
||||||
|
import Lifecycle from "react-router/lib/Lifecycle"
|
||||||
|
|
||||||
|
import RouteContext from "react-router/lib/RouteContext"
|
||||||
|
|
||||||
|
import browserHistory from "react-router/lib/browserHistory"
|
||||||
|
|
||||||
|
import hashHistory from "react-router/lib/hashHistory"
|
||||||
|
|
||||||
|
import useRoutes from "react-router/lib/useRoutes"
|
||||||
|
|
||||||
|
import { createRoutes } from "react-router/lib/RouteUtils"
|
||||||
|
|
||||||
|
import { formatPattern } from "react-router/lib/PatternUtils"
|
||||||
|
|
||||||
|
import RouterContext from "react-router/lib/RouterContext"
|
||||||
|
|
||||||
|
import PropTypes from "react-router/lib/PropTypes"
|
||||||
|
|
||||||
|
import match from "react-router/lib/match"
|
||||||
|
|
||||||
|
// PlainRoute is defined in the API documented at:
|
||||||
|
// https://github.com/rackt/react-router/blob/master/docs/API.md
|
||||||
|
// but not included in any of the .../lib modules above.
|
||||||
|
export type PlainRoute = ReactRouter.PlainRoute
|
||||||
|
|
||||||
|
// The following definitions are also very useful to export
|
||||||
|
// because by using these types lots of potential type errors
|
||||||
|
// can be exposed:
|
||||||
|
export type EnterHook = ReactRouter.EnterHook
|
||||||
|
export type LeaveHook = ReactRouter.LeaveHook
|
||||||
|
export type ParseQueryString = ReactRouter.ParseQueryString
|
||||||
|
export type RedirectFunction = ReactRouter.RedirectFunction
|
||||||
|
export type RouteComponentProps<P,R> = ReactRouter.RouteComponentProps<P,R>;
|
||||||
|
export type RouteHook = ReactRouter.RouteHook
|
||||||
|
export type StringifyQuery = ReactRouter.StringifyQuery
|
||||||
|
export type RouterListener = ReactRouter.RouterListener
|
||||||
|
export type RouterState = ReactRouter.RouterState
|
||||||
|
export type HistoryBase = ReactRouter.HistoryBase
|
||||||
|
|
||||||
|
export {
|
||||||
|
Router,
|
||||||
|
Link,
|
||||||
|
IndexLink,
|
||||||
|
IndexRedirect,
|
||||||
|
IndexRoute,
|
||||||
|
Redirect,
|
||||||
|
Route,
|
||||||
|
History,
|
||||||
|
browserHistory,
|
||||||
|
hashHistory,
|
||||||
|
Lifecycle,
|
||||||
|
RouteContext,
|
||||||
|
useRoutes,
|
||||||
|
createRoutes,
|
||||||
|
formatPattern,
|
||||||
|
RouterContext,
|
||||||
|
PropTypes,
|
||||||
|
match
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Router
|
||||||
|
|
||||||
|
}
|
||||||
66
templates/ReactSpa/typings/react/react-dom.d.ts
vendored
Normal file
66
templates/ReactSpa/typings/react/react-dom.d.ts
vendored
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
// Type definitions for React v0.14 (react-dom)
|
||||||
|
// Project: http://facebook.github.io/react/
|
||||||
|
// Definitions by: Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>
|
||||||
|
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||||
|
|
||||||
|
/// <reference path="react.d.ts" />
|
||||||
|
|
||||||
|
declare namespace __React {
|
||||||
|
namespace __DOM {
|
||||||
|
function findDOMNode<E extends Element>(instance: ReactInstance): E;
|
||||||
|
function findDOMNode(instance: ReactInstance): Element;
|
||||||
|
|
||||||
|
function render<P>(
|
||||||
|
element: DOMElement<P>,
|
||||||
|
container: Element,
|
||||||
|
callback?: (element: Element) => any): Element;
|
||||||
|
function render<P, S>(
|
||||||
|
element: ClassicElement<P>,
|
||||||
|
container: Element,
|
||||||
|
callback?: (component: ClassicComponent<P, S>) => any): ClassicComponent<P, S>;
|
||||||
|
function render<P, S>(
|
||||||
|
element: ReactElement<P>,
|
||||||
|
container: Element,
|
||||||
|
callback?: (component: Component<P, S>) => any): Component<P, S>;
|
||||||
|
|
||||||
|
function unmountComponentAtNode(container: Element): boolean;
|
||||||
|
|
||||||
|
var version: string;
|
||||||
|
|
||||||
|
function unstable_batchedUpdates<A, B>(callback: (a: A, b: B) => any, a: A, b: B): void;
|
||||||
|
function unstable_batchedUpdates<A>(callback: (a: A) => any, a: A): void;
|
||||||
|
function unstable_batchedUpdates(callback: () => any): void;
|
||||||
|
|
||||||
|
function unstable_renderSubtreeIntoContainer<P>(
|
||||||
|
parentComponent: Component<any, any>,
|
||||||
|
nextElement: DOMElement<P>,
|
||||||
|
container: Element,
|
||||||
|
callback?: (element: Element) => any): Element;
|
||||||
|
function unstable_renderSubtreeIntoContainer<P, S>(
|
||||||
|
parentComponent: Component<any, any>,
|
||||||
|
nextElement: ClassicElement<P>,
|
||||||
|
container: Element,
|
||||||
|
callback?: (component: ClassicComponent<P, S>) => any): ClassicComponent<P, S>;
|
||||||
|
function unstable_renderSubtreeIntoContainer<P, S>(
|
||||||
|
parentComponent: Component<any, any>,
|
||||||
|
nextElement: ReactElement<P>,
|
||||||
|
container: Element,
|
||||||
|
callback?: (component: Component<P, S>) => any): Component<P, S>;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace __DOMServer {
|
||||||
|
function renderToString(element: ReactElement<any>): string;
|
||||||
|
function renderToStaticMarkup(element: ReactElement<any>): string;
|
||||||
|
var version: string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "react-dom" {
|
||||||
|
import DOM = __React.__DOM;
|
||||||
|
export = DOM;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "react-dom/server" {
|
||||||
|
import DOMServer = __React.__DOMServer;
|
||||||
|
export = DOMServer;
|
||||||
|
}
|
||||||
2281
templates/ReactSpa/typings/react/react.d.ts
vendored
Normal file
2281
templates/ReactSpa/typings/react/react.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
5
templates/ReactSpa/typings/tsd.d.ts
vendored
Normal file
5
templates/ReactSpa/typings/tsd.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
|
||||||
|
/// <reference path="react/react.d.ts" />
|
||||||
|
/// <reference path="react-router/history.d.ts" />
|
||||||
|
/// <reference path="react-router/react-router.d.ts" />
|
||||||
|
/// <reference path="react/react-dom.d.ts" />
|
||||||
8
templates/ReactSpa/webpack.config.dev.js
Normal file
8
templates/ReactSpa/webpack.config.dev.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
module.exports = {
|
||||||
|
devtool: 'inline-source-map',
|
||||||
|
module: {
|
||||||
|
loaders: [
|
||||||
|
{ test: /\.css/, loader: 'style!css' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
33
templates/ReactSpa/webpack.config.js
Normal file
33
templates/ReactSpa/webpack.config.js
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
var path = require('path');
|
||||||
|
var webpack = require('webpack');
|
||||||
|
var merge = require('extendify')({ isDeep: true, arrays: 'concat' });
|
||||||
|
var devConfig = require('./webpack.config.dev');
|
||||||
|
var prodConfig = require('./webpack.config.prod');
|
||||||
|
var isDevelopment = process.env.ASPNET_ENV === 'Development';
|
||||||
|
|
||||||
|
module.exports = merge({
|
||||||
|
resolve: {
|
||||||
|
extensions: [ '', '.js', '.jsx', '.ts', '.tsx' ]
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
loaders: [
|
||||||
|
{ test: /\.ts(x?)$/, include: /ClientApp/, loader: 'babel-loader' },
|
||||||
|
{ test: /\.ts(x?)$/, include: /ClientApp/, loader: 'ts-loader' },
|
||||||
|
{ test: /\.(png|woff|woff2|eot|ttf|svg)$/, loader: 'url-loader?limit=100000' }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
entry: {
|
||||||
|
main: ['./ClientApp/boot.tsx'],
|
||||||
|
vendor: ['bootstrap', 'bootstrap/dist/css/bootstrap.css', 'style-loader', 'jquery']
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
path: path.join(__dirname, 'wwwroot', 'dist'),
|
||||||
|
filename: '[name].js',
|
||||||
|
publicPath: '/dist/'
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new webpack.ProvidePlugin({ $: 'jquery', jQuery: 'jquery' }), // Maps these identifiers to the jQuery package (because Bootstrap expects it to be a global variable)
|
||||||
|
new webpack.optimize.OccurenceOrderPlugin(),
|
||||||
|
new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.js') // Moves vendor content out of other bundles
|
||||||
|
]
|
||||||
|
}, isDevelopment ? devConfig : prodConfig);
|
||||||
15
templates/ReactSpa/webpack.config.prod.js
Normal file
15
templates/ReactSpa/webpack.config.prod.js
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
var webpack = require('webpack');
|
||||||
|
var ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||||
|
var extractCSS = new ExtractTextPlugin('site.css');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
module: {
|
||||||
|
loaders: [
|
||||||
|
{ test: /\.css/, loader: extractCSS.extract(['css']) },
|
||||||
|
]
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
extractCSS,
|
||||||
|
new webpack.optimize.UglifyJsPlugin({ minimize: true })
|
||||||
|
]
|
||||||
|
};
|
||||||
BIN
templates/ReactSpa/wwwroot/favicon.ico
Executable file
BIN
templates/ReactSpa/wwwroot/favicon.ico
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 31 KiB |
BIN
templates/ReactSpa/wwwroot/images/ASP-NET-Banners-01.png
Executable file
BIN
templates/ReactSpa/wwwroot/images/ASP-NET-Banners-01.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 8.1 KiB |
BIN
templates/ReactSpa/wwwroot/images/ASP-NET-Banners-02.png
Executable file
BIN
templates/ReactSpa/wwwroot/images/ASP-NET-Banners-02.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 8.4 KiB |
BIN
templates/ReactSpa/wwwroot/images/Banner-01-Azure.png
Executable file
BIN
templates/ReactSpa/wwwroot/images/Banner-01-Azure.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
BIN
templates/ReactSpa/wwwroot/images/Banner-02-VS.png
Executable file
BIN
templates/ReactSpa/wwwroot/images/Banner-02-VS.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
9
templates/ReactSpa/wwwroot/web.config
Normal file
9
templates/ReactSpa/wwwroot/web.config
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<system.webServer>
|
||||||
|
<handlers>
|
||||||
|
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
|
||||||
|
</handlers>
|
||||||
|
<httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" stdoutLogEnabled="false"/>
|
||||||
|
</system.webServer>
|
||||||
|
</configuration>
|
||||||
Reference in New Issue
Block a user