Commit Graph

716 Commits

Author SHA1 Message Date
Steve Sanderson 6ff3674b16 Refactor server-side blazor startup to allow Azure SignalR. Fixes #1227 (#1396)
* Move startup action config into AddServerSideBlazor, so that UseServerSideBlazor is reduced to trivial shorthand that can become optional

* Make BlazorHub public so developers can use it with UseAzureSignalR

* Move BlazorHub to Microsoft.AspNetCore.Blazor.Server namespace for easier consumption

* Add notes

* Have E2E tests validate that devs don't have to call UseServerSideBlazor

* Add forgotten tweak

* CR: Document that BlazorHub methods are not intended for application use.

* CR: Rename extension method to UseSignalRWithBlazorHub

* CR: TryAdd
2018-09-11 09:55:27 +01:00
Ryan Nowak d4cbb86f46 Add Support for Templated Components (#1404)
* Test namespace cleanup

* Add recognication for RenderFragment in tag helpers

* Remove dead code from node writers

* refactor type check

* Continue to treat child content as a delegate in codegen

* Add extension to enumerate child content

* Reorganize code generation tests

These were growing a bit disorganized, and weren't really result in good
code reuse.

* fix test base class

* Add some child-content tests

* Add an explicit node for ChildContent

Adds a strongly typed node to represent a 'ChildContent' and what it
contains. This allows us to simplify the code generation path,
detect/processes more issues in IR passes, and will be essential for
supporting multiple child content.

* Ignore ChildContent in components when it's just whitespace

* Add diagnostic for duplicate child content

* Add support for explicit child content elements

Precursor to support for multiple child content items

* Add support for multiple child-content elements

* Change delegate signature for RenderFragment<T>

* Clean up Tag Helper constants

* Allow RenderFragment<T> as a child content

* Allow renaming the template parameter

* Improve error message for invalid child content

* Add diagnostic for repeated child content parameter names
2018-09-10 18:59:51 -07:00
Andrii Kurdiumov 6546c55f4c Removal of global.json from the template
I remove only global.json from the template, and leave global.json in the repository root, since it is required for the build.
See #1324
2018-09-07 12:44:52 +01:00
Ryan Nowak 953479ce21 Fix path to our templates 2018-09-05 14:00:35 -07:00
Steve Sanderson facc1e466e Pre-trim Mono BCL (#1382)
* Add "ilwipe" build command

* Perform BCL wipe as part of build

* Simplify by converting ilwipe command to process entire directories

* Clean up the build
2018-09-05 10:03:54 +01:00
Steve Sanderson b004ffdc24 Set BrowserHttpMessageHandler as the default handler when running on Mono WebAssembly 2018-09-03 17:47:05 +01:00
Steve Sanderson 03ff6ca022 Update jsinterop to version that supports Mono bfc35fc6e65 2018-09-03 17:47:05 +01:00
Steve Sanderson 38b45d82c7 Update linker config following update to Mono bfc35fc6e65 2018-09-03 17:47:05 +01:00
Steve Sanderson 0aa7f13008 Update Mono to bfc35fc6e65 - have not yet rebuilt binaries 2018-09-03 17:47:05 +01:00
cores-system 223a2fed97 Don't intercept clicks for links that open in external frames #1352 (#1354) 2018-09-03 10:31:37 +01:00
Ryan Nowak c97cb8c18b Add support for Razor templates
Adds support for Razor templates and RenderFragment<T>.

Razor templates are a little-known Razor feature that looks like:
```
@<tag>....<tag>
```

It's so little known that it's not even covered in our docs, but it's
been around for many many years. This features hasn't been implemented
until now for Blazor, and this feature brings it back as a build
building block for templated components (more to come).

In Blazor land a template like:
```
@{ RenderFragment<Person> template = @<div>@item.Name</div>; }
```

complies to code like:
```
RenderFragment<Person> template = (__builder, item) =>
{
    __builder.OpenElement(...);
    ...
    __builder.CloseElement(...);
}
```

Since the declaration always has a generic type parameter inside, it
needs to be in a context where the type is known.. ie: not with `var`.

See tests for ways to consume templates.

NOTE: There are the following caveats for templates
- Templates require a single root element.
- Templates don't work in the `@functions { }` block

These limitations are baked into the core of Razor and will take a while
for us to address (v3.0).
2018-08-31 19:10:42 -07:00
Steve Sanderson 2fb5bfb136 Update to latest jsinterop 2018-08-30 08:47:32 +01:00
Nate McMaster 07f524f998 Run compliance checks on official builds (#1357) 2018-08-29 08:29:02 -07:00
Chris Ray 2eaa17f561 include credentials when fetching blazor.boot.json to enable windows auth (#1200) 2018-08-29 11:11:27 +01:00
Steve Sanderson cf59ed94ad Consume jsinterop from submodule (#1351)
* Remove JSInterop files from this repo

* Add jsinterop submodule

* In Blazor.sln, reference jsinterop projects from submodule

* Update other references to jsinterop

* Fix TypeScript warning

* Include submodules in test/pack

* Update to newer jsinterop to fix JS pack issue

* Update to newer jsinterop to obtain strong naming

* Allow jsinterop submodule to inherit Directory.Build.props/targets

* Get latest jsinterop

* For AppVeyor builds, restore git submodules (happens automatically elsewhere)

* Update README.md with instructions to restore submodules
2018-08-29 11:10:35 +01:00
Steve Sanderson 520d47316f Increase default WaitAssert timeout to 2 seconds 2018-08-23 11:58:46 +01:00
Ryan Nowak 3370113a05 Move ITagHelper to another assembly 2018-08-22 17:46:48 -07:00
Ryan Nowak 692bb0e261 Add privateassets=all to Blazor.Build usages
We recommend using this package with PrivateAssets=all everywhere to
make sure that the MSBuild files brought in by this package aren't
applied to transitively.

When that happens, the Blazor.Build MSBuild files will take over the
Razor functionality for other projects, which breaks MVC's view
compilation functionality.

This is part of a fix for #1216.
2018-08-22 08:21:46 -07:00
Steve Sanderson 13cf5bd583 Add Blazor.onServerConnectionClose to fix #1339
This API will be removed once we implement proper connection management (reconnects, etc.)
2018-08-22 15:18:23 +01:00
Steve Sanderson 1089eecbfc In RenderBatchWriter, deduplicate strings only when safe to do so (#1340)
We allow deduplication of HTML element and attribute names, plus whitespace text nodes / attribute values.
2018-08-22 14:52:35 +01:00
Nate McMaster 3a2606a636 Strong name Blazor assemblies (#1344) 2018-08-21 15:37:05 -07:00
Steve Sanderson 52813ddf63 Eliminate temporary MemoryStream buffers used during RenderBatch serialization (#1329)
* Eliminate temporary MemoryStream buffers used during RenderBatch serialization. Fixes #1132

* CR: Fix namespace
2018-08-21 14:08:39 +01:00
Daniel Roth 7a763fc4f6 Scan only declared methods for JS interop (#1320)
* Scan only declared methods for JS interop

* Add DotNetDispatcher test for JS invokable method on base class
2018-08-17 12:35:24 +01:00
Steve Sanderson 04427d2e28 Fix publishing following recent build changes (now that $(OutDir) is relative) 2018-08-15 13:55:54 +01:00
Steve Sanderson d3bc28de55 E2E benchmarks (#1307) 2018-08-14 13:21:19 +01:00
Ryan Nowak fd5426943f Merge sibling nodes during markup block rewrite
This change adds the ability to merge sibling nodes when possible during
markup block rewriting. We retain that invariant that each markup block
is a valid chunk of markup containing properly nested tags.

We still haven't done any work to remove whitespace yet, so most of the
cases where this comes into play right now will merge an element with
its surrounding whitespace.
2018-08-13 11:17:11 -07:00
Ryan Nowak 277e1b4702 Install ASP.NET Core runtime (#1291)
This will make sure the build script includes the ASP.NET Core runtime
when running on local .NET. The effect of this is that our test projects
and apps will 'roll forward' unto the newest runtime without us
hardcoding it.

We can't yet rely on 2.1.3 -  but we can just bump up a version number when it's available.
2018-08-10 20:35:28 -07:00
Ryan Nowak a05cb42845 Reenable markup blocks (#1286)
* Reenable HtmlBlock unit tests

* Add E2E tests for HTML Block cases

* Remove harded GenerateBaselines=true

* Fix #1193

This commit addresses the root cause of #1193. When we merge HTML
text nodes into HTML blocks we need to re-encode any HTML entities that
were encoded eariler.

I did a bit of a deep dive on how HTML encoding is handled in Blazor and
I think this is the best strategy. I think it's valuable that the
BrowserRenderer uses document.createTextNode, which will always encode
the text - this handles dynamic content. We want to keep this in place
to avoid HTML injection attacks.

* Fix #1265 Reenable MarkupBlock

* test cleanup
2018-08-10 16:29:39 -07:00
Steve Sanderson 70a4bf7521 E2E test async robustness tweaks following recent failures 2018-08-09 10:27:40 +01:00
uazo 7d92c07fba fix HtmlBlock codegen (#1209) 2018-08-08 17:46:37 -07:00
Nate McMaster 78045b2177 Automate authenticode code-signing using Roslyn sign tool
* Change project layout to prepare for upcoming Arcade changes
* Add signtool config file to configure OPC, NuGet, and Authenticode signing
* Fix a bug when BaseIntermediateOutputPath is set to an absolute path
2018-08-08 08:52:46 -07:00
Ryouko Konpaku e5ea2526b1 Fix for builds when the assembly has spaces on it's name. 2018-08-08 13:02:21 +01:00
Nate McMaster 22a3fbf861 Use $(TargetDir) instead of $(ProjectDir)$(OutputPath) 2018-08-06 16:48:36 -07:00
Nate McMaster 9672c2cff1 Fix for CI building as 15.7.999999 on VSTS (#1256) 2018-08-06 13:53:06 -07:00
Nate McMaster 7c43ed9cdb Add VSTS build configuration 2018-08-03 15:31:02 -07:00
Nate McMaster 4651d92eed Update KoreBuild and bootstrappers 2018-08-03 15:12:20 -07:00
Steve Sanderson 16d005e00c Fix returning arrays in async JS interop calls. Fixes #1205 2018-07-27 10:11:45 -07:00
Steve Sanderson 4b861929be Temporarily disable HtmlBlockPass for 0.5.1. Will be re-enabled later. 2018-07-27 10:11:31 -07:00
Steve Sanderson 26aa6e838f Auto-remove the AspNetCorePackageVersion attribute from templates 2018-07-25 12:43:40 -07:00
Steve Sanderson a46dd91fd4 Fix server-side template custom restore sources condition 2018-07-25 11:24:07 -07:00
Steve Sanderson 4e892e74da Fix handling nonvoid elements in markup blocks (#1190)
* Fix empty nonvoid elements in markup blocks. Fixes #1186

* Also update another test
2018-07-25 09:53:52 -07:00
Steve Sanderson 0f8fdad593 Further 0.5.0 tweaks (#1191)
* Clarify debug instructions further

* Fix error message

* Add "using Microsoft.JSInterop" in templates

* Clarify template descriptions
2018-07-25 09:33:12 -07:00
Steve Sanderson b5ff6db1d4 Fixes for 0.5.0 (#1183)
* Fix macOS debug launch instructions

* Remove license headers from template files
2018-07-24 16:51:00 -07:00
Steve Sanderson 1236b77dfc Server template tweaks (#1181)
* Add server template projects to Blazor.sln

* Disable linking for server execution

* Minor tweaks to Startup.cs
2018-07-24 12:00:07 -07:00
Steve Sanderson 6929b8c21a Update AssemblyInfo version ranges to allow 0.6.0-* 2018-07-24 08:26:25 -07:00
Steve Sanderson 188f6d0b42 Update version to 0.6.0-preview1-* 2018-07-24 08:17:28 -07:00
Steve Sanderson 4aaeac1e51 preventDefault for form onsubmit handlers. Fixes #951 2018-07-24 08:11:02 -07:00
Daniel Roth 79c60c91af Fixup default value for TemplateBlazorPackageVersion in server-side template 2018-07-23 23:26:20 -07:00
Daniel Roth 214598e579 Update survey link for 0.5.0 2018-07-23 22:11:00 -07:00
Ryan Nowak 65d9499e57 Template updates for 0.5 (#1177)
* Add startup pattern for client-side templates

* Add Server Side Blazor template

* minor feedback

* rename project
2018-07-23 21:54:50 -07:00