diff --git a/src/DotVVM.CommandLine/DotVVM.CommandLine.csproj b/src/DotVVM.CommandLine/DotVVM.CommandLine.csproj index 12a2a0d31d..f3bef00312 100644 --- a/src/DotVVM.CommandLine/DotVVM.CommandLine.csproj +++ b/src/DotVVM.CommandLine/DotVVM.CommandLine.csproj @@ -3,7 +3,7 @@ DotVVM.CommandLine dotnet-dotvvm - 3.1.0-preview03-112034 + 3.1.0-preview05-final netcoreapp2.1 dotvvmwizard.snk true @@ -21,7 +21,7 @@ $(MSBuildProjectName).nuspec true DotVVM.CommandLine - 3.1.0-preview03-112034 + 3.1.0-preview05-final RIGANTI Command-line tools for DotVVM. false diff --git a/src/DotVVM.Core/DotVVM.Core.csproj b/src/DotVVM.Core/DotVVM.Core.csproj index a3001ece6a..80fba6697e 100644 --- a/src/DotVVM.Core/DotVVM.Core.csproj +++ b/src/DotVVM.Core/DotVVM.Core.csproj @@ -1,6 +1,6 @@  - 3.1.0-preview03-112034 + 3.1.0-preview05-final netstandard1.6;net451 $(NoWarn);CS1591 true @@ -17,7 +17,7 @@ false false DotVVM.Core - 3.1.0-preview03-112034 + 3.1.0-preview05-final RIGANTI This package contains base classes and interfaces of DotVVM that might be useful in a business layer. DotVVM is an open source ASP.NET-based framework which allows to build modern web apps without writing any JavaScript code. diff --git a/src/DotVVM.Framework.Api.Swashbuckle.AspNetCore/DotVVM.Framework.Api.Swashbuckle.AspNetCore.csproj b/src/DotVVM.Framework.Api.Swashbuckle.AspNetCore/DotVVM.Framework.Api.Swashbuckle.AspNetCore.csproj index 6905bf1da1..283e8eb585 100644 --- a/src/DotVVM.Framework.Api.Swashbuckle.AspNetCore/DotVVM.Framework.Api.Swashbuckle.AspNetCore.csproj +++ b/src/DotVVM.Framework.Api.Swashbuckle.AspNetCore/DotVVM.Framework.Api.Swashbuckle.AspNetCore.csproj @@ -3,7 +3,7 @@ netstandard2.0 DotVVM.Api.Swashbuckle.AspNetCore - 3.1.0-preview03-112034 + 3.1.0-preview05-final RIGANTI Swashbuckle.AspNetCore extensions for DotVVM. false diff --git a/src/DotVVM.Framework.Api.Swashbuckle.Owin/DotVVM.Framework.Api.Swashbuckle.Owin.csproj b/src/DotVVM.Framework.Api.Swashbuckle.Owin/DotVVM.Framework.Api.Swashbuckle.Owin.csproj index 0df9691302..2ac1259624 100644 --- a/src/DotVVM.Framework.Api.Swashbuckle.Owin/DotVVM.Framework.Api.Swashbuckle.Owin.csproj +++ b/src/DotVVM.Framework.Api.Swashbuckle.Owin/DotVVM.Framework.Api.Swashbuckle.Owin.csproj @@ -3,7 +3,7 @@ net451 DotVVM.Api.Swashbuckle.Owin - 3.1.0-preview03-112034 + 3.1.0-preview05-final RIGANTI Swashbuckle.Owin extensions for DotVVM. false diff --git a/src/DotVVM.Framework.Hosting.AspNetCore/DotVVM.Framework.Hosting.AspNetCore.csproj b/src/DotVVM.Framework.Hosting.AspNetCore/DotVVM.Framework.Hosting.AspNetCore.csproj index 5d0c8ff26e..6568d0425c 100644 --- a/src/DotVVM.Framework.Hosting.AspNetCore/DotVVM.Framework.Hosting.AspNetCore.csproj +++ b/src/DotVVM.Framework.Hosting.AspNetCore/DotVVM.Framework.Hosting.AspNetCore.csproj @@ -1,6 +1,6 @@  - 3.1.0-preview03-112034 + 3.1.0-preview05-final netstandard2.0 $(NoWarn);CS1591 true @@ -17,7 +17,7 @@ false false DotVVM.AspNetCore - 3.1.0-preview03-112034 + 3.1.0-preview05-final RIGANTI This package contains ASP.NET Core middleware and hosting infrastructure for DotVVM apps. It supports both .NET Framework and .NET Core. diff --git a/src/DotVVM.Framework.Hosting.Owin/DotVVM.Framework.Hosting.Owin.csproj b/src/DotVVM.Framework.Hosting.Owin/DotVVM.Framework.Hosting.Owin.csproj index 2284727eb0..bd46061d37 100644 --- a/src/DotVVM.Framework.Hosting.Owin/DotVVM.Framework.Hosting.Owin.csproj +++ b/src/DotVVM.Framework.Hosting.Owin/DotVVM.Framework.Hosting.Owin.csproj @@ -1,6 +1,6 @@  - 3.1.0-preview03-112034 + 3.1.0-preview05-final net451 win7-x64;win7-x86 true @@ -17,7 +17,7 @@ false false DotVVM.Owin - 3.1.0-preview03-112034 + 3.1.0-preview05-final RIGANTI This package contains OWIN middleware and hosting infrastructure for DotVVM apps. diff --git a/src/DotVVM.Framework/Compilation/Binding/StaticCommandBindingCompiler.cs b/src/DotVVM.Framework/Compilation/Binding/StaticCommandBindingCompiler.cs index f7aef2913f..0617c0e465 100644 --- a/src/DotVVM.Framework/Compilation/Binding/StaticCommandBindingCompiler.cs +++ b/src/DotVVM.Framework/Compilation/Binding/StaticCommandBindingCompiler.cs @@ -80,7 +80,7 @@ private JsExpression TranslateVariableDeclaration(Expression expression, Func { var tmpVar = new JsTemporaryVariableParameter(); return Expression.Parameter(v.Type, v.Name).AddParameterAnnotation(new BindingParameterAnnotation(extensionParameter: - new JavascriptTranslationVisitor.FakeExtensionParameter(_ => new JsSymbolicParameter(tmpVar)) + new JavascriptTranslationVisitor.FakeExtensionParameter(_ => new JsSymbolicParameter(tmpVar), v.Name, new ResolvedTypeDescriptor(v.Type)) )); }).ToArray() ); diff --git a/src/DotVVM.Framework/Compilation/Javascript/KnockoutObservableHandlingVisitor.cs b/src/DotVVM.Framework/Compilation/Javascript/KnockoutObservableHandlingVisitor.cs index 7dcd07c9e1..374f1d2e4e 100644 --- a/src/DotVVM.Framework/Compilation/Javascript/KnockoutObservableHandlingVisitor.cs +++ b/src/DotVVM.Framework/Compilation/Javascript/KnockoutObservableHandlingVisitor.cs @@ -105,6 +105,13 @@ public override void VisitAssignmentExpression(JsAssignmentExpression assignment resultExpression.WithAnnotation(assignmentExpression.Annotation()); } + else if (assignmentExpression.Left.GetResultType() is ViewModelInfoAnnotation vmInfo && vmInfo.ContainsObservables && assignmentExpression.Left.IsComplexType()) + { + var value = assignmentExpression.Right; + resultExpression = assignmentExpression.Right.ReplaceWith(_ => + new JsIdentifierExpression("dotvvm").Member("serialization").Member("deserialize").Invoke(value, new JsObjectExpression(), new JsLiteral(true)) + ); + } else resultExpression = assignmentExpression; HandleNode(resultExpression); diff --git a/src/DotVVM.Framework/DotVVM.Framework.csproj b/src/DotVVM.Framework/DotVVM.Framework.csproj index 97a9a39b29..05d68f86a7 100644 --- a/src/DotVVM.Framework/DotVVM.Framework.csproj +++ b/src/DotVVM.Framework/DotVVM.Framework.csproj @@ -1,7 +1,7 @@  DotVVM - 3.1.0-preview03-112034 + 3.1.0-preview05-final net451;netstandard2.0;netstandard2.1 $(NoWarn);CS1591;CS1573 true @@ -9,7 +9,7 @@ true true DotVVM - 3.1.0-preview03-112034 + 3.1.0-preview05-final RIGANTI DotVVM is an open source ASP.NET-based framework which allows to build modern web apps without writing any JavaScript code. false diff --git a/src/DotVVM.Framework/yarn.lock b/src/DotVVM.Framework/yarn.lock index b7fbf3f5d3..cc45d87378 100644 --- a/src/DotVVM.Framework/yarn.lock +++ b/src/DotVVM.Framework/yarn.lock @@ -339,12 +339,12 @@ "@jest/types" "^26.6.2" "@types/node" "*" "ansi-escapes" "^4.2.1" + "chalk" "^4.0.0" "exit" "^0.1.2" "graceful-fs" "^4.2.4" - "chalk" "^4.0.0" + "jest-changed-files" "^26.6.2" "jest-config" "^26.6.3" "jest-haste-map" "^26.6.2" - "jest-changed-files" "^26.6.2" "jest-message-util" "^26.6.2" "jest-regex-util" "^26.0.0" "jest-resolve" "^26.6.2" @@ -402,11 +402,11 @@ "@jest/test-result" "^26.6.2" "@jest/transform" "^26.6.2" "@jest/types" "^26.6.2" + "chalk" "^4.0.0" "collect-v8-coverage" "^1.0.0" "exit" "^0.1.2" "glob" "^7.1.2" "graceful-fs" "^4.2.4" - "chalk" "^4.0.0" "istanbul-lib-coverage" "^3.0.0" "istanbul-lib-instrument" "^4.0.3" "istanbul-lib-report" "^3.0.0" @@ -462,10 +462,10 @@ "@babel/core" "^7.1.0" "@jest/types" "^26.6.2" "babel-plugin-istanbul" "^6.0.0" + "chalk" "^4.0.0" "convert-source-map" "^1.4.0" "fast-json-stable-stringify" "^2.0.0" "graceful-fs" "^4.2.4" - "chalk" "^4.0.0" "jest-haste-map" "^26.6.2" "jest-regex-util" "^26.0.0" "jest-util" "^26.6.2" @@ -818,8 +818,8 @@ "@types/babel__core" "^7.1.7" "babel-plugin-istanbul" "^6.0.0" "babel-preset-jest" "^26.6.2" - "graceful-fs" "^4.2.4" "chalk" "^4.0.0" + "graceful-fs" "^4.2.4" "slash" "^3.0.0" "babel-plugin-istanbul@^6.0.0": @@ -1017,6 +1017,51 @@ "resolved" "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz" "version" "0.12.0" +"chalk@^2.0.0": + "integrity" "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==" + "resolved" "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz" + "version" "2.4.2" + dependencies: + "ansi-styles" "^3.2.1" + "escape-string-regexp" "^1.0.5" + "supports-color" "^5.3.0" + +"chalk@^3.0.0": + "integrity" "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==" + "resolved" "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz" + "version" "3.0.0" + dependencies: + "ansi-styles" "^4.1.0" + "supports-color" "^7.1.0" + +"chalk@^4.0.0": + "integrity" "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==" + "resolved" "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz" + "version" "4.1.0" + dependencies: + "ansi-styles" "^4.1.0" + "supports-color" "^7.1.0" + +"char-regex@^1.0.2": + "integrity" "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==" + "resolved" "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz" + "version" "1.0.2" + +"chokidar@^3.3.0": + "integrity" "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==" + "resolved" "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz" + "version" "3.5.1" + dependencies: + "anymatch" "~3.1.1" + "braces" "~3.0.2" + "glob-parent" "~5.1.0" + "is-binary-path" "~2.1.0" + "is-glob" "~4.0.1" + "normalize-path" "~3.0.0" + "readdirp" "~3.5.0" + optionalDependencies: + "fsevents" "~2.3.1" + "ci-info@^2.0.0": "integrity" "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==" "resolved" "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz" @@ -1471,11 +1516,6 @@ "resolved" "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz" "version" "1.3.0" -"fast-deep-equal@^3.1.1": - "integrity" "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" - "resolved" "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz" - "version" "3.1.3" - "fast-check@2.5.0": "integrity" "sha512-1DQmeMef1xs7AQP3dHIpVtAc5FzpUdEJE6y1rqt2MX1+uVEGdqPT5u31h14oxbA/Xoxsm9YqahxsszLZBMg/dA==" "resolved" "https://registry.npmjs.org/fast-check/-/fast-check-2.5.0.tgz" @@ -1483,6 +1523,11 @@ dependencies: "pure-rand" "^3.0.0" +"fast-deep-equal@^3.1.1": + "integrity" "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + "resolved" "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz" + "version" "3.1.3" + "fast-json-stable-stringify@^2.0.0", "fast-json-stable-stringify@2.x": "integrity" "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" "resolved" "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz" @@ -1728,51 +1773,6 @@ "resolved" "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz" "version" "1.1.1" -"chalk@^2.0.0": - "integrity" "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==" - "resolved" "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz" - "version" "2.4.2" - dependencies: - "ansi-styles" "^3.2.1" - "escape-string-regexp" "^1.0.5" - "supports-color" "^5.3.0" - -"chalk@^3.0.0": - "integrity" "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==" - "resolved" "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz" - "version" "3.0.0" - dependencies: - "ansi-styles" "^4.1.0" - "supports-color" "^7.1.0" - -"chalk@^4.0.0": - "integrity" "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==" - "resolved" "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz" - "version" "4.1.0" - dependencies: - "ansi-styles" "^4.1.0" - "supports-color" "^7.1.0" - -"char-regex@^1.0.2": - "integrity" "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==" - "resolved" "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz" - "version" "1.0.2" - -"chokidar@^3.3.0": - "integrity" "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==" - "resolved" "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz" - "version" "3.5.1" - dependencies: - "anymatch" "~3.1.1" - "braces" "~3.0.2" - "glob-parent" "~5.1.0" - "is-binary-path" "~2.1.0" - "is-glob" "~4.0.1" - "normalize-path" "~3.0.0" - "readdirp" "~3.5.0" - optionalDependencies: - "fsevents" "~2.3.1" - "iconv-lite@0.4.24": "integrity" "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==" "resolved" "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz" @@ -2063,6 +2063,15 @@ "html-escaper" "^2.0.0" "istanbul-lib-report" "^3.0.0" +"jest-changed-files@^26.6.2": + "integrity" "sha512-fDS7szLcY9sCtIip8Fjry9oGf3I2ht/QT21bAHm5Dmf0mD4X3ReNUf17y+bO6fR8WgbIZTlbyG1ak/53cbRzKQ==" + "resolved" "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-26.6.2.tgz" + "version" "26.6.2" + dependencies: + "@jest/types" "^26.6.2" + "execa" "^4.0.0" + "throat" "^5.0.0" + "jest-cli@^26.5.3": "integrity" "sha512-GF9noBSa9t08pSyl3CY4frMrqp+aQXFGFkf5hEPbh/pIUFYWMK6ZLTfbmadxJVcJrdRoChlWQsA2VkJcDFK8hg==" "resolved" "https://registry.npmjs.org/jest-cli/-/jest-cli-26.6.3.tgz" @@ -2071,9 +2080,9 @@ "@jest/core" "^26.6.3" "@jest/test-result" "^26.6.2" "@jest/types" "^26.6.2" + "chalk" "^4.0.0" "exit" "^0.1.2" "graceful-fs" "^4.2.4" - "chalk" "^4.0.0" "import-local" "^3.0.2" "is-ci" "^2.0.0" "jest-config" "^26.6.3" @@ -2091,10 +2100,10 @@ "@jest/test-sequencer" "^26.6.3" "@jest/types" "^26.6.2" "babel-jest" "^26.6.3" + "chalk" "^4.0.0" "deepmerge" "^4.2.2" "glob" "^7.1.1" "graceful-fs" "^4.2.4" - "chalk" "^4.0.0" "jest-environment-jsdom" "^26.6.2" "jest-environment-node" "^26.6.2" "jest-get-type" "^26.3.0" @@ -2111,8 +2120,8 @@ "resolved" "https://registry.npmjs.org/jest-diff/-/jest-diff-25.5.0.tgz" "version" "25.5.0" dependencies: - "diff-sequences" "^25.2.6" "chalk" "^3.0.0" + "diff-sequences" "^25.2.6" "jest-get-type" "^25.2.6" "pretty-format" "^25.5.0" @@ -2121,8 +2130,8 @@ "resolved" "https://registry.npmjs.org/jest-diff/-/jest-diff-26.6.2.tgz" "version" "26.6.2" dependencies: - "diff-sequences" "^26.6.2" "chalk" "^4.0.0" + "diff-sequences" "^26.6.2" "jest-get-type" "^26.3.0" "pretty-format" "^26.6.2" @@ -2200,15 +2209,6 @@ optionalDependencies: "fsevents" "^2.1.2" -"jest-changed-files@^26.6.2": - "integrity" "sha512-fDS7szLcY9sCtIip8Fjry9oGf3I2ht/QT21bAHm5Dmf0mD4X3ReNUf17y+bO6fR8WgbIZTlbyG1ak/53cbRzKQ==" - "resolved" "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-26.6.2.tgz" - "version" "26.6.2" - dependencies: - "@jest/types" "^26.6.2" - "execa" "^4.0.0" - "throat" "^5.0.0" - "jest-jasmine2@^26.6.3": "integrity" "sha512-kPKUrQtc8aYwBV7CqBg5pu+tmYXlvFlSFYn18ev4gPFtrRzB15N2gW/Roew3187q2w2eHuu0MU9TJz6w0/nPEg==" "resolved" "https://registry.npmjs.org/jest-jasmine2/-/jest-jasmine2-26.6.3.tgz" @@ -2220,9 +2220,9 @@ "@jest/test-result" "^26.6.2" "@jest/types" "^26.6.2" "@types/node" "*" + "chalk" "^4.0.0" "co" "^4.6.0" "expect" "^26.6.2" - "chalk" "^4.0.0" "is-generator-fn" "^2.0.0" "jest-each" "^26.6.2" "jest-matcher-utils" "^26.6.2" @@ -2269,8 +2269,8 @@ "@babel/code-frame" "^7.0.0" "@jest/types" "^26.6.2" "@types/stack-utils" "^2.0.0" - "graceful-fs" "^4.2.4" "chalk" "^4.0.0" + "graceful-fs" "^4.2.4" "micromatch" "^4.0.2" "pretty-format" "^26.6.2" "slash" "^3.0.0" @@ -2309,8 +2309,8 @@ "version" "26.6.2" dependencies: "@jest/types" "^26.6.2" - "graceful-fs" "^4.2.4" "chalk" "^4.0.0" + "graceful-fs" "^4.2.4" "jest-pnp-resolver" "^1.2.2" "jest-util" "^26.6.2" "read-pkg-up" "^7.0.1" @@ -2327,10 +2327,10 @@ "@jest/test-result" "^26.6.2" "@jest/types" "^26.6.2" "@types/node" "*" + "chalk" "^4.0.0" "emittery" "^0.7.1" "exit" "^0.1.2" "graceful-fs" "^4.2.4" - "chalk" "^4.0.0" "jest-config" "^26.6.3" "jest-docblock" "^26.0.0" "jest-haste-map" "^26.6.2" @@ -2357,12 +2357,12 @@ "@jest/transform" "^26.6.2" "@jest/types" "^26.6.2" "@types/yargs" "^15.0.0" + "chalk" "^4.0.0" "cjs-module-lexer" "^0.6.0" "collect-v8-coverage" "^1.0.0" "exit" "^0.1.2" "glob" "^7.1.3" "graceful-fs" "^4.2.4" - "chalk" "^4.0.0" "jest-config" "^26.6.3" "jest-haste-map" "^26.6.2" "jest-message-util" "^26.6.2" @@ -2393,9 +2393,9 @@ "@jest/types" "^26.6.2" "@types/babel__traverse" "^7.0.4" "@types/prettier" "^2.0.0" + "chalk" "^4.0.0" "expect" "^26.6.2" "graceful-fs" "^4.2.4" - "chalk" "^4.0.0" "jest-diff" "^26.6.2" "jest-get-type" "^26.3.0" "jest-haste-map" "^26.6.2" @@ -2413,8 +2413,8 @@ dependencies: "@jest/types" "^26.6.2" "@types/node" "*" - "graceful-fs" "^4.2.4" "chalk" "^4.0.0" + "graceful-fs" "^4.2.4" "is-ci" "^2.0.0" "micromatch" "^4.0.2" @@ -3693,10 +3693,10 @@ "ansi-escapes" "^4.2.1" "supports-hyperlinks" "^2.0.0" -"terser@^5.0.0": - "integrity" "sha512-vyqLMoqadC1uR0vywqOZzriDYzgEkNJFK4q9GeyOBHIbiECHiWLKcWfbQWAUaPfxkjDhapSlZB9f7fkMrvkVjA==" - "resolved" "https://registry.npmjs.org/terser/-/terser-5.6.0.tgz" - "version" "5.6.0" +"terser@^5.0.0", "terser@^5.7.0": + "integrity" "sha512-HP5/9hp2UaZt5fYkuhNBR8YyRcT8juw8+uFbAme53iN9hblvKnLUTKkmwJG6ocWpIKf8UK4DoeWG4ty0J6S6/g==" + "resolved" "https://registry.npmjs.org/terser/-/terser-5.7.0.tgz" + "version" "5.7.0" dependencies: "commander" "^2.20.0" "source-map" "~0.7.2" @@ -3824,6 +3824,13 @@ "resolved" "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz" "version" "0.14.5" +"type-check@~0.3.2": + "integrity" "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=" + "resolved" "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz" + "version" "0.3.2" + dependencies: + "prelude-ls" "~1.1.2" + "type-detect@4.0.8": "integrity" "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==" "resolved" "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz" @@ -3844,13 +3851,6 @@ "resolved" "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz" "version" "0.8.1" -"type-check@~0.3.2": - "integrity" "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=" - "resolved" "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz" - "version" "0.3.2" - dependencies: - "prelude-ls" "~1.1.2" - "typedarray-to-buffer@^3.1.5": "integrity" "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==" "resolved" "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz" diff --git a/src/DotVVM.Samples.Common/CommonConfiguration.cs b/src/DotVVM.Samples.Common/CommonConfiguration.cs index 2ed771d8e3..5bb1c8d4fb 100644 --- a/src/DotVVM.Samples.Common/CommonConfiguration.cs +++ b/src/DotVVM.Samples.Common/CommonConfiguration.cs @@ -10,6 +10,7 @@ using DotVVM.Samples.Common.Api.AspNetCore; using DotVVM.Samples.Common.Api.Owin; using DotVVM.Samples.Common.Utilities; +using DotVVM.Samples.Common.ViewModels.FeatureSamples.BindingVariables; using DotVVM.Samples.Common.ViewModels.FeatureSamples.DependencyInjection; using DotVVM.Samples.Common.ViewModels.FeatureSamples.PostBack; using DotVVM.Samples.Common.ViewModels.FeatureSamples.PostBackSpaNavigation; @@ -54,6 +55,7 @@ public static void ConfigureServices(IDotvvmServiceCollection dotvvmServices) services.AddSingleton(); services.AddSingleton(); + services.AddTransient(); } private static void RegisterResources(DotvvmResourceRepository resources) diff --git a/src/DotVVM.Samples.Common/DotVVM.Samples.Common.csproj b/src/DotVVM.Samples.Common/DotVVM.Samples.Common.csproj index c022fd0100..e952bfb9b6 100644 --- a/src/DotVVM.Samples.Common/DotVVM.Samples.Common.csproj +++ b/src/DotVVM.Samples.Common/DotVVM.Samples.Common.csproj @@ -54,6 +54,9 @@ + + + diff --git a/src/DotVVM.Samples.Common/DotvvmStartup.cs b/src/DotVVM.Samples.Common/DotvvmStartup.cs index 185a346cb3..472f20d489 100644 --- a/src/DotVVM.Samples.Common/DotvvmStartup.cs +++ b/src/DotVVM.Samples.Common/DotvvmStartup.cs @@ -27,6 +27,7 @@ using DotVVM.Framework.Compilation.Javascript.Ast; using DotVVM.Samples.Common.ViewModels.FeatureSamples.JavascriptTranslation; using DotVVM.Samples.Common.Views.FeatureSamples.PostbackAbortSignal; +using DotVVM.Samples.Common.ViewModels.FeatureSamples.BindingVariables; namespace DotVVM.Samples.BasicSamples { @@ -190,7 +191,7 @@ private static void AddControls(DotvvmConfiguration config) config.Markup.AddCodeControls("cc", typeof(Loader)); config.Markup.AddMarkupControl("sample", "EmbeddedResourceControls_Button", "embedded://EmbeddedResourceControls/Button.dotcontrol"); - + config.Markup.AutoDiscoverControls(new DefaultControlRegistrationStrategy(config, "sample", "Views/")); } diff --git a/src/DotVVM.Samples.Common/ViewModels/FeatureSamples/BindingVariables/StaticCommandVariablesWithServiceViewModel.cs b/src/DotVVM.Samples.Common/ViewModels/FeatureSamples/BindingVariables/StaticCommandVariablesWithServiceViewModel.cs new file mode 100644 index 0000000000..510cfa57f6 --- /dev/null +++ b/src/DotVVM.Samples.Common/ViewModels/FeatureSamples/BindingVariables/StaticCommandVariablesWithServiceViewModel.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using DotVVM.Framework.ViewModel; +using DotVVM.Samples.BasicSamples.ViewModels.ComplexSamples.SPA; + +namespace DotVVM.Samples.Common.ViewModels.FeatureSamples.BindingVariables +{ + public class StaticCommandVariablesWithServiceViewModel : SiteViewModel + { + public string Message1 { get; set; } + public string Message2 { get; set; } + public MultipleMessagesDTO Data { get; set; } = new MultipleMessagesDTO(); + } + public class MultipleMessagesWrapper + { + public MultipleMessagesDTO Data { get; set; } + } + public class MultipleMessagesDTO + { + public string Message1 { get; set; } + public string Message2 { get; set; } + + } + public class VariablesStaticCommand + { + [AllowStaticCommand] + public Task GetMessages() + { + // This method could just return DTO but the purpose is to test that ".Result" is translated correctly. + return Task.FromResult(new MultipleMessagesDTO() { + Message1 = "test1", + Message2 = "test2" + }); + } + + [AllowStaticCommand] + public Task GetMessage() + { + // This method could just return DTO but the purpose is to test that ".Result" is translated correctly. + return Task.FromResult("test1"); + } + + [AllowStaticCommand] + public Task GetData() + { + // This method could just return DTO but the purpose is to test that ".Result" is translated correctly. + return Task.FromResult(new MultipleMessagesWrapper() { + Data = new MultipleMessagesDTO() { + Message1 = "test1", + Message2 = "test2" + } + }); + } + + } + +} + diff --git a/src/DotVVM.Samples.Common/Views/FeatureSamples/BindingVariables/StaticCommandVariablesWithService_Complex.dothtml b/src/DotVVM.Samples.Common/Views/FeatureSamples/BindingVariables/StaticCommandVariablesWithService_Complex.dothtml new file mode 100644 index 0000000000..d00c37e5b6 --- /dev/null +++ b/src/DotVVM.Samples.Common/Views/FeatureSamples/BindingVariables/StaticCommandVariablesWithService_Complex.dothtml @@ -0,0 +1,15 @@ +@viewModel DotVVM.Samples.Common.ViewModels.FeatureSamples.BindingVariables.StaticCommandVariablesWithServiceViewModel, DotVVM.Samples.Common +@masterPage Views/ComplexSamples/SPA/site.dotmaster +@service service = DotVVM.Samples.Common.ViewModels.FeatureSamples.BindingVariables.VariablesStaticCommand + + + + {{value: Message1 }} + {{value: Message2 }} + + + diff --git a/src/DotVVM.Samples.Common/Views/FeatureSamples/BindingVariables/StaticCommandVariablesWithService_Complex2.dothtml b/src/DotVVM.Samples.Common/Views/FeatureSamples/BindingVariables/StaticCommandVariablesWithService_Complex2.dothtml new file mode 100644 index 0000000000..be30886f36 --- /dev/null +++ b/src/DotVVM.Samples.Common/Views/FeatureSamples/BindingVariables/StaticCommandVariablesWithService_Complex2.dothtml @@ -0,0 +1,14 @@ +@viewModel DotVVM.Samples.Common.ViewModels.FeatureSamples.BindingVariables.StaticCommandVariablesWithServiceViewModel, DotVVM.Samples.Common +@masterPage Views/ComplexSamples/SPA/site.dotmaster +@service service = DotVVM.Samples.Common.ViewModels.FeatureSamples.BindingVariables.VariablesStaticCommand + + + + {{value: Data.Message1 }} + {{value: Data.Message2 }} + + + diff --git a/src/DotVVM.Samples.Common/Views/FeatureSamples/BindingVariables/StaticCommandVariablesWithService_Simple.dothtml b/src/DotVVM.Samples.Common/Views/FeatureSamples/BindingVariables/StaticCommandVariablesWithService_Simple.dothtml new file mode 100644 index 0000000000..e9f8a79439 --- /dev/null +++ b/src/DotVVM.Samples.Common/Views/FeatureSamples/BindingVariables/StaticCommandVariablesWithService_Simple.dothtml @@ -0,0 +1,12 @@ +@viewModel DotVVM.Samples.Common.ViewModels.FeatureSamples.BindingVariables.StaticCommandVariablesWithServiceViewModel, DotVVM.Samples.Common +@masterPage Views/ComplexSamples/SPA/site.dotmaster +@service service = DotVVM.Samples.Common.ViewModels.FeatureSamples.BindingVariables.VariablesStaticCommand + + + + {{value: Message1 }} + + diff --git a/src/DotVVM.Samples.Tests/Feature/BindingVariablesTests.cs b/src/DotVVM.Samples.Tests/Feature/BindingVariablesTests.cs new file mode 100644 index 0000000000..5aa3e5f6c9 --- /dev/null +++ b/src/DotVVM.Samples.Tests/Feature/BindingVariablesTests.cs @@ -0,0 +1,67 @@ +using DotVVM.Samples.Tests.Base; +using DotVVM.Samples.Tests.Complex; +using DotVVM.Testing.Abstractions; +using Riganti.Selenium.Core; +using Riganti.Selenium.DotVVM; +using Xunit; +using Xunit.Abstractions; + +namespace DotVVM.Samples.Tests.Feature +{ + public class BindingVariablesTests : AppSeleniumTest + { + public BindingVariablesTests(ITestOutputHelper output) : base(output) + { + } + + [Fact] + public void Feature_BindingVariables_Simple() + { + RunInAllBrowsers(browser => { + browser.NavigateToUrl(SamplesRouteUrls.FeatureSamples_BindingVariables_StaticCommandVariablesWithService_Simple); + browser.WaitUntilDotvvmInited(); + browser.SelectMethod = SelectByDataUi; + + var button = browser.FirstOrDefault("get-messages"); + button.Click(); + + AssertUI.TextEquals(browser.FirstOrDefault("message1"), "test1"); + }); + } + + [Fact] + public void Feature_BindingVariables_ComplexObjectToObject() + { + RunInAllBrowsers(browser => { + browser.NavigateToUrl(SamplesRouteUrls.FeatureSamples_BindingVariables_StaticCommandVariablesWithService_Complex2); + browser.WaitUntilDotvvmInited(); + browser.SelectMethod = SelectByDataUi; + + + var button = browser.FirstOrDefault("get-messages"); + button.Click(); + + AssertUI.TextEquals(browser.FirstOrDefault("message1"), "test1"); + AssertUI.TextEquals(browser.FirstOrDefault("message2"), "test2"); + + }); + } + [Fact] + public void Feature_BindingVariables_ComplexPropsToProps() + { + RunInAllBrowsers(browser => { + browser.NavigateToUrl(SamplesRouteUrls.FeatureSamples_BindingVariables_StaticCommandVariablesWithService_Complex); + browser.WaitUntilDotvvmInited(); + browser.SelectMethod = SelectByDataUi; + + + var button = browser.FirstOrDefault("get-messages"); + button.Click(); + + AssertUI.TextEquals(browser.FirstOrDefault("message1"), "test1"); + AssertUI.TextEquals(browser.FirstOrDefault("message2"), "test2"); + + }); + } + } +} diff --git a/src/DotVVM.Testing.Abstractions/SamplesRouteUrls.designer.cs b/src/DotVVM.Testing.Abstractions/SamplesRouteUrls.designer.cs index 574b8b873d..400ab4b1ae 100644 --- a/src/DotVVM.Testing.Abstractions/SamplesRouteUrls.designer.cs +++ b/src/DotVVM.Testing.Abstractions/SamplesRouteUrls.designer.cs @@ -200,6 +200,9 @@ public partial class SamplesRouteUrls public const string FeatureSamples_BindingContexts_CollectionContext = "FeatureSamples/BindingContexts/CollectionContext"; public const string FeatureSamples_BindingNamespaces_BindingUsingNamespace = "FeatureSamples/BindingNamespaces/BindingUsingNamespace"; public const string FeatureSamples_BindingPageInfo_BindingPageInfo = "FeatureSamples/BindingPageInfo/BindingPageInfo"; + public const string FeatureSamples_BindingVariables_StaticCommandVariablesWithService_Complex = "FeatureSamples/BindingVariables/StaticCommandVariablesWithService_Complex"; + public const string FeatureSamples_BindingVariables_StaticCommandVariablesWithService_Complex2 = "FeatureSamples/BindingVariables/StaticCommandVariablesWithService_Complex2"; + public const string FeatureSamples_BindingVariables_StaticCommandVariablesWithService_Simple = "FeatureSamples/BindingVariables/StaticCommandVariablesWithService_Simple"; public const string FeatureSamples_Caching_CachedValues = "FeatureSamples/Caching/CachedValues"; public const string FeatureSamples_ChildViewModelInvokeMethods_ChildViewModelInvokeMethods = "FeatureSamples/ChildViewModelInvokeMethods/ChildViewModelInvokeMethods"; public const string FeatureSamples_ClientExtenders_PasswordStrength = "FeatureSamples/ClientExtenders/PasswordStrength"; @@ -225,6 +228,7 @@ public partial class SamplesRouteUrls public const string FeatureSamples_JavascriptEvents_JavascriptEvents = "FeatureSamples/JavascriptEvents/JavascriptEvents"; public const string FeatureSamples_JavascriptTranslation_DictionaryIndexerTranslation = "FeatureSamples/JavascriptTranslation/DictionaryIndexerTranslation"; public const string FeatureSamples_JavascriptTranslation_GenericMethodTranslation = "FeatureSamples/JavascriptTranslation/GenericMethodTranslation"; + public const string FeatureSamples_JavascriptTranslation_ListMethodTranslations = "FeatureSamples/JavascriptTranslation/ListMethodTranslations"; public const string FeatureSamples_JavascriptTranslation_MathMethodTranslation = "FeatureSamples/JavascriptTranslation/MathMethodTranslation"; public const string FeatureSamples_LambdaExpressions_ClientSideFiltering = "FeatureSamples/LambdaExpressions/ClientSideFiltering"; public const string FeatureSamples_LambdaExpressions_LambdaExpressions = "FeatureSamples/LambdaExpressions/LambdaExpressions"; diff --git a/src/DotVVM.Tools.StartupPerfTester/DotVVM.Tools.StartupPerfTester.csproj b/src/DotVVM.Tools.StartupPerfTester/DotVVM.Tools.StartupPerfTester.csproj index c3faf574af..2121dcb6d9 100644 --- a/src/DotVVM.Tools.StartupPerfTester/DotVVM.Tools.StartupPerfTester.csproj +++ b/src/DotVVM.Tools.StartupPerfTester/DotVVM.Tools.StartupPerfTester.csproj @@ -8,7 +8,7 @@ dotvvm-startup-perf true DotVVM.Tools.StartupPerf - 3.1.0-preview03-112034 + 3.1.0-preview05-final RIGANTI Command-line tool for measuring startup performance of DotVVM apps. false diff --git a/src/Templates/DotVVM.Templates.nuspec b/src/Templates/DotVVM.Templates.nuspec index 1edfa37684..f5d6c72c6a 100644 --- a/src/Templates/DotVVM.Templates.nuspec +++ b/src/Templates/DotVVM.Templates.nuspec @@ -2,7 +2,7 @@ DotVVM.Templates - 3.1.0-preview03-112034 + 3.1.0-preview05-final RIGANTI DotVVM Project Templates en-US