Commit Graph

50 Commits

Author SHA1 Message Date
Steve Sanderson 0e9d52fe11 Support components and static content in external NuGet packages (#247)
* On build, drop <BlazorPackageContentFiles> items into dist\_content\(PackageName)\

* Add <script> and <link> tags to generated index.html

* Add testapp coverage of external content package. Still need to add E2E tests that uses it.

* Add missing unit test update

* Add example of packaging an entire Blazor component including CSS and images

* Add E2E test for component from NuGet package
2018-03-14 11:23:43 +00:00
Ryan Nowak 9549dccc54 Add @page directive
Adds the @page directive and support for specifying routes in components
at compile time.

For now the route is required and must begin with a leading /.
2018-03-14 11:23:43 +00:00
Javier Calvarro Nelson 700c2203c6 [Fixes #66] Adds linking support to the build
* Switch the tasks used to generate the blazor output to be MSBuild based.
* Package the optimized mono runtime and the BCL inside a nuget package.
* Add opt-in support for linking the application on build.
* Make the whole build process incremental.
2018-03-14 11:23:43 +00:00
Ryan Nowak ffadeecb45 Remove old <c:Foo> syntax 2018-03-14 11:23:42 +00:00
Ryan Nowak d175b4d38a Konvert to KoreBuild 2018-03-14 11:23:42 +00:00
Ryan Nowak 0c162e8c5a Allow non-property attributes to be set
This removes a limitation that prevented callers from passing
attributes to a component that aren't backed by properties.

The majority of the complication here is required to deal with the more
sophisticated way that HTML attributes are represented in the Razor IR.
2018-03-14 11:23:42 +00:00
Ryan Nowak c05657c7f2 Add support general delegate types
This builds upon existing support for UIEventHandler-typed component
properties and applies the same principle to any delegate type.

We try to help by generating the LSH of the lambda `=>` allowing you to
write `OnClick="Foo()"` rather than `OnClick="(e) => Foo()"`. You can of
course use @ as an escape.

The only rough edge here is that if the parameter names aren't memorable
for the delgate type, it's not super helpful.
2018-03-14 11:23:42 +00:00
Ryan Nowak 601e7914f7 Implement components as tag helpers
Implements Component code generation and tooling support end to end
udditionally adds some default `@addTagHelper` directives to make
programming in Blazor a little nicer.

Components are discovered as Tag Helpers using Razor's extensibility
during the build/IDE process. This drives the code generation during
build and lights up a bunch of editor features.

Add
2018-03-14 11:23:41 +00:00
Ryan Nowak 211561a6a6 Implement 2-phase compilation
This is a working (all tests passing) implementation of the two-phase
compilation system we will need for component discovery.

This builds on top of work we've doing in Razor, including the Razor
SDK, MSBuild tasks, and CLI/server.

This currently *does* discovery components during the build process, but
it doesn't use that data for anything yet.

It works like this:
1. Generate class declarations (structure only, no method bodies)
2. Compile a 'temp' assembly using the .cs files and output of 1.
3. Do component discovery using the 'temp' assembly
4. Generate class definitions (including method bodies)
5. Compile the 'real' assembly using the .cs files and output of 4.
2018-03-14 11:23:40 +00:00
Ryan Nowak 6182e8448d Get rid of RazorCompiler
Adds a little more use of Razor extensibility.

Razor is a plugin model, so we can't be the 'first mover' for initiating
compilation in the build tools and IDE.

Reorganizes tests and fills out more reusable test infrastructure for
Razor-driven testing.

Adds tests for declaration-only configuration.
2018-03-14 11:23:40 +00:00
Ryan Nowak a053155ab4 Implement layout and implements with directives
- Remove haxxxx
- Add proper directives with tooling support
2018-03-14 11:23:40 +00:00
Steve Sanderson 61e07eb615 Support @bind for enum and DateTime values (with optional format string) 2018-03-05 02:02:26 +00:00
Steve Sanderson 4bd3cd98d6 Simplify apps by moving some commonly used types into Microsoft.AspNetCore.Blazor namespace 2018-02-28 11:29:14 +00:00
Steve Sanderson 3e5381c17e Rename .DevHost project to .Cli, and make it work as a DotNetCliTool 2018-02-27 12:17:35 +00:00
Steve Sanderson 6995b974e9 Support @bind for textboxes and checkboxes 2018-02-26 14:39:56 +00:00
Steve Sanderson c408045e31 In RazorCompiler, support @inject directive 2018-02-23 09:32:26 +00:00
Steve Sanderson ce10e6fa19 In preparation for DI, give every Renderer an IServiceProvider 2018-02-23 09:32:26 +00:00
Steve Sanderson 08d7b77d38 Avoid component syntax confusion by making it a compile-time error. Fixes #145 2018-02-22 11:07:03 +00:00
Steve Sanderson 1a31634b70 Capture component child content as a RenderFragment parameter. 2018-02-22 11:07:03 +00:00
Steve Sanderson bd455453d6 Report line/column when reporting mismatching tags 2018-02-22 11:07:03 +00:00
Steve Sanderson 0665d30e19 In RazorCompiler, reject malformed documents with mismatching tags 2018-02-22 11:07:03 +00:00
Steve Sanderson 95023c0300 In RazorCompiler, support components with children 2018-02-22 11:07:03 +00:00
Steve Sanderson 87fc15cc23 Add test to demonstrate current component attribute parsing inconsistencies 2018-02-21 10:22:03 +00:00
Steve Sanderson 78a19c07e9 In RazorCompiler, allow HTML comments 2018-02-21 10:22:03 +00:00
Steve Sanderson 58af3e1638 Allow blazor-boot script to be served from apps not hosted at domain root 2018-02-21 10:22:03 +00:00
Steve Sanderson 608da4c78b Specifying entrypoint: Add tests and other stylistic tweaks 2018-02-19 14:22:03 +00:00
Eugene Bekker 1653e56b98 Adding ability to qualify the entry point of the main assembly 2018-02-19 14:11:25 +00:00
Steve Sanderson 1e0836167d Make temporary "layout" and "implements" syntax work with _ViewImports hierarchies 2018-02-19 12:48:08 +00:00
Steve Sanderson f649de2976 Support _ViewImports.cshtml files hierarchically 2018-02-18 23:57:20 +00:00
Steve Sanderson be1400663b Unit test to show the Razor compiler passes through any C# compilation errors 2018-02-18 23:54:12 +00:00
Steve Sanderson 782ca0137d Support "@inherits ..." directive 2018-02-18 22:03:15 +00:00
Steve Sanderson df825de86d Reorganise some test helpers in shared locations 2018-02-16 17:23:04 +00:00
Steve Sanderson f54df27c21 Define ILayoutComponent so there's compile-time validation that layouts are defined correctly 2018-02-16 15:04:51 +00:00
Steve Sanderson 7139cb70c5 Support temporary @(Implements<MyInterfaceType>()) syntax 2018-02-16 12:39:38 +00:00
Steve Sanderson 9e333e31c5 Support temporary @(Layout<MyLayoutType>()) syntax 2018-02-16 12:10:44 +00:00
Steve Sanderson 2ebfddc237 Switch client apps to netstandard2.0 to fix type load errors
Do a "git clean -xdf" on your local copy if you get runtime errors after
updating to this.
2018-02-15 10:20:31 +00:00
Steve Sanderson 94261ded25 Fix RazorCompilerTest on Mac/Linux 2018-02-14 13:08:39 +00:00
Steve Sanderson 0eb0555303 Eliminate IComponent.BuildRenderTree to guarantee that components are only rendered by themselves 2018-02-13 19:47:37 +00:00
Steve Sanderson e061b98f9d In RazorCompilerTest, don't use BuildRenderTree directly (because it will soon be removed) 2018-02-13 17:18:06 +00:00
Steve Sanderson 861154764c Introduce IComponent.SetParameters, moving parameter-setting and rerendering logic into component base class 2018-02-13 15:00:53 +00:00
Steve Sanderson 695ddc0fd6 Add Init/RenderHandle concepts so components can rerender themselves arbitrarily (e.g., after internal state change) 2018-02-13 11:49:33 +00:00
Steve Sanderson 7bb4bbbe5c In IndexHtmlFileProvider, preserve original source formatting 2018-02-12 23:05:47 +00:00
Eugene Bekker b38718d77f Require <script type="blazor-boot"> to define script injection location 2018-02-12 21:49:27 +00:00
Steve Sanderson 5a9c41af0e Make AngleSharp not strong-named. Change assembly name to Microsoft.AspNetCore.Blazor.AngleSharp to ensure no conflicts with other usages. 2018-02-09 17:37:21 +00:00
Steve Sanderson 33932f41fc Replace "DescendantsEndIndex" concept with "SubtreeLength"
In other words, use relative addressing so that frame data is
independent of its position in the array
2018-02-07 10:27:32 +00:00
Steve Sanderson f1332919bc Rename RenderTreeNode -> RenderTreeFrame (and correspondingly, "node" ->
"frame" everywhere)
2018-02-04 22:21:29 +00:00
Steve Sanderson 1c9c74c801 In RazorCompiler, fix bug about attribute nodes having wrong sequence
numbers. Make tests explicit about sequence numbers.
2018-01-31 10:23:56 +00:00
Steve Sanderson 080e6395cb Move to batched rendering 2018-01-29 20:16:42 +00:00
Steve Sanderson 1b4fa4781a Give attribute nodes a single object-valued value so they can be used for component properties too. 2018-01-26 09:40:48 -08:00
Steve Sanderson 0aa164073d Rename Microsoft.Blazor.* -> Microsoft.AspNetCore.Blazor.* everywhere 2018-01-24 15:48:38 -08:00