This change introduces a 'tag helper' that replaces @bind with custom
code generation that accomplishes roughly the same thing.
This feature lights up by dynamically generating tag helpers that are
visible to tooling and affect the code generation based on:
- pattern recognition of component properties
- attributes that create definitions for elements
- a 'fallback' case for elements
'bind' also supports format strings (currently only for DateTime) via
a separate attribute.
This change introduces the basic framework for bind and tooling support.
We know that we'll have to do more work to define the set of default
'bind' cases for the DOM and to flesh out the conversion/formatting
infrastructure.
This change gets us far enough to replace all of the cases we currently
have tests for :) with the new features. The old @bind technique still
works for now.
Examples:
@* bind an input element to an expression *@
<input bind="@SelectedDate" format="mm/dd/yyyy" />
@functions {
public DateTime SelectedDate { get; set; }
}
@* bind an arbitrary expression to an arbitrary set of attributes *@
<div bind-myvalue-myevent="@SomeExpression">...</div>
@* write a component that supports bind *@
@* in Counter.cshtml *@
<div>...html omitted for brevity...</div>
@functions {
public int Value { get; set; } = 1;
public Action<int> ValueChanged { get; set; }
}
@* in another file *@
<Counter bind-Value="@CurrentValue" />
@functions {
public int CurrentValue { get; set; }
}
This isn't needed anymore to support the Blazor design-time experience.
Now that it's gone, it will no longer cause conflicts with MVC's types
so we can remove the other workaround (privateassets).
This should now correctly require VS 15.7-preview1 or newer with the
ASP.NET and web development tools to installed.
Removed the Razor Language Servcies dependency since it's prompting an
install of the wrong tools from the VS gallery.
Have to do some gritty work to be able to show a proper version in the
about dialog. The generation of the proper assembly attributes is part
of the new-style csproj, so we don't get to use it for free.
This change removes the magic 'auto-lambda' feature that has some
unconvincing UX.
Also working around a razor bug where explicit expressions are lowered
incorrectly. This should make it possible to write code like:
<Foo Bar="@(e => { OnChanged(e); })" />
Most versions of NPM in use always use LF for line endings anyway.
Forcing LF on windows should limit the number of no-op changes.
This issue has been fixed in NPM
(see https://github.com/npm/npm/issues/1716) but not everyone will have
the fix.
The Directory.Build.{props targets} files are designed for a new-style
csproj. Old-style csproj, which the VSIX uses don't support
PackageReference where the version is a variable.