Commit Graph

768 Commits

Author SHA1 Message Date
Steve Sanderson 811ef19f57 In E2E tests, allow for slower execution on Travis/AppVeyor 2018-11-13 12:00:24 +00:00
Steve Sanderson dc1ad1943d Capture RenderBatch bytes synchronously. Fixes #1223 2018-11-13 11:34:02 +00:00
Adrian Wright 5e0aa0c0fa Fix typos 2018-11-09 10:17:10 -08:00
Jeremy Hutchinson 1661d38971 Return completed task rather than null for empty virtual async methods. 2018-11-09 10:06:20 -08:00
Suchiman 5c13452d96 Add repository in nuspec files 2018-11-09 10:03:51 -08:00
Steve Sanderson 8e4691170a Update README.md to remove outdated asm.js references 2018-11-09 09:22:38 +00:00
Steve Sanderson 5a836ef0a6 Update to ws-proxy code matching Mono repo 5e318afd 2018-11-07 12:01:50 +00:00
Steve Sanderson edff13f25a Add new System.Buffers.dll BCL assembly to SignToolData.json exclusion list 2018-11-07 12:01:50 +00:00
Steve Sanderson 080399da3d Update MonoPlatform startup code to match newer Mono 2018-11-07 12:01:50 +00:00
Steve Sanderson 0857483a42 Use prebuilt Mono binaries. Remove asm.js fallback (Mono doesn't distribute asm.js builds). 2018-11-07 12:01:50 +00:00
Steve Sanderson 54f78ca34d Fix build when repo path contains space. Fixes #1541 2018-11-07 11:54:24 +00:00
Steve Sanderson f0638877fa Rename "Fixed" to "IsFixed" 2018-10-18 09:57:41 +01:00
Steve Sanderson 7530ad9a26 E2E tests for cascading parameters generally 2018-10-18 09:57:41 +01:00
Steve Sanderson 18df30568c Support "Fixed" mode for <CascadingValue> 2018-10-18 09:57:41 +01:00
Steve Sanderson 4a6f471d12 Add Cascading flag to Parameter (#1564)
... so that components that pass through an arbitrary set of parameters can choose to filter out cascading ones if they want.
2018-10-18 09:37:46 +01:00
Meir Blachman dd807a6d70 using Microsoft.Extensions.CommandLineUtils for blazor-cli 2018-10-17 22:33:03 -07:00
Lukas Bickel fb6427a46a escape quotes in event handler attribute content 2018-10-17 14:18:22 -07:00
Steve Sanderson efbf2c5678 When tracing dependencies *without* linking, don't fail the build if there are unresolved dependencies
There are legitimate use cases for referencing BCL assemblies that *aren't* in the Mono WebAssembly BCL, particularly for Blazor-on-the-server which runs on CoreCLR (and hence supports a broader BCL) anyway.
2018-10-16 23:57:40 +01:00
Zou Wei 7918fe2c39 Update README.md
Add links to the docs.
2018-10-15 13:12:56 +01:00
Steve Sanderson 211ad636fd Cascading parameters (#1545)
* Add Provider component

* Implement discovery and matching rules for tree parameters

* Remove artificial component hierarchy unit tests now they are redundant

* Refactor: Have RenderTreeFrame point to the ComponentState instead of IComponent

... so we can more quickly find associated tree param state without having to do lookups based on the componentId.

Also rename AssignComponentId to AttachAndInitComponent to be more descriptive.

* Refactor: Add shared code path for updating parameters so there's only one place to attach tree parameters

Now framework code should no longer call IComponent.SetParameters directly, except if it knows it's definitely dealing with a root component.

* Refactor: Simplify Parameter by making it hold the name/value directly

This will be necessary for tree parameters, which don't correspond to any RenderTreeFrame

* Refactor: Wrap ParameterEnumerator logic in extra level of iterator so we can also add one for iterating tree params

* Extend ParameterEnumerator to list tree parameters too

* Include tree parameters in SetParameters calls

* Refactor: Move parameter change detection logic into separate utility class

... so we include https://github.com/dotnet/jsinterop/pull/3

* Refactor: Move tree parameter tests from RendererTest.cs their own file

* Have Provider re-render consumers when value changes. Unit tests in next
commit.

* Components that accept tree parameters need to snapshot their direct params for later replay

* Empty commit to reawaken CI

* CR: Make name matching case-insensitive

* Refactor: Rename Provider/TreeParameter to
CascadingValue/CascadingParameter

* Add dedicated [CascadingParameter] attribute. Remove FromTree flag.

* CR: CascadingParameterState cleanups

* CR: Extra unit test

* CR: arguments/parameters

* CR: Enumerator improvements

* Fix test
2018-10-15 11:11:46 +01:00
Steve Sanderson fa2b61773a In ComponentState, track parent ComponentState. Be explicit that Renderer only lets you attach root components. 2018-10-12 09:49:28 +01:00
Steve Sanderson c05b98f9cb Update to latest JSInterop
... so we include https://github.com/dotnet/jsinterop/pull/3
2018-10-10 09:54:27 +01:00
Steve Sanderson 7012ea9d03 Avoid OnAfterRender allocating to capture 'this' 2018-10-08 09:39:18 +01:00
alenros d414ed107f updated MSRC link 2018-10-05 14:46:52 +01:00
simpman4 88cd4573a6 Added a "." to the end of ln. 41 2018-10-05 14:45:48 +01:00
Daniel Roth 04b87ef066 Update Microsoft.AspNetCore.Blazor.Templates.nuspec 2018-10-02 16:59:47 +01:00
Ryan Nowak 737a6003f5 Add required fields to build nuspec 2018-10-02 10:39:21 +01:00
Nate McMaster f6b64e5d26 Upgrade KoreBuild (#1498)
* remove sources.props and use NuGet.config. Source.props is only necessary for products that bulid in ProdCon, which Blazor does not
* Remove code signing glue code. This is part of KoreBuild now
* Update SDK to 2.1.400
* Update certificate names used for code-signing to use SHA2
2018-10-01 11:13:09 -07:00
Steve Sanderson 234f089a0a Always use forward-slashes in template primaryOutputs. Fixes #1497. 2018-10-01 13:17:11 +01:00
Steve Sanderson 0ca361a78a Make HttpClientHandler wiping more conservative. Fixes #1484 2018-10-01 12:44:05 +01:00
Nate McMaster 074f2a423d Switch queue name for dnceng and rename yaml files directory (#1481)
Update queue names to to work on https://dev.azure.com/dnceng. Also, react to VSTS => Azure DevOps rebranding.
2018-09-25 17:24:04 -07:00
Ryan Nowak 31b5119c64 fix build of VSIX 2018-09-25 13:52:25 -07:00
Steve Sanderson 824e0097f5 Bump version to 0.7.0-preview1-* 2018-09-25 16:24:23 +01:00
Ryan Nowak 959b45f4e6 Fix #1478 - Razor.Design not getting replaced in templates (#1479)
* Fix #1478 - Razor.Design not getting replaced in templates
2018-09-25 09:27:28 +01:00
Ryan Nowak 6f383a0f0f Adds support for 'Context' parameters on components (#1470)
Adds support for 'Context' parameters on components

This change allows you to set the parameter name of a parameterized child content by using the `Context` attribute on the component. The `Context` attribute will be defined (and shown by completion) when the component has one or more declared parameterized (`RenderFragment<>`) child content parameters.

This is nice for cases where you are using implicit child content:

```
<ol>
  <Repeater Items="People" Context="person">
    <li>@person.FirstName</li>
  </Repeater>
</ol>
```

 or, when you have multiple child content elements and want them all to have the same parameter name:

 ```
<MyComponent Items="People" Context="person">
    <ChildContent1><div>@person.FirstName</div></ChildContent1>
    <ChildContent2><div>@person.LastName</div></ChildContent2>
</Repeater>
```

The parameter name can be overridden by using the `Context` parameter on the child content element:

 ```
<MyComponent Items="People" Context="person">
    <ChildContent1 Context="item"><div>@item.FirstName</div></ChildContent1>
    <ChildContent2><div>@person.LastName</div></ChildContent2>
</Repeater>
```

If the component defines a `Context` parameter already then we won't synthesize one - your component's parameter will work exactly as it did before this feature.
2018-09-24 12:22:16 -07:00
Ryan Nowak 984fabb89f Correct template package reference 2018-09-24 10:42:59 -07:00
KristianJakubik 067d245f94 Fix negative route params. Fixes #1437 2018-09-24 17:55:21 +01:00
Steve Sanderson 0942b5aa0d Switch Hosted template to UseBlazor<Startup> for consistency with server-side template. Fixes #1473 2018-09-24 17:54:46 +01:00
Ryan Nowak 86b532cd47 Undo hardcoded Razor.Design in templates 2018-09-22 16:39:27 -07:00
Ryan Nowak 5459107832 Fix #1298 (#1309)
* Fix #1298

This change lifts our Razor dependencies to 2.1.1. This is needed
because by default ASP.NET Core projects will depend on 2.1.1 - which
results in a conflict trying to use the Blazor compiler. The Blazor
compiler will load the 2.1.0 msbuild tasks, which then break loading the
2.1.1 tasks.

Since this is happening in the MSBuild process, we can't really write
any code to sort this out. We have to make sure the versions match.

In general the guidance for ASP.NET Core is that projects will **compile
against** 2.1.1 so this won't be a problem in the future unless a user
project specifically lifts ASP.NET Core to a higher version. If that's
the case they will also have to live `Microsoft.AspNetCore.Razor.Design`
to match.
2018-09-21 13:29:40 -07:00
Ryan Nowak 4f51d90157 Fix #1399 - crash on start-end syntax for void element
We weren't correctly recovering when a void element is written as a
start-end pair. This change cleans up some of the plumbing around
end-tag handling and adds recognition for this case.

Added a new bespoke diagnostic for the void element case.
2018-09-21 12:54:44 -07:00
Ryan Nowak f601b6d3d2 Fix #1450 Skip compilation on non-C# projects
This change skips our 'temp' compilation that we do to implement 2-phase
build for defining components in .cshtml when the project is not C# OR
when the project has no .cshtml files.

This should make the rest of the build-time Blazor functionality work
for non-C# projects.

This should also make the build faster when you have the Blazor targets
imported in a C# project with no .cshtml files.
2018-09-20 14:27:08 -07:00
Ryan Nowak 100382bf71 Add Type Inference for Generic-Typed Components
This change allows you to use generic-typed components without
explicitly specify type arguments.

**Before:**
```
<Grid Items="@MyItems" TItem="Person">
...
</Grid>
```

**After:**
```
<Grid Items="@MyItems">
...
</Grid>
```

Where possible, the type of the component will be inferred based on the
values passed to component parameters. This won't work like magic, you
have to specify parameters that provide type arguments for all of the
component's type parameters.

This is a best effort system, and it's largely based on the limitations
and behaviours of generic type inference in C#. We think it will work
well with most Blazor features and for most reasonable components. You
should not forget it's easy to specify type arguments, because you may
still have to in some cases.

In particular you may notice issues if you are trying to use a generic
typed component where all of the parameters are delegates or templates.
Type inference for delegates/lambdas in C# is based on the context. Any
time you combine generics and delegates it's easy to get into a scenario
where the compiler won't infer the correct type, or will give up.

----
The type inference feature works by generating a 'thunk' method in
*caller* that can act as a site for type inference (C# does not support
inference on constructors).

For our grid example above, the non-inferenced code will look something
like:
```
builder.OpenComponent<Grid<Person>>(0);
builder.AddAttribute(1, "Items", MyItems);
builder.CloseComponent();
```

Note that we can only write the type `Grid<Person>` because you wrote
`Person` in your code. What you type in the `TItem` attribute value gets
inserted into the generated code such that it fills in the generic type
parameter.

On the other hand, if you want is to infer the type, we have to do some
compiler magic. That looks like:
```
__Blazor.(long generated name).TypeInference.CreateGrid_0();
...

// elsewhere in the file
internal static class TypeInference
{
    public static void CreateGrid_0<TItem>(RenderTreeBuilder builder,
    int seq, int __seq0, global::System.Collections.Generic.List<TItem>
    __arg0)
        {
	        builder.OpenComponent<Grid<TItem>>(seq);
		        builder.AddAttribute(__seq0, "Items", __arg0);
			        builder.CloseComponent();
				    }
				    }
				    ```

				    This allows us to rely on the C#
				    compiler for itype inference.
2018-09-20 12:19:26 -07:00
Steve Sanderson b2f73492f5 Fix method wiping (#1448)
* Fix wiping assemblies that contain references to others in same directory

* Fix generated IL for reporting calls to wiped methods

* Add E2E test for method wiping
2018-09-20 10:20:37 +01:00
Howard Richards d4e2c28145 Amend link for [docs]
The current link for docs points to the wiki which does not have a lot of documentation. Suggest pointing to https://blazor.net/docs/index.html
2018-09-19 11:36:14 -07:00
Steve Sanderson 0fd0fa3b79 Include TPN file in VSIX and all nupkg files built from "src" directory 2018-09-19 13:35:01 +01:00
Steve Sanderson 2f69aa90e5 Revert "Update VSTS queue name", because that change is intended for a
different VSTS instance only.

This reverts commit 32681bf44fc44c2711b5598d5c2481e6accf1ce0.
2018-09-18 22:21:38 +01:00
Steve Sanderson 52d8d4a00f Update VSTS queue name 2018-09-18 22:16:38 +01:00
Steve Sanderson 27189875fb Fix build targets bug (incremental build input was based on wrong property name) 2018-09-18 12:57:50 +01:00
Ryan Nowak 354752cf16 Add support for generic-typed components (#1417)
* Add the ability to discover generic types/properties

* Add @typeparam directive

Adds the ability to declare a generic-typed component using Razor.

* Add a 'type parameter' property to generic components

* Adds the ability to consume generic-typed components
2018-09-16 14:01:15 -07:00