diff --git a/.eslintrc b/.eslintrc index fb1cac79df..df3566540c 100644 --- a/.eslintrc +++ b/.eslintrc @@ -8,6 +8,7 @@ "ignorePatterns": ["packages/ts/*/test/**/*.snap.ts"], "plugins": ["tsdoc"], "rules": { + "@typescript-eslint/no-invalid-void-type": "off", "@typescript-eslint/member-ordering": "off", "class-methods-use-this": "off", "import/no-duplicates": "off", diff --git a/packages/java/tests/gradle/single-module-tests/package-lock.json b/packages/java/tests/gradle/single-module-tests/package-lock.json index f275fea977..058a54e6ae 100644 --- a/packages/java/tests/gradle/single-module-tests/package-lock.json +++ b/packages/java/tests/gradle/single-module-tests/package-lock.json @@ -8,7 +8,7 @@ "license": "UNLICENSED", "dependencies": { "@hilla/form": "file:../../../../ts/form", - "@hilla/frontend": "../../../../ts/hilla-frontend", + "@hilla/frontend": "file:../../../../ts/frontend", "@hilla/generator-typescript-cli": "file:../../../../ts/generator-typescript-cli", "@hilla/generator-typescript-core": "file:../../../../ts/generator-typescript-core", "@hilla/generator-typescript-plugin-backbone": "file:../../../../ts/generator-typescript-plugin-backbone", @@ -65,7 +65,7 @@ }, "../../../../ts/form": { "name": "@hilla/form", - "version": "2.3.0-alpha1", + "version": "2.3.0-alpha5", "license": "Apache-2.0", "dependencies": { "@hilla/frontend": "*", @@ -88,12 +88,42 @@ "lit": "^2.3.0" } }, + "../../../../ts/frontend": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@vaadin/common-frontend": "^0.0.18", + "atmosphere.js": "^3.1.3", + "js-cookie": "^3.0.5" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@open-wc/testing": "^3.2.0", + "@types/atmosphere.js": "^2.1.3", + "@types/chai": "^4.3.5", + "@types/chai-as-promised": "^7.1.5", + "@types/js-cookie": "^3.0.3", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-as-promised": "^7.1.1", + "chai-dom": "^1.11.0", + "fetch-mock": "^9.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "lit": "^2.3.0" + } + }, "../../../../ts/generator-typescript-cli": { "name": "@hilla/generator-typescript-cli", - "version": "2.3.0-alpha1", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { - "@hilla/generator-typescript-utils": "^2.3.0-alpha1", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "get-stdin": "^9.0.0", "meow": "^12.1.0" }, @@ -101,7 +131,7 @@ "tsgen": "bin/index.js" }, "devDependencies": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/chai-as-promised": "^7.1.5", "@types/mocha": "^10.0.1", @@ -124,16 +154,16 @@ "node": ">= 16.13" }, "peerDependencies": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1" + "@hilla/generator-typescript-core": "^2.3.0-alpha5" } }, "../../../../ts/generator-typescript-core": { "name": "@hilla/generator-typescript-core", - "version": "2.3.0-alpha1", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { "@apidevtools/swagger-parser": "^10.1.0", - "@hilla/generator-typescript-utils": "^2.3.0-alpha1", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "meow": "^12.1.0", "openapi-types": "^12.1.3", "typescript": "^5.1.6" @@ -160,17 +190,17 @@ }, "../../../../ts/generator-typescript-plugin-backbone": { "name": "@hilla/generator-typescript-plugin-backbone", - "version": "2.3.0-alpha1", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { - "@hilla/generator-typescript-utils": "^2.3.0-alpha1", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "fast-deep-equal": "^3.1.3", "openapi-types": "^12.1.3", "typescript": "^5.1.6" }, "devDependencies": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1", - "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha1", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", "@types/node": "^20.5.0", @@ -191,21 +221,21 @@ "node": ">= 16.13" }, "peerDependencies": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1", - "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha1" + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha5" } }, "../../../../ts/generator-typescript-plugin-barrel": { "name": "@hilla/generator-typescript-plugin-barrel", - "version": "2.3.0-alpha1", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { - "@hilla/generator-typescript-utils": "^2.3.0-alpha1", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "typescript": "^5.1.6" }, "devDependencies": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1", - "@hilla/generator-typescript-plugin-backbone": "^2.3.0-alpha1", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-backbone": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", "@types/node": "^20.5.0", @@ -226,20 +256,20 @@ "node": ">= 16.13" }, "peerDependencies": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1", - "@hilla/generator-typescript-plugin-backbone": "^2.3.0-alpha1" + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-backbone": "^2.3.0-alpha5" } }, "../../../../ts/generator-typescript-plugin-client": { "name": "@hilla/generator-typescript-plugin-client", - "version": "2.3.0-alpha1", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { - "@hilla/generator-typescript-utils": "^2.3.0-alpha1", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "typescript": "^5.1.6" }, "devDependencies": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", "@types/node": "^20.5.0", @@ -260,22 +290,22 @@ "node": ">= 16.13" }, "peerDependencies": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1" + "@hilla/generator-typescript-core": "^2.3.0-alpha5" } }, "../../../../ts/generator-typescript-plugin-model": { "name": "@hilla/generator-typescript-plugin-model", - "version": "2.3.0-alpha1", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { - "@hilla/generator-typescript-utils": "^2.3.0-alpha1", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "fast-deep-equal": "^3.1.3", "openapi-types": "^12.1.3", "typescript": "^5.1.6" }, "devDependencies": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1", - "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha1", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", "@types/node": "^20.5.0", @@ -296,24 +326,24 @@ "node": ">= 16.13" }, "peerDependencies": { - "@hilla/form": "^2.3.0-alpha1", - "@hilla/generator-typescript-core": "^2.3.0-alpha1", - "@hilla/generator-typescript-plugin-backbone": "^2.3.0-alpha1" + "@hilla/form": "^2.3.0-alpha5", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-backbone": "^2.3.0-alpha5" } }, "../../../../ts/generator-typescript-plugin-push": { "name": "@hilla/generator-typescript-plugin-push", - "version": "2.3.0-alpha1", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { - "@hilla/generator-typescript-utils": "^2.3.0-alpha1", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "fast-deep-equal": "^3.1.3", "openapi-types": "^12.1.3", "typescript": "^5.1.6" }, "devDependencies": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1", - "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha1", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", "@types/node": "^20.5.0", @@ -334,13 +364,13 @@ "node": ">= 16.13" }, "peerDependencies": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1", - "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha1" + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha5" } }, "../../../../ts/generator-typescript-utils": { "name": "@hilla/generator-typescript-utils", - "version": "2.3.0-alpha1", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { "pino": "^8.15.0", @@ -399,7 +429,8 @@ } }, "../../../../ts/react-auth": { - "version": "2.2.0-beta1", + "name": "@hilla/react-auth", + "version": "2.3.0-alpha5", "license": "Apache-2.0", "dependencies": { "@hilla/frontend": "*" @@ -428,7 +459,7 @@ }, "../../../../ts/react-form": { "name": "@hilla/react-form", - "version": "2.3.0-alpha1", + "version": "2.3.0-alpha5", "license": "Apache-2.0", "dependencies": { "@hilla/form": "*" @@ -455,11 +486,11 @@ }, "../../../../ts/react-grid": { "name": "@hilla/react-grid", - "version": "2.3.0-alpha1", + "version": "2.3.0-alpha5", "license": "Apache-2.0", "dependencies": { "@hilla/form": "*", - "@hilla/react-components": "^2.1.7" + "@hilla/react-components": "2.2.0-alpha16" }, "devDependencies": { "@esm-bundle/chai": "^4.3.4-fix.0", @@ -2617,7 +2648,7 @@ "link": true }, "node_modules/@hilla/frontend": { - "resolved": "../../../../ts/hilla-frontend", + "resolved": "../../../../ts/frontend", "link": true }, "node_modules/@hilla/generator-typescript-cli": { @@ -10363,7 +10394,7 @@ } }, "@hilla/frontend": { - "version": "file:../../../../ts/hilla-frontend", + "version": "file:../../../../ts/frontend", "requires": { "@esm-bundle/chai": "^4.3.4-fix.0", "@open-wc/testing": "^3.2.0", @@ -10381,7 +10412,6 @@ "chai-dom": "^1.11.0", "fetch-mock": "^9.11.0", "js-cookie": "^3.0.5", - "rimraf": "^5.0.1", "sinon": "^15.2.0", "sinon-chai": "^3.7.0", "typescript": "^5.1.6" @@ -10390,8 +10420,8 @@ "@hilla/generator-typescript-cli": { "version": "file:../../../../ts/generator-typescript-cli", "requires": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1", - "@hilla/generator-typescript-utils": "^2.3.0-alpha1", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/chai-as-promised": "^7.1.5", "@types/mocha": "^10.0.1", @@ -10417,7 +10447,7 @@ "version": "file:../../../../ts/generator-typescript-core", "requires": { "@apidevtools/swagger-parser": "^10.1.0", - "@hilla/generator-typescript-utils": "^2.3.0-alpha1", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", "@types/node": "^20.5.0", @@ -10440,9 +10470,9 @@ "@hilla/generator-typescript-plugin-backbone": { "version": "file:../../../../ts/generator-typescript-plugin-backbone", "requires": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1", - "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha1", - "@hilla/generator-typescript-utils": "^2.3.0-alpha1", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha5", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", "@types/node": "^20.5.0", @@ -10466,9 +10496,9 @@ "@hilla/generator-typescript-plugin-barrel": { "version": "file:../../../../ts/generator-typescript-plugin-barrel", "requires": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1", - "@hilla/generator-typescript-plugin-backbone": "^2.3.0-alpha1", - "@hilla/generator-typescript-utils": "^2.3.0-alpha1", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-backbone": "^2.3.0-alpha5", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", "@types/node": "^20.5.0", @@ -10490,8 +10520,8 @@ "@hilla/generator-typescript-plugin-client": { "version": "file:../../../../ts/generator-typescript-plugin-client", "requires": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1", - "@hilla/generator-typescript-utils": "^2.3.0-alpha1", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", "@types/node": "^20.5.0", @@ -10513,9 +10543,9 @@ "@hilla/generator-typescript-plugin-model": { "version": "file:../../../../ts/generator-typescript-plugin-model", "requires": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1", - "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha1", - "@hilla/generator-typescript-utils": "^2.3.0-alpha1", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha5", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", "@types/node": "^20.5.0", @@ -10539,9 +10569,9 @@ "@hilla/generator-typescript-plugin-push": { "version": "file:../../../../ts/generator-typescript-plugin-push", "requires": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1", - "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha1", - "@hilla/generator-typescript-utils": "^2.3.0-alpha1", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha5", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", "@types/node": "^20.5.0", @@ -10718,7 +10748,7 @@ "requires": { "@esm-bundle/chai": "^4.3.4-fix.0", "@hilla/form": "*", - "@hilla/react-components": "^2.1.7", + "@hilla/react-components": "2.2.0-alpha16", "@testing-library/react": "^14.0.0", "@testing-library/user-event": "^14.4.3", "@types/chai": "^4.3.5", diff --git a/packages/java/tests/gradle/single-module-tests/package.json b/packages/java/tests/gradle/single-module-tests/package.json index fc2edda468..476740c727 100644 --- a/packages/java/tests/gradle/single-module-tests/package.json +++ b/packages/java/tests/gradle/single-module-tests/package.json @@ -3,7 +3,7 @@ "license": "UNLICENSED", "dependencies": { "@hilla/form": "file:../../../../ts/form", - "@hilla/frontend": "../../../../ts/hilla-frontend", + "@hilla/frontend": "file:../../../../ts/frontend", "@hilla/generator-typescript-cli": "file:../../../../ts/generator-typescript-cli", "@hilla/generator-typescript-core": "file:../../../../ts/generator-typescript-core", "@hilla/generator-typescript-plugin-backbone": "file:../../../../ts/generator-typescript-plugin-backbone", diff --git a/packages/java/tests/gradle/single-module/package-lock.json b/packages/java/tests/gradle/single-module/package-lock.json index aa3e06acbf..dba398d933 100644 --- a/packages/java/tests/gradle/single-module/package-lock.json +++ b/packages/java/tests/gradle/single-module/package-lock.json @@ -8,7 +8,7 @@ "license": "UNLICENSED", "dependencies": { "@hilla/form": "file:../../../../ts/form", - "@hilla/frontend": "../../../../ts/hilla-frontend", + "@hilla/frontend": "file:../../../../ts/frontend", "@hilla/generator-typescript-cli": "file:../../../../ts/generator-typescript-cli", "@hilla/generator-typescript-core": "file:../../../../ts/generator-typescript-core", "@hilla/generator-typescript-plugin-backbone": "file:../../../../ts/generator-typescript-plugin-backbone", @@ -21,6 +21,7 @@ "@hilla/react-auth": "file:../../../../ts/react-auth", "@hilla/react-components": "2.1.7", "@hilla/react-form": "file:../../../../ts/react-form", + "@hilla/react-grid": "file:../../../../ts/react-grid", "@polymer/polymer": "3.5.1", "@vaadin-component-factory/vcf-nav": "1.1.0", "@vaadin/bundles": "24.1.7", @@ -57,7 +58,7 @@ }, "../../../../ts/form": { "name": "@hilla/form", - "version": "2.3.0-alpha1", + "version": "2.3.0-alpha5", "license": "Apache-2.0", "dependencies": { "@hilla/frontend": "*", @@ -80,12 +81,42 @@ "lit": "^2.3.0" } }, + "../../../../ts/frontend": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@vaadin/common-frontend": "^0.0.18", + "atmosphere.js": "^3.1.3", + "js-cookie": "^3.0.5" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@open-wc/testing": "^3.2.0", + "@types/atmosphere.js": "^2.1.3", + "@types/chai": "^4.3.5", + "@types/chai-as-promised": "^7.1.5", + "@types/js-cookie": "^3.0.3", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-as-promised": "^7.1.1", + "chai-dom": "^1.11.0", + "fetch-mock": "^9.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "lit": "^2.3.0" + } + }, "../../../../ts/generator-typescript-cli": { "name": "@hilla/generator-typescript-cli", - "version": "2.3.0-alpha1", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { - "@hilla/generator-typescript-utils": "^2.3.0-alpha1", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "get-stdin": "^9.0.0", "meow": "^12.1.0" }, @@ -93,7 +124,7 @@ "tsgen": "bin/index.js" }, "devDependencies": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/chai-as-promised": "^7.1.5", "@types/mocha": "^10.0.1", @@ -116,16 +147,16 @@ "node": ">= 16.13" }, "peerDependencies": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1" + "@hilla/generator-typescript-core": "^2.3.0-alpha5" } }, "../../../../ts/generator-typescript-core": { "name": "@hilla/generator-typescript-core", - "version": "2.3.0-alpha1", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { "@apidevtools/swagger-parser": "^10.1.0", - "@hilla/generator-typescript-utils": "^2.3.0-alpha1", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "meow": "^12.1.0", "openapi-types": "^12.1.3", "typescript": "^5.1.6" @@ -152,17 +183,17 @@ }, "../../../../ts/generator-typescript-plugin-backbone": { "name": "@hilla/generator-typescript-plugin-backbone", - "version": "2.3.0-alpha1", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { - "@hilla/generator-typescript-utils": "^2.3.0-alpha1", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "fast-deep-equal": "^3.1.3", "openapi-types": "^12.1.3", "typescript": "^5.1.6" }, "devDependencies": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1", - "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha1", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", "@types/node": "^20.5.0", @@ -183,21 +214,21 @@ "node": ">= 16.13" }, "peerDependencies": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1", - "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha1" + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha5" } }, "../../../../ts/generator-typescript-plugin-barrel": { "name": "@hilla/generator-typescript-plugin-barrel", - "version": "2.3.0-alpha1", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { - "@hilla/generator-typescript-utils": "^2.3.0-alpha1", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "typescript": "^5.1.6" }, "devDependencies": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1", - "@hilla/generator-typescript-plugin-backbone": "^2.3.0-alpha1", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-backbone": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", "@types/node": "^20.5.0", @@ -218,20 +249,20 @@ "node": ">= 16.13" }, "peerDependencies": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1", - "@hilla/generator-typescript-plugin-backbone": "^2.3.0-alpha1" + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-backbone": "^2.3.0-alpha5" } }, "../../../../ts/generator-typescript-plugin-client": { "name": "@hilla/generator-typescript-plugin-client", - "version": "2.3.0-alpha1", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { - "@hilla/generator-typescript-utils": "^2.3.0-alpha1", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "typescript": "^5.1.6" }, "devDependencies": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", "@types/node": "^20.5.0", @@ -252,22 +283,22 @@ "node": ">= 16.13" }, "peerDependencies": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1" + "@hilla/generator-typescript-core": "^2.3.0-alpha5" } }, "../../../../ts/generator-typescript-plugin-model": { "name": "@hilla/generator-typescript-plugin-model", - "version": "2.3.0-alpha1", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { - "@hilla/generator-typescript-utils": "^2.3.0-alpha1", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "fast-deep-equal": "^3.1.3", "openapi-types": "^12.1.3", "typescript": "^5.1.6" }, "devDependencies": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1", - "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha1", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", "@types/node": "^20.5.0", @@ -288,24 +319,24 @@ "node": ">= 16.13" }, "peerDependencies": { - "@hilla/form": "^2.3.0-alpha1", - "@hilla/generator-typescript-core": "^2.3.0-alpha1", - "@hilla/generator-typescript-plugin-backbone": "^2.3.0-alpha1" + "@hilla/form": "^2.3.0-alpha5", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-backbone": "^2.3.0-alpha5" } }, "../../../../ts/generator-typescript-plugin-push": { "name": "@hilla/generator-typescript-plugin-push", - "version": "2.3.0-alpha1", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { - "@hilla/generator-typescript-utils": "^2.3.0-alpha1", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "fast-deep-equal": "^3.1.3", "openapi-types": "^12.1.3", "typescript": "^5.1.6" }, "devDependencies": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1", - "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha1", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", "@types/node": "^20.5.0", @@ -326,13 +357,13 @@ "node": ">= 16.13" }, "peerDependencies": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1", - "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha1" + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha5" } }, "../../../../ts/generator-typescript-utils": { "name": "@hilla/generator-typescript-utils", - "version": "2.3.0-alpha1", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { "pino": "^8.15.0", @@ -393,7 +424,7 @@ }, "../../../../ts/react-auth": { "name": "@hilla/react-auth", - "version": "2.2.0-beta1", + "version": "2.3.0-alpha5", "license": "Apache-2.0", "dependencies": { "@hilla/frontend": "*" @@ -422,7 +453,7 @@ }, "../../../../ts/react-form": { "name": "@hilla/react-form", - "version": "2.3.0-alpha1", + "version": "2.3.0-alpha5", "license": "Apache-2.0", "dependencies": { "@hilla/form": "*" @@ -450,7 +481,6 @@ "../../../../ts/react-grid": { "name": "@hilla/react-grid", "version": "2.3.0-alpha1", - "extraneous": true, "license": "Apache-2.0", "dependencies": { "@hilla/form": "*", @@ -2612,7 +2642,7 @@ "link": true }, "node_modules/@hilla/frontend": { - "resolved": "../../../../ts/hilla-frontend", + "resolved": "../../../../ts/frontend", "link": true }, "node_modules/@hilla/generator-typescript-cli": { @@ -2737,6 +2767,10 @@ "resolved": "../../../../ts/react-form", "link": true }, + "node_modules/@hilla/react-grid": { + "resolved": "../../../../ts/react-grid", + "link": true + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz", @@ -10376,7 +10410,7 @@ } }, "@hilla/frontend": { - "version": "file:../../../../ts/hilla-frontend", + "version": "file:../../../../ts/frontend", "requires": { "@esm-bundle/chai": "^4.3.4-fix.0", "@open-wc/testing": "^3.2.0", @@ -10394,7 +10428,6 @@ "chai-dom": "^1.11.0", "fetch-mock": "^9.11.0", "js-cookie": "^3.0.5", - "rimraf": "^5.0.1", "sinon": "^15.2.0", "sinon-chai": "^3.7.0", "typescript": "^5.1.6" @@ -10403,8 +10436,8 @@ "@hilla/generator-typescript-cli": { "version": "file:../../../../ts/generator-typescript-cli", "requires": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1", - "@hilla/generator-typescript-utils": "^2.3.0-alpha1", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/chai-as-promised": "^7.1.5", "@types/mocha": "^10.0.1", @@ -10430,7 +10463,7 @@ "version": "file:../../../../ts/generator-typescript-core", "requires": { "@apidevtools/swagger-parser": "^10.1.0", - "@hilla/generator-typescript-utils": "^2.3.0-alpha1", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", "@types/node": "^20.5.0", @@ -10453,9 +10486,9 @@ "@hilla/generator-typescript-plugin-backbone": { "version": "file:../../../../ts/generator-typescript-plugin-backbone", "requires": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1", - "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha1", - "@hilla/generator-typescript-utils": "^2.3.0-alpha1", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha5", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", "@types/node": "^20.5.0", @@ -10479,9 +10512,9 @@ "@hilla/generator-typescript-plugin-barrel": { "version": "file:../../../../ts/generator-typescript-plugin-barrel", "requires": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1", - "@hilla/generator-typescript-plugin-backbone": "^2.3.0-alpha1", - "@hilla/generator-typescript-utils": "^2.3.0-alpha1", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-backbone": "^2.3.0-alpha5", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", "@types/node": "^20.5.0", @@ -10503,8 +10536,8 @@ "@hilla/generator-typescript-plugin-client": { "version": "file:../../../../ts/generator-typescript-plugin-client", "requires": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1", - "@hilla/generator-typescript-utils": "^2.3.0-alpha1", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", "@types/node": "^20.5.0", @@ -10526,9 +10559,9 @@ "@hilla/generator-typescript-plugin-model": { "version": "file:../../../../ts/generator-typescript-plugin-model", "requires": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1", - "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha1", - "@hilla/generator-typescript-utils": "^2.3.0-alpha1", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha5", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", "@types/node": "^20.5.0", @@ -10552,9 +10585,9 @@ "@hilla/generator-typescript-plugin-push": { "version": "file:../../../../ts/generator-typescript-plugin-push", "requires": { - "@hilla/generator-typescript-core": "^2.3.0-alpha1", - "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha1", - "@hilla/generator-typescript-utils": "^2.3.0-alpha1", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha5", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", "@types/node": "^20.5.0", @@ -10726,6 +10759,27 @@ "typescript": "^5.1.6" } }, + "@hilla/react-grid": { + "version": "file:../../../../ts/react-grid", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/form": "*", + "@hilla/react-components": "^2.1.7", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + } + }, "@jridgewell/gen-mapping": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz", diff --git a/packages/java/tests/gradle/single-module/package.json b/packages/java/tests/gradle/single-module/package.json index 48d5ab820c..16cb25325b 100644 --- a/packages/java/tests/gradle/single-module/package.json +++ b/packages/java/tests/gradle/single-module/package.json @@ -3,7 +3,7 @@ "license": "UNLICENSED", "dependencies": { "@hilla/form": "file:../../../../ts/form", - "@hilla/frontend": "../../../../ts/hilla-frontend", + "@hilla/frontend": "file:../../../../ts/frontend", "@hilla/generator-typescript-cli": "file:../../../../ts/generator-typescript-cli", "@hilla/generator-typescript-core": "file:../../../../ts/generator-typescript-core", "@hilla/generator-typescript-plugin-backbone": "file:../../../../ts/generator-typescript-plugin-backbone", @@ -16,6 +16,7 @@ "@hilla/react-auth": "file:../../../../ts/react-auth", "@hilla/react-components": "2.1.7", "@hilla/react-form": "file:../../../../ts/react-form", + "@hilla/react-grid": "file:../../../../ts/react-grid", "@polymer/polymer": "3.5.1", "@vaadin-component-factory/vcf-nav": "1.1.0", "@vaadin/bundles": "24.1.7", diff --git a/packages/java/tests/spring/endpoints discovery/package-lock.json b/packages/java/tests/spring/endpoints discovery/package-lock.json index dd06c6edb7..dcb65c6d1a 100644 --- a/packages/java/tests/spring/endpoints discovery/package-lock.json +++ b/packages/java/tests/spring/endpoints discovery/package-lock.json @@ -7,16 +7,19 @@ "name": "no-name", "license": "UNLICENSED", "dependencies": { - "@hilla/form": "2.3.0-alpha5", - "@hilla/frontend": "../../../../ts/hilla-frontend", - "@hilla/generator-typescript-cli": "../../../../ts/generator-typescript-cli", - "@hilla/generator-typescript-core": "../../../../ts/generator-typescript-core", - "@hilla/generator-typescript-plugin-backbone": "../../../../ts/generator-typescript-plugin-backbone", - "@hilla/generator-typescript-plugin-barrel": "../../../../ts/generator-typescript-plugin-barrel", - "@hilla/generator-typescript-plugin-client": "../../../../ts/generator-typescript-plugin-client", - "@hilla/generator-typescript-plugin-model": "../../../../ts/generator-typescript-plugin-model", - "@hilla/generator-typescript-plugin-push": "../../../../ts/generator-typescript-plugin-push", - "@hilla/generator-typescript-utils": "../../../../ts/generator-typescript-utils", + "@hilla/form": "file:../../../../ts/form", + "@hilla/frontend": "file:../../../../ts/frontend", + "@hilla/generator-typescript-cli": "file:../../../../ts/generator-typescript-cli", + "@hilla/generator-typescript-core": "file:../../../../ts/generator-typescript-core", + "@hilla/generator-typescript-plugin-backbone": "file:../../../../ts/generator-typescript-plugin-backbone", + "@hilla/generator-typescript-plugin-barrel": "file:../../../../ts/generator-typescript-plugin-barrel", + "@hilla/generator-typescript-plugin-client": "file:../../../../ts/generator-typescript-plugin-client", + "@hilla/generator-typescript-plugin-model": "file:../../../../ts/generator-typescript-plugin-model", + "@hilla/generator-typescript-plugin-push": "file:../../../../ts/generator-typescript-plugin-push", + "@hilla/generator-typescript-utils": "file:../../../../ts/generator-typescript-utils", + "@hilla/react-auth": "file:../../../../ts/react-auth", + "@hilla/react-form": "file:../../../../ts/react-form", + "@hilla/react-grid": "file:../../../../ts/react-grid", "@polymer/polymer": "3.5.1", "@vaadin/a11y-base": "24.2.0-alpha16", "@vaadin/accordion": "24.2.0-alpha16", @@ -111,7 +114,6 @@ "../../../../ts/form": { "name": "@hilla/form", "version": "2.3.0-alpha5", - "extraneous": true, "license": "Apache-2.0", "dependencies": { "@hilla/frontend": "*", @@ -134,6 +136,37 @@ "lit": "^2.3.0" } }, + "../../../../ts/frontend": { + "name": "@hilla/frontend", + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@vaadin/common-frontend": "^0.0.18", + "atmosphere.js": "^3.1.3", + "js-cookie": "^3.0.5" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@open-wc/testing": "^3.2.0", + "@types/atmosphere.js": "^2.1.3", + "@types/chai": "^4.3.5", + "@types/chai-as-promised": "^7.1.5", + "@types/js-cookie": "^3.0.3", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-as-promised": "^7.1.1", + "chai-dom": "^1.11.0", + "fetch-mock": "^9.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "lit": "^2.3.0" + } + }, "../../../../ts/generator-typescript-cli": { "name": "@hilla/generator-typescript-cli", "version": "2.3.0-alpha5", @@ -416,6 +449,7 @@ "../../../../ts/hilla-frontend": { "name": "@hilla/frontend", "version": "2.1.0-alpha4", + "extraneous": true, "license": "Apache-2.0", "dependencies": { "@vaadin/common-frontend": "^0.0.12", @@ -442,6 +476,90 @@ "lit": "^2.3.0" } }, + "../../../../ts/react-auth": { + "name": "@hilla/react-auth", + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/frontend": "*" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "react-router-dom": "^6.16.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18", + "react-router-dom": "^6" + } + }, + "../../../../ts/react-form": { + "name": "@hilla/react-form", + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/form": "*" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18" + } + }, + "../../../../ts/react-grid": { + "name": "@hilla/react-grid", + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/form": "*", + "@hilla/react-components": "2.2.0-alpha16" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18" + } + }, "node_modules/@ampproject/remapping": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", @@ -2714,19 +2832,11 @@ } }, "node_modules/@hilla/form": { - "version": "2.3.0-alpha5", - "resolved": "https://registry.npmjs.org/@hilla/form/-/form-2.3.0-alpha5.tgz", - "integrity": "sha512-ZFRx+Fd/qXBNB/mGN0yTH/VHgq3t661sUor4qdRQx7mWPrsImqw3TJ89eNVeVo7tXRyGy5kP7HKzVPVYze32bA==", - "dependencies": { - "@hilla/frontend": "*", - "validator": "^13.11.0" - }, - "peerDependencies": { - "lit": "^2.3.0" - } + "resolved": "../../../../ts/form", + "link": true }, "node_modules/@hilla/frontend": { - "resolved": "../../../../ts/hilla-frontend", + "resolved": "../../../../ts/frontend", "link": true }, "node_modules/@hilla/generator-typescript-cli": { @@ -2761,6 +2871,18 @@ "resolved": "../../../../ts/generator-typescript-utils", "link": true }, + "node_modules/@hilla/react-auth": { + "resolved": "../../../../ts/react-auth", + "link": true + }, + "node_modules/@hilla/react-form": { + "resolved": "../../../../ts/react-form", + "link": true + }, + "node_modules/@hilla/react-grid": { + "resolved": "../../../../ts/react-grid", + "link": true + }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -7545,14 +7667,6 @@ "punycode": "^2.1.0" } }, - "node_modules/validator": { - "version": "13.11.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-13.11.0.tgz", - "integrity": "sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ==", - "engines": { - "node": ">= 0.10" - } - }, "node_modules/vite": { "version": "4.4.9", "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz", @@ -10004,34 +10118,45 @@ "optional": true }, "@hilla/form": { - "version": "2.3.0-alpha5", - "resolved": "https://registry.npmjs.org/@hilla/form/-/form-2.3.0-alpha5.tgz", - "integrity": "sha512-ZFRx+Fd/qXBNB/mGN0yTH/VHgq3t661sUor4qdRQx7mWPrsImqw3TJ89eNVeVo7tXRyGy5kP7HKzVPVYze32bA==", + "version": "file:../../../../ts/form", "requires": { - "@hilla/frontend": "../../../../ts/hilla-frontend", + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/frontend": "*", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6", "validator": "^13.11.0" } }, "@hilla/frontend": { - "version": "file:../../../../ts/hilla-frontend", + "version": "file:../../../../ts/frontend", "requires": { "@esm-bundle/chai": "^4.3.4-fix.0", - "@open-wc/testing": "^2.5.33", - "@types/chai": "^4.2.21", + "@open-wc/testing": "^3.2.0", + "@types/atmosphere.js": "^2.1.3", + "@types/chai": "^4.3.5", + "@types/chai-as-promised": "^7.1.5", "@types/js-cookie": "^3.0.3", - "@types/mocha": "^9.0.0", - "@types/sinon": "^10.0.2", - "@types/sinon-chai": "^3.2.5", - "@types/validator": "^13.6.3", - "@vaadin/common-frontend": "^0.0.12", - "a-atmosphere-javascript": "3.1.3-2", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "@vaadin/common-frontend": "^0.0.18", + "atmosphere.js": "^3.1.3", + "chai-as-promised": "^7.1.1", "chai-dom": "^1.11.0", "fetch-mock": "^9.11.0", - "js-cookie": "^3.0.1", - "rimraf": "^3.0.2", - "sinon": "^11.1.2", + "js-cookie": "^3.0.5", + "sinon": "^15.2.0", "sinon-chai": "^3.7.0", - "typescript": "^5.0.1-rc" + "typescript": "^5.1.6" } }, "@hilla/generator-typescript-cli": { @@ -10231,6 +10356,68 @@ "typescript": "^5.1.6" } }, + "@hilla/react-auth": { + "version": "file:../../../../ts/react-auth", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/frontend": "*", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "react-router-dom": "^6.16.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + } + }, + "@hilla/react-form": { + "version": "file:../../../../ts/react-form", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/form": "*", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + } + }, + "@hilla/react-grid": { + "version": "file:../../../../ts/react-grid", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/form": "*", + "@hilla/react-components": "2.2.0-alpha16", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + } + }, "@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -13758,11 +13945,6 @@ "punycode": "^2.1.0" } }, - "validator": { - "version": "13.11.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-13.11.0.tgz", - "integrity": "sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ==" - }, "vite": { "version": "4.4.9", "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz", diff --git a/packages/java/tests/spring/endpoints discovery/package.json b/packages/java/tests/spring/endpoints discovery/package.json index 441ee61c96..2320a4ef81 100644 --- a/packages/java/tests/spring/endpoints discovery/package.json +++ b/packages/java/tests/spring/endpoints discovery/package.json @@ -3,16 +3,19 @@ "license": "UNLICENSED", "type": "module", "dependencies": { - "@hilla/form": "2.3.0-alpha5", - "@hilla/frontend": "../../../../ts/hilla-frontend", - "@hilla/generator-typescript-cli": "../../../../ts/generator-typescript-cli", - "@hilla/generator-typescript-core": "../../../../ts/generator-typescript-core", - "@hilla/generator-typescript-plugin-backbone": "../../../../ts/generator-typescript-plugin-backbone", - "@hilla/generator-typescript-plugin-barrel": "../../../../ts/generator-typescript-plugin-barrel", - "@hilla/generator-typescript-plugin-client": "../../../../ts/generator-typescript-plugin-client", - "@hilla/generator-typescript-plugin-model": "../../../../ts/generator-typescript-plugin-model", - "@hilla/generator-typescript-plugin-push": "../../../../ts/generator-typescript-plugin-push", - "@hilla/generator-typescript-utils": "../../../../ts/generator-typescript-utils", + "@hilla/form": "file:../../../../ts/form", + "@hilla/frontend": "file:../../../../ts/frontend", + "@hilla/generator-typescript-cli": "file:../../../../ts/generator-typescript-cli", + "@hilla/generator-typescript-core": "file:../../../../ts/generator-typescript-core", + "@hilla/generator-typescript-plugin-backbone": "file:../../../../ts/generator-typescript-plugin-backbone", + "@hilla/generator-typescript-plugin-barrel": "file:../../../../ts/generator-typescript-plugin-barrel", + "@hilla/generator-typescript-plugin-client": "file:../../../../ts/generator-typescript-plugin-client", + "@hilla/generator-typescript-plugin-model": "file:../../../../ts/generator-typescript-plugin-model", + "@hilla/generator-typescript-plugin-push": "file:../../../../ts/generator-typescript-plugin-push", + "@hilla/generator-typescript-utils": "file:../../../../ts/generator-typescript-utils", + "@hilla/react-auth": "file:../../../../ts/react-auth", + "@hilla/react-form": "file:../../../../ts/react-form", + "@hilla/react-grid": "file:../../../../ts/react-grid", "@polymer/polymer": "3.5.1", "@vaadin/a11y-base": "24.2.0-alpha16", "@vaadin/accordion": "24.2.0-alpha16", @@ -205,7 +208,7 @@ "workbox-core": "7.0.0", "workbox-precaching": "7.0.0" }, - "hash": "59abee59e375f62daa0b7ff8be48faf218271fb72df78af36363c4cc91f44332" + "hash": "3ecb2a323a0d89381773d8b597dd8ec5378ff0afca6a2b4331fa28b0a76dd54a" }, "overrides": { "@vaadin/common-frontend": "$@vaadin/common-frontend", diff --git a/packages/java/tests/spring/endpoints-contextpath/package-lock.json b/packages/java/tests/spring/endpoints-contextpath/package-lock.json index bbeaae860d..290c406332 100644 --- a/packages/java/tests/spring/endpoints-contextpath/package-lock.json +++ b/packages/java/tests/spring/endpoints-contextpath/package-lock.json @@ -7,16 +7,19 @@ "name": "no-name", "license": "UNLICENSED", "dependencies": { - "@hilla/form": "2.3.0-alpha5", - "@hilla/frontend": "../../../../ts/hilla-frontend", - "@hilla/generator-typescript-cli": "../../../../ts/generator-typescript-cli", - "@hilla/generator-typescript-core": "../../../../ts/generator-typescript-core", - "@hilla/generator-typescript-plugin-backbone": "../../../../ts/generator-typescript-plugin-backbone", - "@hilla/generator-typescript-plugin-barrel": "../../../../ts/generator-typescript-plugin-barrel", - "@hilla/generator-typescript-plugin-client": "../../../../ts/generator-typescript-plugin-client", - "@hilla/generator-typescript-plugin-model": "../../../../ts/generator-typescript-plugin-model", - "@hilla/generator-typescript-plugin-push": "../../../../ts/generator-typescript-plugin-push", - "@hilla/generator-typescript-utils": "../../../../ts/generator-typescript-utils", + "@hilla/form": "file:../../../../ts/form", + "@hilla/frontend": "file:../../../../ts/frontend", + "@hilla/generator-typescript-cli": "file:../../../../ts/generator-typescript-cli", + "@hilla/generator-typescript-core": "file:../../../../ts/generator-typescript-core", + "@hilla/generator-typescript-plugin-backbone": "file:../../../../ts/generator-typescript-plugin-backbone", + "@hilla/generator-typescript-plugin-barrel": "file:../../../../ts/generator-typescript-plugin-barrel", + "@hilla/generator-typescript-plugin-client": "file:../../../../ts/generator-typescript-plugin-client", + "@hilla/generator-typescript-plugin-model": "file:../../../../ts/generator-typescript-plugin-model", + "@hilla/generator-typescript-plugin-push": "file:../../../../ts/generator-typescript-plugin-push", + "@hilla/generator-typescript-utils": "file:../../../../ts/generator-typescript-utils", + "@hilla/react-auth": "file:../../../../ts/react-auth", + "@hilla/react-form": "file:../../../../ts/react-form", + "@hilla/react-grid": "file:../../../../ts/react-grid", "@polymer/polymer": "3.5.1", "@vaadin/a11y-base": "24.2.0-alpha16", "@vaadin/accordion": "24.2.0-alpha16", @@ -111,7 +114,6 @@ "../../../../ts/form": { "name": "@hilla/form", "version": "2.2.0-beta1", - "extraneous": true, "license": "Apache-2.0", "dependencies": { "@hilla/frontend": "*", @@ -135,6 +137,36 @@ "lit": "^2.3.0" } }, + "../../../../ts/frontend": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@vaadin/common-frontend": "^0.0.18", + "atmosphere.js": "^3.1.3", + "js-cookie": "^3.0.5" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@open-wc/testing": "^3.2.0", + "@types/atmosphere.js": "^2.1.3", + "@types/chai": "^4.3.5", + "@types/chai-as-promised": "^7.1.5", + "@types/js-cookie": "^3.0.3", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-as-promised": "^7.1.1", + "chai-dom": "^1.11.0", + "fetch-mock": "^9.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "lit": "^2.3.0" + } + }, "../../../../ts/generator-typescript-cli": { "name": "@hilla/generator-typescript-cli", "version": "2.3.0-alpha5", @@ -417,6 +449,7 @@ "../../../../ts/hilla-frontend": { "name": "@hilla/frontend", "version": "2.2.0-beta1", + "extraneous": true, "license": "Apache-2.0", "dependencies": { "@vaadin/common-frontend": "^0.0.18", @@ -446,6 +479,87 @@ "lit": "^2.3.0" } }, + "../../../../ts/react-auth": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/frontend": "*" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "react-router-dom": "^6.16.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18", + "react-router-dom": "^6" + } + }, + "../../../../ts/react-form": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/form": "*" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18" + } + }, + "../../../../ts/react-grid": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/form": "*", + "@hilla/react-components": "2.2.0-alpha16" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18" + } + }, "node_modules/@ampproject/remapping": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", @@ -2718,19 +2832,11 @@ } }, "node_modules/@hilla/form": { - "version": "2.3.0-alpha5", - "resolved": "https://registry.npmjs.org/@hilla/form/-/form-2.3.0-alpha5.tgz", - "integrity": "sha512-ZFRx+Fd/qXBNB/mGN0yTH/VHgq3t661sUor4qdRQx7mWPrsImqw3TJ89eNVeVo7tXRyGy5kP7HKzVPVYze32bA==", - "dependencies": { - "@hilla/frontend": "*", - "validator": "^13.11.0" - }, - "peerDependencies": { - "lit": "^2.3.0" - } + "resolved": "../../../../ts/form", + "link": true }, "node_modules/@hilla/frontend": { - "resolved": "../../../../ts/hilla-frontend", + "resolved": "../../../../ts/frontend", "link": true }, "node_modules/@hilla/generator-typescript-cli": { @@ -2765,6 +2871,18 @@ "resolved": "../../../../ts/generator-typescript-utils", "link": true }, + "node_modules/@hilla/react-auth": { + "resolved": "../../../../ts/react-auth", + "link": true + }, + "node_modules/@hilla/react-form": { + "resolved": "../../../../ts/react-form", + "link": true + }, + "node_modules/@hilla/react-grid": { + "resolved": "../../../../ts/react-grid", + "link": true + }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -7516,14 +7634,6 @@ "punycode": "^2.1.0" } }, - "node_modules/validator": { - "version": "13.11.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-13.11.0.tgz", - "integrity": "sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ==", - "engines": { - "node": ">= 0.10" - } - }, "node_modules/vite": { "version": "4.4.9", "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz", @@ -9929,16 +10039,26 @@ "optional": true }, "@hilla/form": { - "version": "2.3.0-alpha5", - "resolved": "https://registry.npmjs.org/@hilla/form/-/form-2.3.0-alpha5.tgz", - "integrity": "sha512-ZFRx+Fd/qXBNB/mGN0yTH/VHgq3t661sUor4qdRQx7mWPrsImqw3TJ89eNVeVo7tXRyGy5kP7HKzVPVYze32bA==", + "version": "file:../../../../ts/form", "requires": { - "@hilla/frontend": "../../../../ts/hilla-frontend", + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/frontend": "*", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "rimraf": "^5.0.1", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6", "validator": "^13.11.0" } }, "@hilla/frontend": { - "version": "file:../../../../ts/hilla-frontend", + "version": "file:../../../../ts/frontend", "requires": { "@esm-bundle/chai": "^4.3.4-fix.0", "@open-wc/testing": "^3.2.0", @@ -9956,7 +10076,6 @@ "chai-dom": "^1.11.0", "fetch-mock": "^9.11.0", "js-cookie": "^3.0.5", - "rimraf": "^5.0.1", "sinon": "^15.2.0", "sinon-chai": "^3.7.0", "typescript": "^5.1.6" @@ -10159,6 +10278,68 @@ "typescript": "^5.1.6" } }, + "@hilla/react-auth": { + "version": "file:../../../../ts/react-auth", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/frontend": "*", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "react-router-dom": "^6.16.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + } + }, + "@hilla/react-form": { + "version": "file:../../../../ts/react-form", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/form": "*", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + } + }, + "@hilla/react-grid": { + "version": "file:../../../../ts/react-grid", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/form": "*", + "@hilla/react-components": "2.2.0-alpha16", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + } + }, "@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -13662,11 +13843,6 @@ "punycode": "^2.1.0" } }, - "validator": { - "version": "13.11.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-13.11.0.tgz", - "integrity": "sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ==" - }, "vite": { "version": "4.4.9", "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz", diff --git a/packages/java/tests/spring/endpoints-contextpath/package.json b/packages/java/tests/spring/endpoints-contextpath/package.json index 441ee61c96..ed8a625eef 100644 --- a/packages/java/tests/spring/endpoints-contextpath/package.json +++ b/packages/java/tests/spring/endpoints-contextpath/package.json @@ -3,16 +3,19 @@ "license": "UNLICENSED", "type": "module", "dependencies": { - "@hilla/form": "2.3.0-alpha5", - "@hilla/frontend": "../../../../ts/hilla-frontend", - "@hilla/generator-typescript-cli": "../../../../ts/generator-typescript-cli", - "@hilla/generator-typescript-core": "../../../../ts/generator-typescript-core", - "@hilla/generator-typescript-plugin-backbone": "../../../../ts/generator-typescript-plugin-backbone", - "@hilla/generator-typescript-plugin-barrel": "../../../../ts/generator-typescript-plugin-barrel", - "@hilla/generator-typescript-plugin-client": "../../../../ts/generator-typescript-plugin-client", - "@hilla/generator-typescript-plugin-model": "../../../../ts/generator-typescript-plugin-model", - "@hilla/generator-typescript-plugin-push": "../../../../ts/generator-typescript-plugin-push", - "@hilla/generator-typescript-utils": "../../../../ts/generator-typescript-utils", + "@hilla/form": "file:../../../../ts/form", + "@hilla/frontend": "file:../../../../ts/frontend", + "@hilla/generator-typescript-cli": "file:../../../../ts/generator-typescript-cli", + "@hilla/generator-typescript-core": "file:../../../../ts/generator-typescript-core", + "@hilla/generator-typescript-plugin-backbone": "file:../../../../ts/generator-typescript-plugin-backbone", + "@hilla/generator-typescript-plugin-barrel": "file:../../../../ts/generator-typescript-plugin-barrel", + "@hilla/generator-typescript-plugin-client": "file:../../../../ts/generator-typescript-plugin-client", + "@hilla/generator-typescript-plugin-model": "file:../../../../ts/generator-typescript-plugin-model", + "@hilla/generator-typescript-plugin-push": "file:../../../../ts/generator-typescript-plugin-push", + "@hilla/generator-typescript-utils": "file:../../../../ts/generator-typescript-utils", + "@hilla/react-auth": "file:../../../../ts/react-auth", + "@hilla/react-form": "file:../../../../ts/react-form", + "@hilla/react-grid": "file:../../../../ts/react-grid", "@polymer/polymer": "3.5.1", "@vaadin/a11y-base": "24.2.0-alpha16", "@vaadin/accordion": "24.2.0-alpha16", diff --git a/packages/java/tests/spring/endpoints-custom-client/package-lock.json b/packages/java/tests/spring/endpoints-custom-client/package-lock.json index d69e8399fe..29821540d4 100644 --- a/packages/java/tests/spring/endpoints-custom-client/package-lock.json +++ b/packages/java/tests/spring/endpoints-custom-client/package-lock.json @@ -7,16 +7,19 @@ "name": "no-name", "license": "UNLICENSED", "dependencies": { - "@hilla/form": "2.3.0-alpha5", - "@hilla/frontend": "../../../../ts/hilla-frontend", - "@hilla/generator-typescript-cli": "../../../../ts/generator-typescript-cli", - "@hilla/generator-typescript-core": "../../../../ts/generator-typescript-core", - "@hilla/generator-typescript-plugin-backbone": "../../../../ts/generator-typescript-plugin-backbone", - "@hilla/generator-typescript-plugin-barrel": "../../../../ts/generator-typescript-plugin-barrel", - "@hilla/generator-typescript-plugin-client": "../../../../ts/generator-typescript-plugin-client", - "@hilla/generator-typescript-plugin-model": "../../../../ts/generator-typescript-plugin-model", - "@hilla/generator-typescript-plugin-push": "../../../../ts/generator-typescript-plugin-push", - "@hilla/generator-typescript-utils": "../../../../ts/generator-typescript-utils", + "@hilla/form": "file:../../../../ts/form", + "@hilla/frontend": "file:../../../../ts/frontend", + "@hilla/generator-typescript-cli": "file:../../../../ts/generator-typescript-cli", + "@hilla/generator-typescript-core": "file:../../../../ts/generator-typescript-core", + "@hilla/generator-typescript-plugin-backbone": "file:../../../../ts/generator-typescript-plugin-backbone", + "@hilla/generator-typescript-plugin-barrel": "file:../../../../ts/generator-typescript-plugin-barrel", + "@hilla/generator-typescript-plugin-client": "file:../../../../ts/generator-typescript-plugin-client", + "@hilla/generator-typescript-plugin-model": "file:../../../../ts/generator-typescript-plugin-model", + "@hilla/generator-typescript-plugin-push": "file:../../../../ts/generator-typescript-plugin-push", + "@hilla/generator-typescript-utils": "file:../../../../ts/generator-typescript-utils", + "@hilla/react-auth": "file:../../../../ts/react-auth", + "@hilla/react-form": "file:../../../../ts/react-form", + "@hilla/react-grid": "file:../../../../ts/react-grid", "@polymer/polymer": "3.5.1", "@vaadin/a11y-base": "24.2.0-alpha16", "@vaadin/accordion": "24.2.0-alpha16", @@ -111,7 +114,6 @@ "../../../../ts/form": { "name": "@hilla/form", "version": "2.3.0-alpha5", - "extraneous": true, "license": "Apache-2.0", "dependencies": { "@hilla/frontend": "*", @@ -134,6 +136,36 @@ "lit": "^2.3.0" } }, + "../../../../ts/frontend": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@vaadin/common-frontend": "^0.0.18", + "atmosphere.js": "^3.1.3", + "js-cookie": "^3.0.5" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@open-wc/testing": "^3.2.0", + "@types/atmosphere.js": "^2.1.3", + "@types/chai": "^4.3.5", + "@types/chai-as-promised": "^7.1.5", + "@types/js-cookie": "^3.0.3", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-as-promised": "^7.1.1", + "chai-dom": "^1.11.0", + "fetch-mock": "^9.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "lit": "^2.3.0" + } + }, "../../../../ts/generator-typescript-cli": { "name": "@hilla/generator-typescript-cli", "version": "2.3.0-alpha5", @@ -416,6 +448,7 @@ "../../../../ts/hilla-frontend": { "name": "@hilla/frontend", "version": "2.2.0-alpha6", + "extraneous": true, "license": "Apache-2.0", "dependencies": { "@vaadin/common-frontend": "^0.0.12", @@ -445,6 +478,87 @@ "lit": "^2.3.0" } }, + "../../../../ts/react-auth": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/frontend": "*" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "react-router-dom": "^6.16.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18", + "react-router-dom": "^6" + } + }, + "../../../../ts/react-form": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/form": "*" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18" + } + }, + "../../../../ts/react-grid": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/form": "*", + "@hilla/react-components": "2.2.0-alpha16" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18" + } + }, "node_modules/@ampproject/remapping": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", @@ -2717,19 +2831,11 @@ } }, "node_modules/@hilla/form": { - "version": "2.3.0-alpha5", - "resolved": "https://registry.npmjs.org/@hilla/form/-/form-2.3.0-alpha5.tgz", - "integrity": "sha512-ZFRx+Fd/qXBNB/mGN0yTH/VHgq3t661sUor4qdRQx7mWPrsImqw3TJ89eNVeVo7tXRyGy5kP7HKzVPVYze32bA==", - "dependencies": { - "@hilla/frontend": "*", - "validator": "^13.11.0" - }, - "peerDependencies": { - "lit": "^2.3.0" - } + "resolved": "../../../../ts/form", + "link": true }, "node_modules/@hilla/frontend": { - "resolved": "../../../../ts/hilla-frontend", + "resolved": "../../../../ts/frontend", "link": true }, "node_modules/@hilla/generator-typescript-cli": { @@ -2764,6 +2870,18 @@ "resolved": "../../../../ts/generator-typescript-utils", "link": true }, + "node_modules/@hilla/react-auth": { + "resolved": "../../../../ts/react-auth", + "link": true + }, + "node_modules/@hilla/react-form": { + "resolved": "../../../../ts/react-form", + "link": true + }, + "node_modules/@hilla/react-grid": { + "resolved": "../../../../ts/react-grid", + "link": true + }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -7515,14 +7633,6 @@ "punycode": "^2.1.0" } }, - "node_modules/validator": { - "version": "13.11.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-13.11.0.tgz", - "integrity": "sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ==", - "engines": { - "node": ">= 0.10" - } - }, "node_modules/vite": { "version": "4.4.9", "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz", @@ -9928,37 +10038,45 @@ "optional": true }, "@hilla/form": { - "version": "2.3.0-alpha5", - "resolved": "https://registry.npmjs.org/@hilla/form/-/form-2.3.0-alpha5.tgz", - "integrity": "sha512-ZFRx+Fd/qXBNB/mGN0yTH/VHgq3t661sUor4qdRQx7mWPrsImqw3TJ89eNVeVo7tXRyGy5kP7HKzVPVYze32bA==", + "version": "file:../../../../ts/form", "requires": { - "@hilla/frontend": "../../../../ts/hilla-frontend", + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/frontend": "*", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6", "validator": "^13.11.0" } }, "@hilla/frontend": { - "version": "file:../../../../ts/hilla-frontend", + "version": "file:../../../../ts/frontend", "requires": { "@esm-bundle/chai": "^4.3.4-fix.0", - "@open-wc/testing": "^3.1.8", + "@open-wc/testing": "^3.2.0", "@types/atmosphere.js": "^2.1.3", - "@types/chai": "^4.2.21", + "@types/chai": "^4.3.5", "@types/chai-as-promised": "^7.1.5", "@types/js-cookie": "^3.0.3", - "@types/mocha": "^9.0.0", - "@types/sinon": "^10.0.2", - "@types/sinon-chai": "^3.2.5", - "@types/validator": "^13.6.3", - "@vaadin/common-frontend": "^0.0.12", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "@vaadin/common-frontend": "^0.0.18", "atmosphere.js": "^3.1.3", "chai-as-promised": "^7.1.1", "chai-dom": "^1.11.0", "fetch-mock": "^9.11.0", - "js-cookie": "^3.0.1", - "rimraf": "^3.0.2", - "sinon": "^11.1.2", + "js-cookie": "^3.0.5", + "sinon": "^15.2.0", "sinon-chai": "^3.7.0", - "typescript": "^5.0.1-rc" + "typescript": "^5.1.6" } }, "@hilla/generator-typescript-cli": { @@ -10158,6 +10276,68 @@ "typescript": "^5.1.6" } }, + "@hilla/react-auth": { + "version": "file:../../../../ts/react-auth", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/frontend": "*", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "react-router-dom": "^6.16.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + } + }, + "@hilla/react-form": { + "version": "file:../../../../ts/react-form", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/form": "*", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + } + }, + "@hilla/react-grid": { + "version": "file:../../../../ts/react-grid", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/form": "*", + "@hilla/react-components": "2.2.0-alpha16", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + } + }, "@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -13661,11 +13841,6 @@ "punycode": "^2.1.0" } }, - "validator": { - "version": "13.11.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-13.11.0.tgz", - "integrity": "sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ==" - }, "vite": { "version": "4.4.9", "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz", diff --git a/packages/java/tests/spring/endpoints-custom-client/package.json b/packages/java/tests/spring/endpoints-custom-client/package.json index 441ee61c96..ed8a625eef 100644 --- a/packages/java/tests/spring/endpoints-custom-client/package.json +++ b/packages/java/tests/spring/endpoints-custom-client/package.json @@ -3,16 +3,19 @@ "license": "UNLICENSED", "type": "module", "dependencies": { - "@hilla/form": "2.3.0-alpha5", - "@hilla/frontend": "../../../../ts/hilla-frontend", - "@hilla/generator-typescript-cli": "../../../../ts/generator-typescript-cli", - "@hilla/generator-typescript-core": "../../../../ts/generator-typescript-core", - "@hilla/generator-typescript-plugin-backbone": "../../../../ts/generator-typescript-plugin-backbone", - "@hilla/generator-typescript-plugin-barrel": "../../../../ts/generator-typescript-plugin-barrel", - "@hilla/generator-typescript-plugin-client": "../../../../ts/generator-typescript-plugin-client", - "@hilla/generator-typescript-plugin-model": "../../../../ts/generator-typescript-plugin-model", - "@hilla/generator-typescript-plugin-push": "../../../../ts/generator-typescript-plugin-push", - "@hilla/generator-typescript-utils": "../../../../ts/generator-typescript-utils", + "@hilla/form": "file:../../../../ts/form", + "@hilla/frontend": "file:../../../../ts/frontend", + "@hilla/generator-typescript-cli": "file:../../../../ts/generator-typescript-cli", + "@hilla/generator-typescript-core": "file:../../../../ts/generator-typescript-core", + "@hilla/generator-typescript-plugin-backbone": "file:../../../../ts/generator-typescript-plugin-backbone", + "@hilla/generator-typescript-plugin-barrel": "file:../../../../ts/generator-typescript-plugin-barrel", + "@hilla/generator-typescript-plugin-client": "file:../../../../ts/generator-typescript-plugin-client", + "@hilla/generator-typescript-plugin-model": "file:../../../../ts/generator-typescript-plugin-model", + "@hilla/generator-typescript-plugin-push": "file:../../../../ts/generator-typescript-plugin-push", + "@hilla/generator-typescript-utils": "file:../../../../ts/generator-typescript-utils", + "@hilla/react-auth": "file:../../../../ts/react-auth", + "@hilla/react-form": "file:../../../../ts/react-form", + "@hilla/react-grid": "file:../../../../ts/react-grid", "@polymer/polymer": "3.5.1", "@vaadin/a11y-base": "24.2.0-alpha16", "@vaadin/accordion": "24.2.0-alpha16", diff --git a/packages/java/tests/spring/endpoints-latest-java/package-lock.json b/packages/java/tests/spring/endpoints-latest-java/package-lock.json index 085753a8dc..07756a6f72 100644 --- a/packages/java/tests/spring/endpoints-latest-java/package-lock.json +++ b/packages/java/tests/spring/endpoints-latest-java/package-lock.json @@ -7,16 +7,19 @@ "name": "no-name", "license": "UNLICENSED", "dependencies": { - "@hilla/form": "2.3.0-alpha5", - "@hilla/frontend": "../../../../ts/hilla-frontend", - "@hilla/generator-typescript-cli": "../../../../ts/generator-typescript-cli", - "@hilla/generator-typescript-core": "../../../../ts/generator-typescript-core", - "@hilla/generator-typescript-plugin-backbone": "../../../../ts/generator-typescript-plugin-backbone", - "@hilla/generator-typescript-plugin-barrel": "../../../../ts/generator-typescript-plugin-barrel", - "@hilla/generator-typescript-plugin-client": "../../../../ts/generator-typescript-plugin-client", - "@hilla/generator-typescript-plugin-model": "../../../../ts/generator-typescript-plugin-model", - "@hilla/generator-typescript-plugin-push": "../../../../ts/generator-typescript-plugin-push", - "@hilla/generator-typescript-utils": "../../../../ts/generator-typescript-utils", + "@hilla/form": "file:../../../../ts/form", + "@hilla/frontend": "file:../../../../ts/frontend", + "@hilla/generator-typescript-cli": "file:../../../../ts/generator-typescript-cli", + "@hilla/generator-typescript-core": "file:../../../../ts/generator-typescript-core", + "@hilla/generator-typescript-plugin-backbone": "file:../../../../ts/generator-typescript-plugin-backbone", + "@hilla/generator-typescript-plugin-barrel": "file:../../../../ts/generator-typescript-plugin-barrel", + "@hilla/generator-typescript-plugin-client": "file:../../../../ts/generator-typescript-plugin-client", + "@hilla/generator-typescript-plugin-model": "file:../../../../ts/generator-typescript-plugin-model", + "@hilla/generator-typescript-plugin-push": "file:../../../../ts/generator-typescript-plugin-push", + "@hilla/generator-typescript-utils": "file:../../../../ts/generator-typescript-utils", + "@hilla/react-auth": "file:../../../../ts/react-auth", + "@hilla/react-form": "file:../../../../ts/react-form", + "@hilla/react-grid": "file:../../../../ts/react-grid", "@polymer/polymer": "3.5.1", "@vaadin/a11y-base": "24.2.0-alpha16", "@vaadin/accordion": "24.2.0-alpha16", @@ -111,7 +114,6 @@ "../../../../ts/form": { "name": "@hilla/form", "version": "2.3.0-alpha5", - "extraneous": true, "license": "Apache-2.0", "dependencies": { "@hilla/frontend": "*", @@ -134,6 +136,36 @@ "lit": "^2.3.0" } }, + "../../../../ts/frontend": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@vaadin/common-frontend": "^0.0.18", + "atmosphere.js": "^3.1.3", + "js-cookie": "^3.0.5" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@open-wc/testing": "^3.2.0", + "@types/atmosphere.js": "^2.1.3", + "@types/chai": "^4.3.5", + "@types/chai-as-promised": "^7.1.5", + "@types/js-cookie": "^3.0.3", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-as-promised": "^7.1.1", + "chai-dom": "^1.11.0", + "fetch-mock": "^9.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "lit": "^2.3.0" + } + }, "../../../../ts/generator-typescript-cli": { "name": "@hilla/generator-typescript-cli", "version": "2.3.0-alpha5", @@ -416,6 +448,7 @@ "../../../../ts/hilla-frontend": { "name": "@hilla/frontend", "version": "2.1.0-alpha4", + "extraneous": true, "license": "Apache-2.0", "dependencies": { "@vaadin/common-frontend": "^0.0.12", @@ -442,6 +475,87 @@ "lit": "^2.3.0" } }, + "../../../../ts/react-auth": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/frontend": "*" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "react-router-dom": "^6.16.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18", + "react-router-dom": "^6" + } + }, + "../../../../ts/react-form": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/form": "*" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18" + } + }, + "../../../../ts/react-grid": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/form": "*", + "@hilla/react-components": "2.2.0-alpha16" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18" + } + }, "node_modules/@ampproject/remapping": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", @@ -2714,19 +2828,11 @@ } }, "node_modules/@hilla/form": { - "version": "2.3.0-alpha5", - "resolved": "https://registry.npmjs.org/@hilla/form/-/form-2.3.0-alpha5.tgz", - "integrity": "sha512-ZFRx+Fd/qXBNB/mGN0yTH/VHgq3t661sUor4qdRQx7mWPrsImqw3TJ89eNVeVo7tXRyGy5kP7HKzVPVYze32bA==", - "dependencies": { - "@hilla/frontend": "*", - "validator": "^13.11.0" - }, - "peerDependencies": { - "lit": "^2.3.0" - } + "resolved": "../../../../ts/form", + "link": true }, "node_modules/@hilla/frontend": { - "resolved": "../../../../ts/hilla-frontend", + "resolved": "../../../../ts/frontend", "link": true }, "node_modules/@hilla/generator-typescript-cli": { @@ -2761,6 +2867,18 @@ "resolved": "../../../../ts/generator-typescript-utils", "link": true }, + "node_modules/@hilla/react-auth": { + "resolved": "../../../../ts/react-auth", + "link": true + }, + "node_modules/@hilla/react-form": { + "resolved": "../../../../ts/react-form", + "link": true + }, + "node_modules/@hilla/react-grid": { + "resolved": "../../../../ts/react-grid", + "link": true + }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -7545,14 +7663,6 @@ "punycode": "^2.1.0" } }, - "node_modules/validator": { - "version": "13.11.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-13.11.0.tgz", - "integrity": "sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ==", - "engines": { - "node": ">= 0.10" - } - }, "node_modules/vite": { "version": "4.4.9", "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz", @@ -10004,34 +10114,45 @@ "optional": true }, "@hilla/form": { - "version": "2.3.0-alpha5", - "resolved": "https://registry.npmjs.org/@hilla/form/-/form-2.3.0-alpha5.tgz", - "integrity": "sha512-ZFRx+Fd/qXBNB/mGN0yTH/VHgq3t661sUor4qdRQx7mWPrsImqw3TJ89eNVeVo7tXRyGy5kP7HKzVPVYze32bA==", + "version": "file:../../../../ts/form", "requires": { - "@hilla/frontend": "../../../../ts/hilla-frontend", + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/frontend": "*", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6", "validator": "^13.11.0" } }, "@hilla/frontend": { - "version": "file:../../../../ts/hilla-frontend", + "version": "file:../../../../ts/frontend", "requires": { "@esm-bundle/chai": "^4.3.4-fix.0", - "@open-wc/testing": "^2.5.33", - "@types/chai": "^4.2.21", + "@open-wc/testing": "^3.2.0", + "@types/atmosphere.js": "^2.1.3", + "@types/chai": "^4.3.5", + "@types/chai-as-promised": "^7.1.5", "@types/js-cookie": "^3.0.3", - "@types/mocha": "^9.0.0", - "@types/sinon": "^10.0.2", - "@types/sinon-chai": "^3.2.5", - "@types/validator": "^13.6.3", - "@vaadin/common-frontend": "^0.0.12", - "a-atmosphere-javascript": "3.1.3-2", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "@vaadin/common-frontend": "^0.0.18", + "atmosphere.js": "^3.1.3", + "chai-as-promised": "^7.1.1", "chai-dom": "^1.11.0", "fetch-mock": "^9.11.0", - "js-cookie": "^3.0.1", - "rimraf": "^3.0.2", - "sinon": "^11.1.2", + "js-cookie": "^3.0.5", + "sinon": "^15.2.0", "sinon-chai": "^3.7.0", - "typescript": "^5.0.1-rc" + "typescript": "^5.1.6" } }, "@hilla/generator-typescript-cli": { @@ -10231,6 +10352,68 @@ "typescript": "^5.1.6" } }, + "@hilla/react-auth": { + "version": "file:../../../../ts/react-auth", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/frontend": "*", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "react-router-dom": "^6.16.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + } + }, + "@hilla/react-form": { + "version": "file:../../../../ts/react-form", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/form": "*", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + } + }, + "@hilla/react-grid": { + "version": "file:../../../../ts/react-grid", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/form": "*", + "@hilla/react-components": "2.2.0-alpha16", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + } + }, "@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -13760,11 +13943,6 @@ "punycode": "^2.1.0" } }, - "validator": { - "version": "13.11.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-13.11.0.tgz", - "integrity": "sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ==" - }, "vite": { "version": "4.4.9", "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz", diff --git a/packages/java/tests/spring/endpoints-latest-java/package.json b/packages/java/tests/spring/endpoints-latest-java/package.json index 441ee61c96..ed8a625eef 100644 --- a/packages/java/tests/spring/endpoints-latest-java/package.json +++ b/packages/java/tests/spring/endpoints-latest-java/package.json @@ -3,16 +3,19 @@ "license": "UNLICENSED", "type": "module", "dependencies": { - "@hilla/form": "2.3.0-alpha5", - "@hilla/frontend": "../../../../ts/hilla-frontend", - "@hilla/generator-typescript-cli": "../../../../ts/generator-typescript-cli", - "@hilla/generator-typescript-core": "../../../../ts/generator-typescript-core", - "@hilla/generator-typescript-plugin-backbone": "../../../../ts/generator-typescript-plugin-backbone", - "@hilla/generator-typescript-plugin-barrel": "../../../../ts/generator-typescript-plugin-barrel", - "@hilla/generator-typescript-plugin-client": "../../../../ts/generator-typescript-plugin-client", - "@hilla/generator-typescript-plugin-model": "../../../../ts/generator-typescript-plugin-model", - "@hilla/generator-typescript-plugin-push": "../../../../ts/generator-typescript-plugin-push", - "@hilla/generator-typescript-utils": "../../../../ts/generator-typescript-utils", + "@hilla/form": "file:../../../../ts/form", + "@hilla/frontend": "file:../../../../ts/frontend", + "@hilla/generator-typescript-cli": "file:../../../../ts/generator-typescript-cli", + "@hilla/generator-typescript-core": "file:../../../../ts/generator-typescript-core", + "@hilla/generator-typescript-plugin-backbone": "file:../../../../ts/generator-typescript-plugin-backbone", + "@hilla/generator-typescript-plugin-barrel": "file:../../../../ts/generator-typescript-plugin-barrel", + "@hilla/generator-typescript-plugin-client": "file:../../../../ts/generator-typescript-plugin-client", + "@hilla/generator-typescript-plugin-model": "file:../../../../ts/generator-typescript-plugin-model", + "@hilla/generator-typescript-plugin-push": "file:../../../../ts/generator-typescript-plugin-push", + "@hilla/generator-typescript-utils": "file:../../../../ts/generator-typescript-utils", + "@hilla/react-auth": "file:../../../../ts/react-auth", + "@hilla/react-form": "file:../../../../ts/react-form", + "@hilla/react-grid": "file:../../../../ts/react-grid", "@polymer/polymer": "3.5.1", "@vaadin/a11y-base": "24.2.0-alpha16", "@vaadin/accordion": "24.2.0-alpha16", diff --git a/packages/java/tests/spring/endpoints-maven-engine/package-lock.json b/packages/java/tests/spring/endpoints-maven-engine/package-lock.json index dc48db7e17..a5c32013c2 100644 --- a/packages/java/tests/spring/endpoints-maven-engine/package-lock.json +++ b/packages/java/tests/spring/endpoints-maven-engine/package-lock.json @@ -7,16 +7,19 @@ "name": "no-name", "license": "UNLICENSED", "dependencies": { - "@hilla/form": "../../../../ts/form", - "@hilla/frontend": "../../../../ts/hilla-frontend", - "@hilla/generator-typescript-cli": "../../../../ts/generator-typescript-cli", - "@hilla/generator-typescript-core": "../../../../ts/generator-typescript-core", - "@hilla/generator-typescript-plugin-backbone": "../../../../ts/generator-typescript-plugin-backbone", - "@hilla/generator-typescript-plugin-barrel": "../../../../ts/generator-typescript-plugin-barrel", - "@hilla/generator-typescript-plugin-client": "../../../../ts/generator-typescript-plugin-client", - "@hilla/generator-typescript-plugin-model": "../../../../ts/generator-typescript-plugin-model", - "@hilla/generator-typescript-plugin-push": "../../../../ts/generator-typescript-plugin-push", - "@hilla/generator-typescript-utils": "../../../../ts/generator-typescript-utils", + "@hilla/form": "file:../../../../ts/form", + "@hilla/frontend": "file:../../../../ts/frontend", + "@hilla/generator-typescript-cli": "file:../../../../ts/generator-typescript-cli", + "@hilla/generator-typescript-core": "file:../../../../ts/generator-typescript-core", + "@hilla/generator-typescript-plugin-backbone": "file:../../../../ts/generator-typescript-plugin-backbone", + "@hilla/generator-typescript-plugin-barrel": "file:../../../../ts/generator-typescript-plugin-barrel", + "@hilla/generator-typescript-plugin-client": "file:../../../../ts/generator-typescript-plugin-client", + "@hilla/generator-typescript-plugin-model": "file:../../../../ts/generator-typescript-plugin-model", + "@hilla/generator-typescript-plugin-push": "file:../../../../ts/generator-typescript-plugin-push", + "@hilla/generator-typescript-utils": "file:../../../../ts/generator-typescript-utils", + "@hilla/react-auth": "file:../../../../ts/react-auth", + "@hilla/react-form": "file:../../../../ts/react-form", + "@hilla/react-grid": "file:../../../../ts/react-grid", "@polymer/polymer": "3.5.1", "@vaadin/common-frontend": "0.0.18", "@vaadin/router": "1.7.5", @@ -42,24 +45,54 @@ }, "../../../../ts/form": { "name": "@hilla/form", - "version": "2.1.0-alpha4", + "version": "2.3.0-alpha5", "license": "Apache-2.0", "dependencies": { - "rimraf": "^3.0.2", - "validator": "^13.6.0" + "@hilla/frontend": "*", + "validator": "^13.11.0" }, "devDependencies": { "@esm-bundle/chai": "^4.3.4-fix.0", - "@types/chai": "^4.2.21", + "@types/chai": "^4.3.5", "@types/chai-dom": "^1.11.0", - "@types/mocha": "^9.0.0", - "@types/sinon": "^10.0.2", - "@types/sinon-chai": "^3.2.5", - "@types/validator": "^13.6.0", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", "chai-dom": "^1.11.0", - "sinon": "^11.1.2", + "sinon": "^15.2.0", "sinon-chai": "^3.7.0", - "typescript": "^5.0.1-rc" + "typescript": "^5.1.6" + }, + "peerDependencies": { + "lit": "^2.3.0" + } + }, + "../../../../ts/frontend": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@vaadin/common-frontend": "^0.0.18", + "atmosphere.js": "^3.1.3", + "js-cookie": "^3.0.5" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@open-wc/testing": "^3.2.0", + "@types/atmosphere.js": "^2.1.3", + "@types/chai": "^4.3.5", + "@types/chai-as-promised": "^7.1.5", + "@types/js-cookie": "^3.0.3", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-as-promised": "^7.1.1", + "chai-dom": "^1.11.0", + "fetch-mock": "^9.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" }, "peerDependencies": { "lit": "^2.3.0" @@ -67,67 +100,69 @@ }, "../../../../ts/generator-typescript-cli": { "name": "@hilla/generator-typescript-cli", - "version": "2.1.0-alpha4", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { - "@hilla/generator-typescript-utils": "^2.1.0-alpha4", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "get-stdin": "^9.0.0", - "meow": "^10.1.1" + "meow": "^12.1.0" }, "bin": { "tsgen": "bin/index.js" }, "devDependencies": { - "@hilla/generator-typescript-core": "^2.1.0-alpha4", - "@types/chai": "^4.2.22", - "@types/mocha": "^9.0.0", - "@types/node": "^16.11.1", - "@types/sinon": "^10.0.6", - "@types/sinon-chai": "^3.2.5", - "c8": "^7.10.0", - "chai": "^4.3.4", - "concurrently": "^6.3.0", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@types/chai": "^4.3.5", + "@types/chai-as-promised": "^7.1.5", + "@types/mocha": "^10.0.1", + "@types/node": "^20.5.0", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "c8": "^8.0.1", + "chai": "^4.3.7", + "chai-as-promised": "^7.1.1", + "concurrently": "^8.2.0", "copyfiles": "^2.4.1", - "mocha": "^9.1.3", - "pino": "^7.0.5", - "rimraf": "^3.0.2", - "sinon": "^11.1.2", + "mocha": "^10.2.0", + "pino": "^8.15.0", + "rimraf": "^5.0.1", + "sinon": "^15.2.0", "sinon-chai": "^3.7.0", - "type-fest": "^2.5.1" + "type-fest": "^4.2.0" }, "engines": { "node": ">= 16.13" }, "peerDependencies": { - "@hilla/generator-typescript-core": "^2.1.0-alpha4" + "@hilla/generator-typescript-core": "^2.3.0-alpha5" } }, "../../../../ts/generator-typescript-core": { "name": "@hilla/generator-typescript-core", - "version": "2.1.0-alpha4", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { - "@apidevtools/swagger-parser": "^10.0.3", - "@hilla/generator-typescript-utils": "^2.1.0-alpha4", - "meow": "^10.1.1", - "openapi-types": "^9.3.0", - "typescript": "^5.0.1-rc" + "@apidevtools/swagger-parser": "^10.1.0", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", + "meow": "^12.1.0", + "openapi-types": "^12.1.3", + "typescript": "^5.1.6" }, "devDependencies": { - "@types/chai": "^4.2.22", - "@types/mocha": "^9.0.0", - "@types/node": "^16.11.1", - "@types/sinon": "^10.0.6", - "@types/sinon-chai": "^3.2.5", - "c8": "^7.10.0", - "chai": "^4.3.4", - "concurrently": "^6.3.0", + "@types/chai": "^4.3.5", + "@types/mocha": "^10.0.1", + "@types/node": "^20.5.0", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "c8": "^8.0.1", + "chai": "^4.3.7", + "concurrently": "^8.2.0", "copyfiles": "^2.4.1", - "mocha": "^9.1.3", - "rimraf": "^3.0.2", - "sinon": "^11.1.2", + "mocha": "^10.2.0", + "rimraf": "^5.0.1", + "sinon": "^15.2.0", "sinon-chai": "^3.7.0", - "type-fest": "^2.5.1" + "type-fest": "^4.2.0" }, "engines": { "node": ">= 16.13" @@ -135,208 +170,208 @@ }, "../../../../ts/generator-typescript-plugin-backbone": { "name": "@hilla/generator-typescript-plugin-backbone", - "version": "2.1.0-alpha4", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { - "@hilla/generator-typescript-utils": "^2.1.0-alpha4", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "fast-deep-equal": "^3.1.3", - "openapi-types": "^9.3.0", - "typescript": "^5.0.1-rc" + "openapi-types": "^12.1.3", + "typescript": "^5.1.6" }, "devDependencies": { - "@hilla/generator-typescript-core": "^2.1.0-alpha4", - "@hilla/generator-typescript-plugin-client": "^2.1.0-alpha4", - "@types/chai": "^4.2.22", - "@types/mocha": "^9.0.0", - "@types/node": "^16.11.1", - "@types/sinon": "^10.0.6", - "@types/sinon-chai": "^3.2.5", - "c8": "^7.10.0", - "chai": "^4.3.4", - "concurrently": "^6.4.0", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha5", + "@types/chai": "^4.3.5", + "@types/mocha": "^10.0.1", + "@types/node": "^20.5.0", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "c8": "^8.0.1", + "chai": "^4.3.7", + "concurrently": "^8.2.0", "copyfiles": "^2.4.1", - "mocha": "^9.1.3", - "pino": "^7.0.5", - "rimraf": "^3.0.2", - "sinon": "^11.1.2", + "mocha": "^10.2.0", + "pino": "^8.15.0", + "rimraf": "^5.0.1", + "sinon": "^15.2.0", "sinon-chai": "^3.7.0", - "type-fest": "^2.5.1" + "type-fest": "^4.2.0" }, "engines": { "node": ">= 16.13" }, "peerDependencies": { - "@hilla/generator-typescript-core": "^2.1.0-alpha4", - "@hilla/generator-typescript-plugin-client": "^2.1.0-alpha4" + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha5" } }, "../../../../ts/generator-typescript-plugin-barrel": { "name": "@hilla/generator-typescript-plugin-barrel", - "version": "2.1.0-alpha4", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { - "@hilla/generator-typescript-utils": "^2.1.0-alpha4", - "typescript": "^5.0.1-rc" + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", + "typescript": "^5.1.6" }, "devDependencies": { - "@hilla/generator-typescript-core": "^2.1.0-alpha4", - "@hilla/generator-typescript-plugin-backbone": "^2.1.0-alpha4", - "@types/chai": "^4.2.22", - "@types/mocha": "^9.0.0", - "@types/node": "^16.11.1", - "@types/sinon": "^10.0.6", - "@types/sinon-chai": "^3.2.5", - "c8": "^7.10.0", - "chai": "^4.3.4", - "concurrently": "^6.4.0", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-backbone": "^2.3.0-alpha5", + "@types/chai": "^4.3.5", + "@types/mocha": "^10.0.1", + "@types/node": "^20.5.0", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "c8": "^8.0.1", + "chai": "^4.3.7", + "concurrently": "^8.2.0", "copyfiles": "^2.4.1", - "mocha": "^9.1.3", - "pino": "^7.0.5", - "rimraf": "^3.0.2", - "sinon": "^11.1.2", + "mocha": "^10.2.0", + "pino": "^8.15.0", + "rimraf": "^5.0.1", + "sinon": "^15.2.0", "sinon-chai": "^3.7.0", - "type-fest": "^2.5.1" + "type-fest": "^4.2.0" }, "engines": { "node": ">= 16.13" }, "peerDependencies": { - "@hilla/generator-typescript-core": "^2.1.0-alpha4", - "@hilla/generator-typescript-plugin-backbone": "^2.1.0-alpha4" + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-backbone": "^2.3.0-alpha5" } }, "../../../../ts/generator-typescript-plugin-client": { "name": "@hilla/generator-typescript-plugin-client", - "version": "2.1.0-alpha4", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { - "@hilla/generator-typescript-utils": "^2.1.0-alpha4", - "typescript": "^5.0.1-rc" + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", + "typescript": "^5.1.6" }, "devDependencies": { - "@hilla/generator-typescript-core": "^2.1.0-alpha4", - "@types/chai": "^4.2.22", - "@types/mocha": "^9.0.0", - "@types/node": "^16.11.1", - "@types/sinon": "^10.0.6", - "@types/sinon-chai": "^3.2.5", - "c8": "^7.10.0", - "chai": "^4.3.4", - "concurrently": "^6.4.0", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@types/chai": "^4.3.5", + "@types/mocha": "^10.0.1", + "@types/node": "^20.5.0", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "c8": "^8.0.1", + "chai": "^4.3.7", + "concurrently": "^8.2.0", "copyfiles": "^2.4.1", - "mocha": "^9.1.3", - "pino": "^7.0.5", - "rimraf": "^3.0.2", - "sinon": "^11.1.2", + "mocha": "^10.2.0", + "pino": "^8.15.0", + "rimraf": "^5.0.1", + "sinon": "^15.2.0", "sinon-chai": "^3.7.0", - "type-fest": "^2.5.1" + "type-fest": "^4.2.0" }, "engines": { "node": ">= 16.13" }, "peerDependencies": { - "@hilla/generator-typescript-core": "^2.1.0-alpha4" + "@hilla/generator-typescript-core": "^2.3.0-alpha5" } }, "../../../../ts/generator-typescript-plugin-model": { "name": "@hilla/generator-typescript-plugin-model", - "version": "2.1.0-alpha4", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { - "@hilla/generator-typescript-utils": "^2.1.0-alpha4", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "fast-deep-equal": "^3.1.3", - "openapi-types": "^9.3.0", - "typescript": "^5.0.1-rc" + "openapi-types": "^12.1.3", + "typescript": "^5.1.6" }, "devDependencies": { - "@hilla/generator-typescript-core": "^2.1.0-alpha4", - "@hilla/generator-typescript-plugin-client": "^2.1.0-alpha4", - "@types/chai": "^4.2.22", - "@types/mocha": "^9.0.0", - "@types/node": "^16.11.1", - "@types/sinon": "^10.0.6", - "@types/sinon-chai": "^3.2.5", - "c8": "^7.10.0", - "chai": "^4.3.4", - "concurrently": "^6.4.0", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha5", + "@types/chai": "^4.3.5", + "@types/mocha": "^10.0.1", + "@types/node": "^20.5.0", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "c8": "^8.0.1", + "chai": "^4.3.7", + "concurrently": "^8.2.0", "copyfiles": "^2.4.1", - "mocha": "^9.1.3", - "pino": "^7.0.5", - "rimraf": "^3.0.2", - "sinon": "^11.1.2", + "mocha": "^10.2.0", + "pino": "^8.15.0", + "rimraf": "^5.0.1", + "sinon": "^15.2.0", "sinon-chai": "^3.7.0", - "type-fest": "^2.5.1" + "type-fest": "^4.2.0" }, "engines": { "node": ">= 16.13" }, "peerDependencies": { - "@hilla/form": "^2.1.0-alpha4", - "@hilla/generator-typescript-core": "^2.1.0-alpha4", - "@hilla/generator-typescript-plugin-backbone": "^2.1.0-alpha4" + "@hilla/form": "^2.3.0-alpha5", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-backbone": "^2.3.0-alpha5" } }, "../../../../ts/generator-typescript-plugin-push": { "name": "@hilla/generator-typescript-plugin-push", - "version": "2.1.0-alpha4", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { - "@hilla/generator-typescript-utils": "^2.1.0-alpha4", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "fast-deep-equal": "^3.1.3", - "openapi-types": "^9.3.0", - "typescript": "^5.0.1-rc" + "openapi-types": "^12.1.3", + "typescript": "^5.1.6" }, "devDependencies": { - "@hilla/generator-typescript-core": "^2.1.0-alpha4", - "@hilla/generator-typescript-plugin-client": "^2.1.0-alpha4", - "@types/chai": "^4.2.22", - "@types/mocha": "^9.0.0", - "@types/node": "^16.11.1", - "@types/sinon": "^10.0.6", - "@types/sinon-chai": "^3.2.5", - "c8": "^7.10.0", - "chai": "^4.3.4", - "concurrently": "^6.4.0", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha5", + "@types/chai": "^4.3.5", + "@types/mocha": "^10.0.1", + "@types/node": "^20.5.0", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "c8": "^8.0.1", + "chai": "^4.3.7", + "concurrently": "^8.2.0", "copyfiles": "^2.4.1", - "mocha": "^9.1.3", - "pino": "^7.0.5", - "rimraf": "^3.0.2", - "sinon": "^11.1.2", + "mocha": "^10.2.0", + "pino": "^8.15.0", + "rimraf": "^5.0.1", + "sinon": "^15.2.0", "sinon-chai": "^3.7.0", - "type-fest": "^2.5.1" + "type-fest": "^4.2.0" }, "engines": { "node": ">= 16.13" }, "peerDependencies": { - "@hilla/generator-typescript-core": "^2.1.0-alpha4", - "@hilla/generator-typescript-plugin-client": "^2.1.0-alpha4" + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha5" } }, "../../../../ts/generator-typescript-utils": { "name": "@hilla/generator-typescript-utils", - "version": "2.1.0-alpha4", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { - "pino": "^7.0.5", - "pino-pretty": "^7.3.0", - "typescript": "^5.0.1-rc" + "pino": "^8.15.0", + "pino-pretty": "^10.2.0", + "typescript": "^5.1.6" }, "devDependencies": { - "@types/chai": "^4.2.22", - "@types/mocha": "^9.0.0", - "@types/node": "^16.11.1", - "@types/sinon": "^10.0.6", - "@types/sinon-chai": "^3.2.5", - "c8": "^7.10.0", - "chai": "^4.3.4", - "concurrently": "^6.4.0", + "@types/chai": "^4.3.5", + "@types/mocha": "^10.0.1", + "@types/node": "^20.5.0", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "c8": "^8.0.1", + "chai": "^4.3.7", + "concurrently": "^8.2.0", "copyfiles": "^2.4.1", - "mocha": "^9.1.3", - "rimraf": "^3.0.2", - "sinon": "^11.1.2", + "mocha": "^10.2.0", + "rimraf": "^5.0.1", + "sinon": "^15.2.0", "sinon-chai": "^3.7.0", - "type-fest": "^2.5.1" + "type-fest": "^4.2.0" }, "engines": { "node": ">= 16.13" @@ -345,6 +380,7 @@ "../../../../ts/hilla-frontend": { "name": "@hilla/frontend", "version": "2.1.0-alpha4", + "extraneous": true, "license": "Apache-2.0", "dependencies": { "@vaadin/common-frontend": "^0.0.12", @@ -371,6 +407,87 @@ "lit": "^2.3.0" } }, + "../../../../ts/react-auth": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/frontend": "*" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "react-router-dom": "^6.16.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18", + "react-router-dom": "^6" + } + }, + "../../../../ts/react-form": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/form": "*" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18" + } + }, + "../../../../ts/react-grid": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/form": "*", + "@hilla/react-components": "2.2.0-alpha16" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18" + } + }, "node_modules/@ampproject/remapping": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", @@ -2589,7 +2706,7 @@ "link": true }, "node_modules/@hilla/frontend": { - "resolved": "../../../../ts/hilla-frontend", + "resolved": "../../../../ts/frontend", "link": true }, "node_modules/@hilla/generator-typescript-cli": { @@ -2624,6 +2741,18 @@ "resolved": "../../../../ts/generator-typescript-utils", "link": true }, + "node_modules/@hilla/react-auth": { + "resolved": "../../../../ts/react-auth", + "link": true + }, + "node_modules/@hilla/react-form": { + "resolved": "../../../../ts/react-form", + "link": true + }, + "node_modules/@hilla/react-grid": { + "resolved": "../../../../ts/react-grid", + "link": true + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz", @@ -7454,235 +7583,301 @@ "version": "file:../../../../ts/form", "requires": { "@esm-bundle/chai": "^4.3.4-fix.0", - "@types/chai": "^4.2.21", + "@hilla/frontend": "*", + "@types/chai": "^4.3.5", "@types/chai-dom": "^1.11.0", - "@types/mocha": "^9.0.0", - "@types/sinon": "^10.0.2", - "@types/sinon-chai": "^3.2.5", - "@types/validator": "^13.6.0", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", "chai-dom": "^1.11.0", - "rimraf": "^3.0.2", - "sinon": "^11.1.2", + "sinon": "^15.2.0", "sinon-chai": "^3.7.0", - "typescript": "^5.0.1-rc", - "validator": "^13.6.0" + "typescript": "^5.1.6", + "validator": "^13.11.0" } }, "@hilla/frontend": { - "version": "file:../../../../ts/hilla-frontend", + "version": "file:../../../../ts/frontend", "requires": { "@esm-bundle/chai": "^4.3.4-fix.0", - "@open-wc/testing": "^2.5.33", - "@types/chai": "^4.2.21", + "@open-wc/testing": "^3.2.0", + "@types/atmosphere.js": "^2.1.3", + "@types/chai": "^4.3.5", + "@types/chai-as-promised": "^7.1.5", "@types/js-cookie": "^3.0.3", - "@types/mocha": "^9.0.0", - "@types/sinon": "^10.0.2", - "@types/sinon-chai": "^3.2.5", - "@types/validator": "^13.6.3", - "@vaadin/common-frontend": "^0.0.12", - "a-atmosphere-javascript": "3.1.3-2", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "@vaadin/common-frontend": "^0.0.18", + "atmosphere.js": "^3.1.3", + "chai-as-promised": "^7.1.1", "chai-dom": "^1.11.0", "fetch-mock": "^9.11.0", - "js-cookie": "^3.0.1", - "rimraf": "^3.0.2", - "sinon": "^11.1.2", + "js-cookie": "^3.0.5", + "sinon": "^15.2.0", "sinon-chai": "^3.7.0", - "typescript": "^5.0.1-rc" + "typescript": "^5.1.6" } }, "@hilla/generator-typescript-cli": { "version": "file:../../../../ts/generator-typescript-cli", "requires": { - "@hilla/generator-typescript-core": "^2.1.0-alpha4", - "@hilla/generator-typescript-utils": "^2.1.0-alpha4", - "@types/chai": "^4.2.22", - "@types/mocha": "^9.0.0", - "@types/node": "^16.11.1", - "@types/sinon": "^10.0.6", - "@types/sinon-chai": "^3.2.5", - "c8": "^7.10.0", - "chai": "^4.3.4", - "concurrently": "^6.3.0", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", + "@types/chai": "^4.3.5", + "@types/chai-as-promised": "^7.1.5", + "@types/mocha": "^10.0.1", + "@types/node": "^20.5.0", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "c8": "^8.0.1", + "chai": "^4.3.7", + "chai-as-promised": "^7.1.1", + "concurrently": "^8.2.0", "copyfiles": "^2.4.1", "get-stdin": "^9.0.0", - "meow": "^10.1.1", - "mocha": "^9.1.3", - "pino": "^7.0.5", - "rimraf": "^3.0.2", - "sinon": "^11.1.2", + "meow": "^12.1.0", + "mocha": "^10.2.0", + "pino": "^8.15.0", + "rimraf": "^5.0.1", + "sinon": "^15.2.0", "sinon-chai": "^3.7.0", - "type-fest": "^2.5.1" + "type-fest": "^4.2.0" } }, "@hilla/generator-typescript-core": { "version": "file:../../../../ts/generator-typescript-core", "requires": { - "@apidevtools/swagger-parser": "^10.0.3", - "@hilla/generator-typescript-utils": "^2.1.0-alpha4", - "@types/chai": "^4.2.22", - "@types/mocha": "^9.0.0", - "@types/node": "^16.11.1", - "@types/sinon": "^10.0.6", - "@types/sinon-chai": "^3.2.5", - "c8": "^7.10.0", - "chai": "^4.3.4", - "concurrently": "^6.3.0", + "@apidevtools/swagger-parser": "^10.1.0", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", + "@types/chai": "^4.3.5", + "@types/mocha": "^10.0.1", + "@types/node": "^20.5.0", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "c8": "^8.0.1", + "chai": "^4.3.7", + "concurrently": "^8.2.0", "copyfiles": "^2.4.1", - "meow": "^10.1.1", - "mocha": "^9.1.3", - "openapi-types": "^9.3.0", - "rimraf": "^3.0.2", - "sinon": "^11.1.2", + "meow": "^12.1.0", + "mocha": "^10.2.0", + "openapi-types": "^12.1.3", + "rimraf": "^5.0.1", + "sinon": "^15.2.0", "sinon-chai": "^3.7.0", - "type-fest": "^2.5.1", - "typescript": "^5.0.1-rc" + "type-fest": "^4.2.0", + "typescript": "^5.1.6" } }, "@hilla/generator-typescript-plugin-backbone": { "version": "file:../../../../ts/generator-typescript-plugin-backbone", "requires": { - "@hilla/generator-typescript-core": "^2.1.0-alpha4", - "@hilla/generator-typescript-plugin-client": "^2.1.0-alpha4", - "@hilla/generator-typescript-utils": "^2.1.0-alpha4", - "@types/chai": "^4.2.22", - "@types/mocha": "^9.0.0", - "@types/node": "^16.11.1", - "@types/sinon": "^10.0.6", - "@types/sinon-chai": "^3.2.5", - "c8": "^7.10.0", - "chai": "^4.3.4", - "concurrently": "^6.4.0", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha5", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", + "@types/chai": "^4.3.5", + "@types/mocha": "^10.0.1", + "@types/node": "^20.5.0", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "c8": "^8.0.1", + "chai": "^4.3.7", + "concurrently": "^8.2.0", "copyfiles": "^2.4.1", "fast-deep-equal": "^3.1.3", - "mocha": "^9.1.3", - "openapi-types": "^9.3.0", - "pino": "^7.0.5", - "rimraf": "^3.0.2", - "sinon": "^11.1.2", + "mocha": "^10.2.0", + "openapi-types": "^12.1.3", + "pino": "^8.15.0", + "rimraf": "^5.0.1", + "sinon": "^15.2.0", "sinon-chai": "^3.7.0", - "type-fest": "^2.5.1", - "typescript": "^5.0.1-rc" + "type-fest": "^4.2.0", + "typescript": "^5.1.6" } }, "@hilla/generator-typescript-plugin-barrel": { "version": "file:../../../../ts/generator-typescript-plugin-barrel", "requires": { - "@hilla/generator-typescript-core": "^2.1.0-alpha4", - "@hilla/generator-typescript-plugin-backbone": "^2.1.0-alpha4", - "@hilla/generator-typescript-utils": "^2.1.0-alpha4", - "@types/chai": "^4.2.22", - "@types/mocha": "^9.0.0", - "@types/node": "^16.11.1", - "@types/sinon": "^10.0.6", - "@types/sinon-chai": "^3.2.5", - "c8": "^7.10.0", - "chai": "^4.3.4", - "concurrently": "^6.4.0", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-backbone": "^2.3.0-alpha5", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", + "@types/chai": "^4.3.5", + "@types/mocha": "^10.0.1", + "@types/node": "^20.5.0", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "c8": "^8.0.1", + "chai": "^4.3.7", + "concurrently": "^8.2.0", "copyfiles": "^2.4.1", - "mocha": "^9.1.3", - "pino": "^7.0.5", - "rimraf": "^3.0.2", - "sinon": "^11.1.2", + "mocha": "^10.2.0", + "pino": "^8.15.0", + "rimraf": "^5.0.1", + "sinon": "^15.2.0", "sinon-chai": "^3.7.0", - "type-fest": "^2.5.1", - "typescript": "^5.0.1-rc" + "type-fest": "^4.2.0", + "typescript": "^5.1.6" } }, "@hilla/generator-typescript-plugin-client": { "version": "file:../../../../ts/generator-typescript-plugin-client", "requires": { - "@hilla/generator-typescript-core": "^2.1.0-alpha4", - "@hilla/generator-typescript-utils": "^2.1.0-alpha4", - "@types/chai": "^4.2.22", - "@types/mocha": "^9.0.0", - "@types/node": "^16.11.1", - "@types/sinon": "^10.0.6", - "@types/sinon-chai": "^3.2.5", - "c8": "^7.10.0", - "chai": "^4.3.4", - "concurrently": "^6.4.0", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", + "@types/chai": "^4.3.5", + "@types/mocha": "^10.0.1", + "@types/node": "^20.5.0", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "c8": "^8.0.1", + "chai": "^4.3.7", + "concurrently": "^8.2.0", "copyfiles": "^2.4.1", - "mocha": "^9.1.3", - "pino": "^7.0.5", - "rimraf": "^3.0.2", - "sinon": "^11.1.2", + "mocha": "^10.2.0", + "pino": "^8.15.0", + "rimraf": "^5.0.1", + "sinon": "^15.2.0", "sinon-chai": "^3.7.0", - "type-fest": "^2.5.1", - "typescript": "^5.0.1-rc" + "type-fest": "^4.2.0", + "typescript": "^5.1.6" } }, "@hilla/generator-typescript-plugin-model": { "version": "file:../../../../ts/generator-typescript-plugin-model", "requires": { - "@hilla/generator-typescript-core": "^2.1.0-alpha4", - "@hilla/generator-typescript-plugin-client": "^2.1.0-alpha4", - "@hilla/generator-typescript-utils": "^2.1.0-alpha4", - "@types/chai": "^4.2.22", - "@types/mocha": "^9.0.0", - "@types/node": "^16.11.1", - "@types/sinon": "^10.0.6", - "@types/sinon-chai": "^3.2.5", - "c8": "^7.10.0", - "chai": "^4.3.4", - "concurrently": "^6.4.0", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha5", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", + "@types/chai": "^4.3.5", + "@types/mocha": "^10.0.1", + "@types/node": "^20.5.0", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "c8": "^8.0.1", + "chai": "^4.3.7", + "concurrently": "^8.2.0", "copyfiles": "^2.4.1", "fast-deep-equal": "^3.1.3", - "mocha": "^9.1.3", - "openapi-types": "^9.3.0", - "pino": "^7.0.5", - "rimraf": "^3.0.2", - "sinon": "^11.1.2", + "mocha": "^10.2.0", + "openapi-types": "^12.1.3", + "pino": "^8.15.0", + "rimraf": "^5.0.1", + "sinon": "^15.2.0", "sinon-chai": "^3.7.0", - "type-fest": "^2.5.1", - "typescript": "^5.0.1-rc" + "type-fest": "^4.2.0", + "typescript": "^5.1.6" } }, "@hilla/generator-typescript-plugin-push": { "version": "file:../../../../ts/generator-typescript-plugin-push", "requires": { - "@hilla/generator-typescript-core": "^2.1.0-alpha4", - "@hilla/generator-typescript-plugin-client": "^2.1.0-alpha4", - "@hilla/generator-typescript-utils": "^2.1.0-alpha4", - "@types/chai": "^4.2.22", - "@types/mocha": "^9.0.0", - "@types/node": "^16.11.1", - "@types/sinon": "^10.0.6", - "@types/sinon-chai": "^3.2.5", - "c8": "^7.10.0", - "chai": "^4.3.4", - "concurrently": "^6.4.0", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha5", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", + "@types/chai": "^4.3.5", + "@types/mocha": "^10.0.1", + "@types/node": "^20.5.0", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "c8": "^8.0.1", + "chai": "^4.3.7", + "concurrently": "^8.2.0", "copyfiles": "^2.4.1", "fast-deep-equal": "^3.1.3", - "mocha": "^9.1.3", - "openapi-types": "^9.3.0", - "pino": "^7.0.5", - "rimraf": "^3.0.2", - "sinon": "^11.1.2", + "mocha": "^10.2.0", + "openapi-types": "^12.1.3", + "pino": "^8.15.0", + "rimraf": "^5.0.1", + "sinon": "^15.2.0", "sinon-chai": "^3.7.0", - "type-fest": "^2.5.1", - "typescript": "^5.0.1-rc" + "type-fest": "^4.2.0", + "typescript": "^5.1.6" } }, "@hilla/generator-typescript-utils": { "version": "file:../../../../ts/generator-typescript-utils", "requires": { - "@types/chai": "^4.2.22", - "@types/mocha": "^9.0.0", - "@types/node": "^16.11.1", - "@types/sinon": "^10.0.6", - "@types/sinon-chai": "^3.2.5", - "c8": "^7.10.0", - "chai": "^4.3.4", - "concurrently": "^6.4.0", + "@types/chai": "^4.3.5", + "@types/mocha": "^10.0.1", + "@types/node": "^20.5.0", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "c8": "^8.0.1", + "chai": "^4.3.7", + "concurrently": "^8.2.0", "copyfiles": "^2.4.1", - "mocha": "^9.1.3", - "pino": "^7.0.5", - "pino-pretty": "^7.3.0", - "rimraf": "^3.0.2", - "sinon": "^11.1.2", + "mocha": "^10.2.0", + "pino": "^8.15.0", + "pino-pretty": "^10.2.0", + "rimraf": "^5.0.1", + "sinon": "^15.2.0", "sinon-chai": "^3.7.0", - "type-fest": "^2.5.1", - "typescript": "^5.0.1-rc" + "type-fest": "^4.2.0", + "typescript": "^5.1.6" + } + }, + "@hilla/react-auth": { + "version": "file:../../../../ts/react-auth", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/frontend": "*", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "react-router-dom": "^6.16.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + } + }, + "@hilla/react-form": { + "version": "file:../../../../ts/react-form", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/form": "*", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + } + }, + "@hilla/react-grid": { + "version": "file:../../../../ts/react-grid", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/form": "*", + "@hilla/react-components": "2.2.0-alpha16", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" } }, "@jridgewell/gen-mapping": { diff --git a/packages/java/tests/spring/endpoints-maven-engine/package.json b/packages/java/tests/spring/endpoints-maven-engine/package.json index a6aa1c3c5b..65b8ab2e92 100644 --- a/packages/java/tests/spring/endpoints-maven-engine/package.json +++ b/packages/java/tests/spring/endpoints-maven-engine/package.json @@ -3,16 +3,19 @@ "license": "UNLICENSED", "type": "module", "dependencies": { - "@hilla/form": "../../../../ts/form", - "@hilla/frontend": "../../../../ts/hilla-frontend", - "@hilla/generator-typescript-cli": "../../../../ts/generator-typescript-cli", - "@hilla/generator-typescript-core": "../../../../ts/generator-typescript-core", - "@hilla/generator-typescript-plugin-backbone": "../../../../ts/generator-typescript-plugin-backbone", - "@hilla/generator-typescript-plugin-barrel": "../../../../ts/generator-typescript-plugin-barrel", - "@hilla/generator-typescript-plugin-client": "../../../../ts/generator-typescript-plugin-client", - "@hilla/generator-typescript-plugin-model": "../../../../ts/generator-typescript-plugin-model", - "@hilla/generator-typescript-plugin-push": "../../../../ts/generator-typescript-plugin-push", - "@hilla/generator-typescript-utils": "../../../../ts/generator-typescript-utils", + "@hilla/form": "file:../../../../ts/form", + "@hilla/frontend": "file:../../../../ts/frontend", + "@hilla/generator-typescript-cli": "file:../../../../ts/generator-typescript-cli", + "@hilla/generator-typescript-core": "file:../../../../ts/generator-typescript-core", + "@hilla/generator-typescript-plugin-backbone": "file:../../../../ts/generator-typescript-plugin-backbone", + "@hilla/generator-typescript-plugin-barrel": "file:../../../../ts/generator-typescript-plugin-barrel", + "@hilla/generator-typescript-plugin-client": "file:../../../../ts/generator-typescript-plugin-client", + "@hilla/generator-typescript-plugin-model": "file:../../../../ts/generator-typescript-plugin-model", + "@hilla/generator-typescript-plugin-push": "file:../../../../ts/generator-typescript-plugin-push", + "@hilla/generator-typescript-utils": "file:../../../../ts/generator-typescript-utils", + "@hilla/react-auth": "file:../../../../ts/react-auth", + "@hilla/react-form": "file:../../../../ts/react-form", + "@hilla/react-grid": "file:../../../../ts/react-grid", "@polymer/polymer": "3.5.1", "@vaadin/common-frontend": "0.0.18", "@vaadin/router": "1.7.5", diff --git a/packages/java/tests/spring/endpoints/package-lock.json b/packages/java/tests/spring/endpoints/package-lock.json index 15ff699070..d16eaa1852 100644 --- a/packages/java/tests/spring/endpoints/package-lock.json +++ b/packages/java/tests/spring/endpoints/package-lock.json @@ -7,16 +7,19 @@ "name": "no-name", "license": "UNLICENSED", "dependencies": { - "@hilla/form": "2.3.0-alpha5", - "@hilla/frontend": "../../../../ts/hilla-frontend", - "@hilla/generator-typescript-cli": "../../../../ts/generator-typescript-cli", - "@hilla/generator-typescript-core": "../../../../ts/generator-typescript-core", - "@hilla/generator-typescript-plugin-backbone": "../../../../ts/generator-typescript-plugin-backbone", - "@hilla/generator-typescript-plugin-barrel": "../../../../ts/generator-typescript-plugin-barrel", - "@hilla/generator-typescript-plugin-client": "../../../../ts/generator-typescript-plugin-client", - "@hilla/generator-typescript-plugin-model": "../../../../ts/generator-typescript-plugin-model", - "@hilla/generator-typescript-plugin-push": "../../../../ts/generator-typescript-plugin-push", - "@hilla/generator-typescript-utils": "../../../../ts/generator-typescript-utils", + "@hilla/form": "file:../../../../ts/form", + "@hilla/frontend": "file:../../../../ts/frontend", + "@hilla/generator-typescript-cli": "file:../../../../ts/generator-typescript-cli", + "@hilla/generator-typescript-core": "file:../../../../ts/generator-typescript-core", + "@hilla/generator-typescript-plugin-backbone": "file:../../../../ts/generator-typescript-plugin-backbone", + "@hilla/generator-typescript-plugin-barrel": "file:../../../../ts/generator-typescript-plugin-barrel", + "@hilla/generator-typescript-plugin-client": "file:../../../../ts/generator-typescript-plugin-client", + "@hilla/generator-typescript-plugin-model": "file:../../../../ts/generator-typescript-plugin-model", + "@hilla/generator-typescript-plugin-push": "file:../../../../ts/generator-typescript-plugin-push", + "@hilla/generator-typescript-utils": "file:../../../../ts/generator-typescript-utils", + "@hilla/react-auth": "file:../../../../ts/react-auth", + "@hilla/react-form": "file:../../../../ts/react-form", + "@hilla/react-grid": "file:../../../../ts/react-grid", "@polymer/polymer": "3.5.1", "@vaadin/a11y-base": "24.2.0-alpha16", "@vaadin/accordion": "24.2.0-alpha16", @@ -110,8 +113,7 @@ }, "../../../../ts/form": { "name": "@hilla/form", - "version": "2.2.0-beta1", - "extraneous": true, + "version": "2.3.0-alpha5", "license": "Apache-2.0", "dependencies": { "@hilla/frontend": "*", @@ -134,6 +136,37 @@ "lit": "^2.3.0" } }, + "../../../../ts/frontend": { + "name": "@hilla/frontend", + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@vaadin/common-frontend": "^0.0.18", + "atmosphere.js": "^3.1.3", + "js-cookie": "^3.0.5" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@open-wc/testing": "^3.2.0", + "@types/atmosphere.js": "^2.1.3", + "@types/chai": "^4.3.5", + "@types/chai-as-promised": "^7.1.5", + "@types/js-cookie": "^3.0.3", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-as-promised": "^7.1.1", + "chai-dom": "^1.11.0", + "fetch-mock": "^9.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "lit": "^2.3.0" + } + }, "../../../../ts/generator-typescript-cli": { "name": "@hilla/generator-typescript-cli", "version": "2.3.0-alpha5", @@ -416,6 +449,7 @@ "../../../../ts/hilla-frontend": { "name": "@hilla/frontend", "version": "2.1.0-alpha4", + "extraneous": true, "license": "Apache-2.0", "dependencies": { "@vaadin/common-frontend": "^0.0.12", @@ -442,6 +476,90 @@ "lit": "^2.3.0" } }, + "../../../../ts/react-auth": { + "name": "@hilla/react-auth", + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/frontend": "*" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "react-router-dom": "^6.16.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18", + "react-router-dom": "^6" + } + }, + "../../../../ts/react-form": { + "name": "@hilla/react-form", + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/form": "*" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18" + } + }, + "../../../../ts/react-grid": { + "name": "@hilla/react-grid", + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/form": "*", + "@hilla/react-components": "2.2.0-alpha16" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18" + } + }, "node_modules/@ampproject/remapping": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", @@ -2714,19 +2832,11 @@ } }, "node_modules/@hilla/form": { - "version": "2.3.0-alpha5", - "resolved": "https://registry.npmjs.org/@hilla/form/-/form-2.3.0-alpha5.tgz", - "integrity": "sha512-ZFRx+Fd/qXBNB/mGN0yTH/VHgq3t661sUor4qdRQx7mWPrsImqw3TJ89eNVeVo7tXRyGy5kP7HKzVPVYze32bA==", - "dependencies": { - "@hilla/frontend": "*", - "validator": "^13.11.0" - }, - "peerDependencies": { - "lit": "^2.3.0" - } + "resolved": "../../../../ts/form", + "link": true }, "node_modules/@hilla/frontend": { - "resolved": "../../../../ts/hilla-frontend", + "resolved": "../../../../ts/frontend", "link": true }, "node_modules/@hilla/generator-typescript-cli": { @@ -2761,6 +2871,18 @@ "resolved": "../../../../ts/generator-typescript-utils", "link": true }, + "node_modules/@hilla/react-auth": { + "resolved": "../../../../ts/react-auth", + "link": true + }, + "node_modules/@hilla/react-form": { + "resolved": "../../../../ts/react-form", + "link": true + }, + "node_modules/@hilla/react-grid": { + "resolved": "../../../../ts/react-grid", + "link": true + }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -7512,14 +7634,6 @@ "punycode": "^2.1.0" } }, - "node_modules/validator": { - "version": "13.11.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-13.11.0.tgz", - "integrity": "sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ==", - "engines": { - "node": ">= 0.10" - } - }, "node_modules/vite": { "version": "4.4.9", "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz", @@ -9925,34 +10039,45 @@ "optional": true }, "@hilla/form": { - "version": "2.3.0-alpha5", - "resolved": "https://registry.npmjs.org/@hilla/form/-/form-2.3.0-alpha5.tgz", - "integrity": "sha512-ZFRx+Fd/qXBNB/mGN0yTH/VHgq3t661sUor4qdRQx7mWPrsImqw3TJ89eNVeVo7tXRyGy5kP7HKzVPVYze32bA==", + "version": "file:../../../../ts/form", "requires": { - "@hilla/frontend": "../../../../ts/hilla-frontend", + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/frontend": "*", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6", "validator": "^13.11.0" } }, "@hilla/frontend": { - "version": "file:../../../../ts/hilla-frontend", + "version": "file:../../../../ts/frontend", "requires": { "@esm-bundle/chai": "^4.3.4-fix.0", - "@open-wc/testing": "^2.5.33", - "@types/chai": "^4.2.21", + "@open-wc/testing": "^3.2.0", + "@types/atmosphere.js": "^2.1.3", + "@types/chai": "^4.3.5", + "@types/chai-as-promised": "^7.1.5", "@types/js-cookie": "^3.0.3", - "@types/mocha": "^9.0.0", - "@types/sinon": "^10.0.2", - "@types/sinon-chai": "^3.2.5", - "@types/validator": "^13.6.3", - "@vaadin/common-frontend": "^0.0.12", - "a-atmosphere-javascript": "3.1.3-2", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "@vaadin/common-frontend": "^0.0.18", + "atmosphere.js": "^3.1.3", + "chai-as-promised": "^7.1.1", "chai-dom": "^1.11.0", "fetch-mock": "^9.11.0", - "js-cookie": "^3.0.1", - "rimraf": "^3.0.2", - "sinon": "^11.1.2", + "js-cookie": "^3.0.5", + "sinon": "^15.2.0", "sinon-chai": "^3.7.0", - "typescript": "^5.0.1-rc" + "typescript": "^5.1.6" } }, "@hilla/generator-typescript-cli": { @@ -10152,6 +10277,68 @@ "typescript": "^5.1.6" } }, + "@hilla/react-auth": { + "version": "file:../../../../ts/react-auth", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/frontend": "*", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "react-router-dom": "^6.16.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + } + }, + "@hilla/react-form": { + "version": "file:../../../../ts/react-form", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/form": "*", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + } + }, + "@hilla/react-grid": { + "version": "file:../../../../ts/react-grid", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/form": "*", + "@hilla/react-components": "2.2.0-alpha16", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + } + }, "@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -13655,11 +13842,6 @@ "punycode": "^2.1.0" } }, - "validator": { - "version": "13.11.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-13.11.0.tgz", - "integrity": "sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ==" - }, "vite": { "version": "4.4.9", "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz", diff --git a/packages/java/tests/spring/endpoints/package.json b/packages/java/tests/spring/endpoints/package.json index 441ee61c96..2320a4ef81 100644 --- a/packages/java/tests/spring/endpoints/package.json +++ b/packages/java/tests/spring/endpoints/package.json @@ -3,16 +3,19 @@ "license": "UNLICENSED", "type": "module", "dependencies": { - "@hilla/form": "2.3.0-alpha5", - "@hilla/frontend": "../../../../ts/hilla-frontend", - "@hilla/generator-typescript-cli": "../../../../ts/generator-typescript-cli", - "@hilla/generator-typescript-core": "../../../../ts/generator-typescript-core", - "@hilla/generator-typescript-plugin-backbone": "../../../../ts/generator-typescript-plugin-backbone", - "@hilla/generator-typescript-plugin-barrel": "../../../../ts/generator-typescript-plugin-barrel", - "@hilla/generator-typescript-plugin-client": "../../../../ts/generator-typescript-plugin-client", - "@hilla/generator-typescript-plugin-model": "../../../../ts/generator-typescript-plugin-model", - "@hilla/generator-typescript-plugin-push": "../../../../ts/generator-typescript-plugin-push", - "@hilla/generator-typescript-utils": "../../../../ts/generator-typescript-utils", + "@hilla/form": "file:../../../../ts/form", + "@hilla/frontend": "file:../../../../ts/frontend", + "@hilla/generator-typescript-cli": "file:../../../../ts/generator-typescript-cli", + "@hilla/generator-typescript-core": "file:../../../../ts/generator-typescript-core", + "@hilla/generator-typescript-plugin-backbone": "file:../../../../ts/generator-typescript-plugin-backbone", + "@hilla/generator-typescript-plugin-barrel": "file:../../../../ts/generator-typescript-plugin-barrel", + "@hilla/generator-typescript-plugin-client": "file:../../../../ts/generator-typescript-plugin-client", + "@hilla/generator-typescript-plugin-model": "file:../../../../ts/generator-typescript-plugin-model", + "@hilla/generator-typescript-plugin-push": "file:../../../../ts/generator-typescript-plugin-push", + "@hilla/generator-typescript-utils": "file:../../../../ts/generator-typescript-utils", + "@hilla/react-auth": "file:../../../../ts/react-auth", + "@hilla/react-form": "file:../../../../ts/react-form", + "@hilla/react-grid": "file:../../../../ts/react-grid", "@polymer/polymer": "3.5.1", "@vaadin/a11y-base": "24.2.0-alpha16", "@vaadin/accordion": "24.2.0-alpha16", @@ -205,7 +208,7 @@ "workbox-core": "7.0.0", "workbox-precaching": "7.0.0" }, - "hash": "59abee59e375f62daa0b7ff8be48faf218271fb72df78af36363c4cc91f44332" + "hash": "3ecb2a323a0d89381773d8b597dd8ec5378ff0afca6a2b4331fa28b0a76dd54a" }, "overrides": { "@vaadin/common-frontend": "$@vaadin/common-frontend", diff --git a/packages/java/tests/spring/native/package-lock.json b/packages/java/tests/spring/native/package-lock.json index b8763d8274..a93b85adb5 100644 --- a/packages/java/tests/spring/native/package-lock.json +++ b/packages/java/tests/spring/native/package-lock.json @@ -7,25 +7,29 @@ "name": "no-name", "license": "UNLICENSED", "dependencies": { - "@hilla/frontend": "../../../../ts/hilla-frontend", - "@hilla/generator-typescript-cli": "../../../../ts/generator-typescript-cli", - "@hilla/generator-typescript-core": "../../../../ts/generator-typescript-core", - "@hilla/generator-typescript-plugin-backbone": "../../../../ts/generator-typescript-plugin-backbone", - "@hilla/generator-typescript-plugin-barrel": "../../../../ts/generator-typescript-plugin-barrel", - "@hilla/generator-typescript-plugin-client": "../../../../ts/generator-typescript-plugin-client", - "@hilla/generator-typescript-plugin-model": "../../../../ts/generator-typescript-plugin-model", - "@hilla/generator-typescript-plugin-push": "../../../../ts/generator-typescript-plugin-push", - "@hilla/generator-typescript-utils": "../../../../ts/generator-typescript-utils", + "@hilla/form": "file:../../../../ts/form", + "@hilla/frontend": "file:../../../../ts/frontend", + "@hilla/generator-typescript-cli": "file:../../../../ts/generator-typescript-cli", + "@hilla/generator-typescript-core": "file:../../../../ts/generator-typescript-core", + "@hilla/generator-typescript-plugin-backbone": "file:../../../../ts/generator-typescript-plugin-backbone", + "@hilla/generator-typescript-plugin-barrel": "file:../../../../ts/generator-typescript-plugin-barrel", + "@hilla/generator-typescript-plugin-client": "file:../../../../ts/generator-typescript-plugin-client", + "@hilla/generator-typescript-plugin-model": "file:../../../../ts/generator-typescript-plugin-model", + "@hilla/generator-typescript-plugin-push": "file:../../../../ts/generator-typescript-plugin-push", + "@hilla/generator-typescript-utils": "file:../../../../ts/generator-typescript-utils", + "@hilla/react-auth": "file:../../../../ts/react-auth", "@hilla/react-components": "2.1.0-alpha9", + "@hilla/react-form": "file:../../../../ts/react-form", + "@hilla/react-grid": "file:../../../../ts/react-grid", "@polymer/polymer": "3.5.1", "@vaadin/common-frontend": "0.0.18", - "@vaadin/icon": "24.1.0-alpha6", - "@vaadin/icons": "24.1.0-alpha6", - "@vaadin/polymer-legacy-adapter": "24.1.0-alpha6", + "@vaadin/icon": "24.2.0-alpha16", + "@vaadin/icons": "24.2.0-alpha16", + "@vaadin/polymer-legacy-adapter": "24.2.0-alpha16", "@vaadin/router": "1.7.5", - "@vaadin/tooltip": "24.1.0-alpha6", - "@vaadin/vaadin-lumo-styles": "24.1.0-alpha6", - "@vaadin/vaadin-themable-mixin": "24.1.0-alpha6", + "@vaadin/tooltip": "24.2.0-alpha16", + "@vaadin/vaadin-lumo-styles": "24.2.0-alpha16", + "@vaadin/vaadin-themable-mixin": "24.2.0-alpha16", "construct-style-sheets-polyfill": "3.1.0", "lit": "2.7.6", "react": "^18.2.0", @@ -56,7 +60,6 @@ "../../../../ts/form": { "name": "@hilla/form", "version": "2.2.0-beta1", - "extraneous": true, "license": "Apache-2.0", "dependencies": { "@hilla/frontend": "*", @@ -79,12 +82,42 @@ "lit": "^2.3.0" } }, + "../../../../ts/frontend": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@vaadin/common-frontend": "^0.0.18", + "atmosphere.js": "^3.1.3", + "js-cookie": "^3.0.5" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@open-wc/testing": "^3.2.0", + "@types/atmosphere.js": "^2.1.3", + "@types/chai": "^4.3.5", + "@types/chai-as-promised": "^7.1.5", + "@types/js-cookie": "^3.0.3", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-as-promised": "^7.1.1", + "chai-dom": "^1.11.0", + "fetch-mock": "^9.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "lit": "^2.3.0" + } + }, "../../../../ts/generator-typescript-cli": { "name": "@hilla/generator-typescript-cli", - "version": "2.2.0-beta1", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { - "@hilla/generator-typescript-utils": "^2.2.0-beta1", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "get-stdin": "^9.0.0", "meow": "^12.1.0" }, @@ -92,7 +125,7 @@ "tsgen": "bin/index.js" }, "devDependencies": { - "@hilla/generator-typescript-core": "^2.2.0-beta1", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/chai-as-promised": "^7.1.5", "@types/mocha": "^10.0.1", @@ -115,16 +148,16 @@ "node": ">= 16.13" }, "peerDependencies": { - "@hilla/generator-typescript-core": "^2.2.0-beta1" + "@hilla/generator-typescript-core": "^2.3.0-alpha5" } }, "../../../../ts/generator-typescript-core": { "name": "@hilla/generator-typescript-core", - "version": "2.2.0-beta1", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { "@apidevtools/swagger-parser": "^10.1.0", - "@hilla/generator-typescript-utils": "^2.2.0-beta1", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "meow": "^12.1.0", "openapi-types": "^12.1.3", "typescript": "^5.1.6" @@ -151,17 +184,17 @@ }, "../../../../ts/generator-typescript-plugin-backbone": { "name": "@hilla/generator-typescript-plugin-backbone", - "version": "2.2.0-beta1", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { - "@hilla/generator-typescript-utils": "^2.2.0-beta1", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "fast-deep-equal": "^3.1.3", "openapi-types": "^12.1.3", "typescript": "^5.1.6" }, "devDependencies": { - "@hilla/generator-typescript-core": "^2.2.0-beta1", - "@hilla/generator-typescript-plugin-client": "^2.2.0-beta1", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", "@types/node": "^20.5.0", @@ -182,21 +215,21 @@ "node": ">= 16.13" }, "peerDependencies": { - "@hilla/generator-typescript-core": "^2.2.0-beta1", - "@hilla/generator-typescript-plugin-client": "^2.2.0-beta1" + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha5" } }, "../../../../ts/generator-typescript-plugin-barrel": { "name": "@hilla/generator-typescript-plugin-barrel", - "version": "2.2.0-beta1", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { - "@hilla/generator-typescript-utils": "^2.2.0-beta1", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "typescript": "^5.1.6" }, "devDependencies": { - "@hilla/generator-typescript-core": "^2.2.0-beta1", - "@hilla/generator-typescript-plugin-backbone": "^2.2.0-beta1", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-backbone": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", "@types/node": "^20.5.0", @@ -217,20 +250,20 @@ "node": ">= 16.13" }, "peerDependencies": { - "@hilla/generator-typescript-core": "^2.2.0-beta1", - "@hilla/generator-typescript-plugin-backbone": "^2.2.0-beta1" + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-backbone": "^2.3.0-alpha5" } }, "../../../../ts/generator-typescript-plugin-client": { "name": "@hilla/generator-typescript-plugin-client", - "version": "2.2.0-beta1", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { - "@hilla/generator-typescript-utils": "^2.2.0-beta1", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "typescript": "^5.1.6" }, "devDependencies": { - "@hilla/generator-typescript-core": "^2.2.0-beta1", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", "@types/node": "^20.5.0", @@ -251,22 +284,22 @@ "node": ">= 16.13" }, "peerDependencies": { - "@hilla/generator-typescript-core": "^2.2.0-beta1" + "@hilla/generator-typescript-core": "^2.3.0-alpha5" } }, "../../../../ts/generator-typescript-plugin-model": { "name": "@hilla/generator-typescript-plugin-model", - "version": "2.2.0-beta1", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { - "@hilla/generator-typescript-utils": "^2.2.0-beta1", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "fast-deep-equal": "^3.1.3", "openapi-types": "^12.1.3", "typescript": "^5.1.6" }, "devDependencies": { - "@hilla/generator-typescript-core": "^2.2.0-beta1", - "@hilla/generator-typescript-plugin-client": "^2.2.0-beta1", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", "@types/node": "^20.5.0", @@ -287,24 +320,24 @@ "node": ">= 16.13" }, "peerDependencies": { - "@hilla/form": "^2.2.0-beta1", - "@hilla/generator-typescript-core": "^2.2.0-beta1", - "@hilla/generator-typescript-plugin-backbone": "^2.2.0-beta1" + "@hilla/form": "^2.3.0-alpha5", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-backbone": "^2.3.0-alpha5" } }, "../../../../ts/generator-typescript-plugin-push": { "name": "@hilla/generator-typescript-plugin-push", - "version": "2.2.0-beta1", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { - "@hilla/generator-typescript-utils": "^2.2.0-beta1", + "@hilla/generator-typescript-utils": "^2.3.0-alpha5", "fast-deep-equal": "^3.1.3", "openapi-types": "^12.1.3", "typescript": "^5.1.6" }, "devDependencies": { - "@hilla/generator-typescript-core": "^2.2.0-beta1", - "@hilla/generator-typescript-plugin-client": "^2.2.0-beta1", + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha5", "@types/chai": "^4.3.5", "@types/mocha": "^10.0.1", "@types/node": "^20.5.0", @@ -325,13 +358,13 @@ "node": ">= 16.13" }, "peerDependencies": { - "@hilla/generator-typescript-core": "^2.2.0-beta1", - "@hilla/generator-typescript-plugin-client": "^2.2.0-beta1" + "@hilla/generator-typescript-core": "^2.3.0-alpha5", + "@hilla/generator-typescript-plugin-client": "^2.3.0-alpha5" } }, "../../../../ts/generator-typescript-utils": { "name": "@hilla/generator-typescript-utils", - "version": "2.2.0-beta1", + "version": "2.3.0-alpha5", "license": "Apache 2.0", "dependencies": { "pino": "^8.15.0", @@ -361,6 +394,7 @@ "../../../../ts/hilla-frontend": { "name": "@hilla/frontend", "version": "2.2.0-beta1", + "extraneous": true, "license": "Apache-2.0", "dependencies": { "@vaadin/common-frontend": "^0.0.18", @@ -389,6 +423,87 @@ "lit": "^2.3.0" } }, + "../../../../ts/react-auth": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/frontend": "*" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "react-router-dom": "^6.16.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18", + "react-router-dom": "^6" + } + }, + "../../../../ts/react-form": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/form": "*" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18" + } + }, + "../../../../ts/react-grid": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/form": "*", + "@hilla/react-components": "2.2.0-alpha16" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18" + } + }, "node_modules/@ampproject/remapping": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", @@ -2439,8 +2554,12 @@ "node": ">=12" } }, + "node_modules/@hilla/form": { + "resolved": "../../../../ts/form", + "link": true + }, "node_modules/@hilla/frontend": { - "resolved": "../../../../ts/hilla-frontend", + "resolved": "../../../../ts/frontend", "link": true }, "node_modules/@hilla/generator-typescript-cli": { @@ -2475,6 +2594,10 @@ "resolved": "../../../../ts/generator-typescript-utils", "link": true }, + "node_modules/@hilla/react-auth": { + "resolved": "../../../../ts/react-auth", + "link": true + }, "node_modules/@hilla/react-components": { "version": "2.1.0-alpha9", "resolved": "https://registry.npmjs.org/@hilla/react-components/-/react-components-2.1.0-alpha9.tgz", @@ -2553,6 +2676,14 @@ } } }, + "node_modules/@hilla/react-form": { + "resolved": "../../../../ts/react-form", + "link": true + }, + "node_modules/@hilla/react-grid": { + "resolved": "../../../../ts/react-grid", + "link": true + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", @@ -2869,13 +3000,13 @@ "integrity": "sha512-NfQ4gyz38SL8sDNrSixxU2Os1a5xcdFxipAFxYEuLUlvU2uDwS4NUpsImcf1//SlWItCVMMLiylsxbmNMToV/g==" }, "node_modules/@vaadin/a11y-base": { - "version": "24.1.0-alpha6", - "resolved": "https://registry.npmjs.org/@vaadin/a11y-base/-/a11y-base-24.1.0-alpha6.tgz", - "integrity": "sha512-6gg6Qgh4yfM9zXRJBFFSPumOFyiSm8R2A/YuTlPb4lAE6eWRu2ze5F166HR4vk/B6E9Z0OPHN00rLAAkP7xeKA==", + "version": "24.2.0-alpha16", + "resolved": "https://registry.npmjs.org/@vaadin/a11y-base/-/a11y-base-24.2.0-alpha16.tgz", + "integrity": "sha512-fDdShC3VTVSeKvhvLNz57aV5YHuzYwVZbxk95gt7/oDaRjDdtwB3UNbfrocYeA9K7ZYelKYaJKGgOdB61D9nvw==", "dependencies": { "@open-wc/dedupe-mixin": "^1.3.0", "@polymer/polymer": "^3.0.0", - "@vaadin/component-base": "24.1.0-alpha6", + "@vaadin/component-base": "24.2.0-alpha16", "lit": "^2.0.0" } }, @@ -3372,9 +3503,9 @@ } }, "node_modules/@vaadin/component-base": { - "version": "24.1.0-alpha6", - "resolved": "https://registry.npmjs.org/@vaadin/component-base/-/component-base-24.1.0-alpha6.tgz", - "integrity": "sha512-NevzKyke+u/ZiVQpXx6wbzbKZrYQUlxrlK5LOyK80RAHXUZ3qBscs1bCtr/7VIDWwpjSNFgPiBXeMHgVMiqGeg==", + "version": "24.2.0-alpha16", + "resolved": "https://registry.npmjs.org/@vaadin/component-base/-/component-base-24.2.0-alpha16.tgz", + "integrity": "sha512-CgYhep24uHL94Zc1g/GkUMFf7J0xcYaPP0Nx7ktkGIk1Vw/5gcoRgG8JiTjE96s4n1akEj33IGRJ+JN1kPgLlw==", "dependencies": { "@open-wc/dedupe-mixin": "^1.3.0", "@polymer/polymer": "^3.0.0", @@ -4135,24 +4266,24 @@ } }, "node_modules/@vaadin/icon": { - "version": "24.1.0-alpha6", - "resolved": "https://registry.npmjs.org/@vaadin/icon/-/icon-24.1.0-alpha6.tgz", - "integrity": "sha512-FAVnwyL31sMBELo43ctdAFCpzLyOyzZX7BMsqskxioygzqMg2HN31YtBMUp6oZGmfxgGvzkSgpbkUvJhQkgP/w==", + "version": "24.2.0-alpha16", + "resolved": "https://registry.npmjs.org/@vaadin/icon/-/icon-24.2.0-alpha16.tgz", + "integrity": "sha512-LofovgfWl2Tv1+zuq/h3v48qJ4o9nDt8vNVCtKZ52reEzP9S589oSyPi1nnGCCeDMmnXq0rpo/Qga+ITmATFyA==", "dependencies": { "@polymer/polymer": "^3.0.0", - "@vaadin/component-base": "24.1.0-alpha6", - "@vaadin/vaadin-lumo-styles": "24.1.0-alpha6", - "@vaadin/vaadin-themable-mixin": "24.1.0-alpha6", + "@vaadin/component-base": "24.2.0-alpha16", + "@vaadin/vaadin-lumo-styles": "24.2.0-alpha16", + "@vaadin/vaadin-themable-mixin": "24.2.0-alpha16", "lit": "^2.0.0" } }, "node_modules/@vaadin/icons": { - "version": "24.1.0-alpha6", - "resolved": "https://registry.npmjs.org/@vaadin/icons/-/icons-24.1.0-alpha6.tgz", - "integrity": "sha512-OdMJG0JvEyuD1wLD9fxPZ/qZGX4TM+5nwvXzW2EtxxVml2GWN9W7M5oV3pUPG/Q9aF+WaoZcGkyT1pOUkFQm7g==", + "version": "24.2.0-alpha16", + "resolved": "https://registry.npmjs.org/@vaadin/icons/-/icons-24.2.0-alpha16.tgz", + "integrity": "sha512-twY02/slu1RkVLG8iWGGbN4NwcRdvjGm1UNbcEkTqo8BPPameGccVSdStLYq2rGQlnZhhcg7nWmtqG//sl9bRQ==", "dependencies": { "@polymer/polymer": "^3.0.0", - "@vaadin/icon": "24.1.0-alpha6" + "@vaadin/icon": "24.2.0-alpha16" } }, "node_modules/@vaadin/input-container": { @@ -4728,17 +4859,17 @@ } }, "node_modules/@vaadin/overlay": { - "version": "24.1.0-alpha6", - "resolved": "https://registry.npmjs.org/@vaadin/overlay/-/overlay-24.1.0-alpha6.tgz", - "integrity": "sha512-LRiECwUD9yBYDibkGAxjQyb4UBIegLC0ZeT8/F7GMCvDffR9f6Nx71xyR4aieoDrpBwKtqA9HDzWN0AnLCx9aA==", + "version": "24.2.0-alpha16", + "resolved": "https://registry.npmjs.org/@vaadin/overlay/-/overlay-24.2.0-alpha16.tgz", + "integrity": "sha512-KA8c2DfgL4LCfksFEHF3J7fyDO61oPxMI5LsdbldWHU3QRz09Gv0fHODexrjbg8mZAFZ+khc5oT2wOYGnJ8g+Q==", "dependencies": { "@open-wc/dedupe-mixin": "^1.3.0", "@polymer/polymer": "^3.0.0", - "@vaadin/a11y-base": "24.1.0-alpha6", - "@vaadin/component-base": "24.1.0-alpha6", - "@vaadin/vaadin-lumo-styles": "24.1.0-alpha6", - "@vaadin/vaadin-material-styles": "24.1.0-alpha6", - "@vaadin/vaadin-themable-mixin": "24.1.0-alpha6" + "@vaadin/a11y-base": "24.2.0-alpha16", + "@vaadin/component-base": "24.2.0-alpha16", + "@vaadin/vaadin-lumo-styles": "24.2.0-alpha16", + "@vaadin/vaadin-material-styles": "24.2.0-alpha16", + "@vaadin/vaadin-themable-mixin": "24.2.0-alpha16" } }, "node_modules/@vaadin/password-field": { @@ -4777,12 +4908,12 @@ } }, "node_modules/@vaadin/polymer-legacy-adapter": { - "version": "24.1.0-alpha6", - "resolved": "https://registry.npmjs.org/@vaadin/polymer-legacy-adapter/-/polymer-legacy-adapter-24.1.0-alpha6.tgz", - "integrity": "sha512-cVLSro6bNEjCkrK4aScTRAVJfVfyGfa2pwq9tdYkSWabGbE2NL32rGNRCPEJJvu1Bn82qAD/UIZ6LxLNRk/Zyw==", + "version": "24.2.0-alpha16", + "resolved": "https://registry.npmjs.org/@vaadin/polymer-legacy-adapter/-/polymer-legacy-adapter-24.2.0-alpha16.tgz", + "integrity": "sha512-E5IRICpBwcDqYTtnTaW39K2uGlQl9OMRLoZFENx7r3amTgc/b8fSJtRsXjh943lfcFzl8APoK2izEak/it25FQ==", "dependencies": { "@polymer/polymer": "^3.0.0", - "@vaadin/vaadin-themable-mixin": "24.1.0-alpha6", + "@vaadin/vaadin-themable-mixin": "24.2.0-alpha16", "lit": "^2.0.0" } }, @@ -5300,17 +5431,17 @@ } }, "node_modules/@vaadin/tooltip": { - "version": "24.1.0-alpha6", - "resolved": "https://registry.npmjs.org/@vaadin/tooltip/-/tooltip-24.1.0-alpha6.tgz", - "integrity": "sha512-6goTYOrKEIrxoUgjxCBXUu7szX5GF1rEJ8m09QeEcdHFH3kn7pdQW/nGp7gE9cOloV1jrw/ySE+6SIiRAarzKw==", + "version": "24.2.0-alpha16", + "resolved": "https://registry.npmjs.org/@vaadin/tooltip/-/tooltip-24.2.0-alpha16.tgz", + "integrity": "sha512-7YTjZ3gDdU2t7O5+J9mcwDrQXx7EA4oVyvIXsAbOrtuZQe2PRmFVm9Sv5tUsWaWVpb/4CP8tfvwt6NFHFSNLCA==", "dependencies": { "@polymer/polymer": "^3.0.0", - "@vaadin/a11y-base": "24.1.0-alpha6", - "@vaadin/component-base": "24.1.0-alpha6", - "@vaadin/overlay": "24.1.0-alpha6", - "@vaadin/vaadin-lumo-styles": "24.1.0-alpha6", - "@vaadin/vaadin-material-styles": "24.1.0-alpha6", - "@vaadin/vaadin-themable-mixin": "24.1.0-alpha6" + "@vaadin/a11y-base": "24.2.0-alpha16", + "@vaadin/component-base": "24.2.0-alpha16", + "@vaadin/overlay": "24.2.0-alpha16", + "@vaadin/vaadin-lumo-styles": "24.2.0-alpha16", + "@vaadin/vaadin-material-styles": "24.2.0-alpha16", + "@vaadin/vaadin-themable-mixin": "24.2.0-alpha16" } }, "node_modules/@vaadin/upload": { @@ -5367,28 +5498,28 @@ "integrity": "sha512-N6a5nLT/ytEUlpPo+nvdCKIGoyNjPsj3rzPGvGYK8x9Ceg76OTe1xI/GtN71mRW9e2HUScR0kCNOkl1Z63YDjw==" }, "node_modules/@vaadin/vaadin-lumo-styles": { - "version": "24.1.0-alpha6", - "resolved": "https://registry.npmjs.org/@vaadin/vaadin-lumo-styles/-/vaadin-lumo-styles-24.1.0-alpha6.tgz", - "integrity": "sha512-8RfcnLAjVVP6ZkEFDtxUnsgvZOj0LbCxujQSj24Iekr5hM3Kw1cSNUaT8pj+Jz8CKNDuO4RnYH+FMLeP970Obg==", + "version": "24.2.0-alpha16", + "resolved": "https://registry.npmjs.org/@vaadin/vaadin-lumo-styles/-/vaadin-lumo-styles-24.2.0-alpha16.tgz", + "integrity": "sha512-HZvCDFHXj9eKw6BUeJ7P2TFNG+xrZNDoNJ/gJpgBbSRekTvFZAHB76ZuFwqhvCmvuZUvdcbF1NNuh00LPmZMoA==", "dependencies": { "@polymer/polymer": "^3.0.0", - "@vaadin/icon": "24.1.0-alpha6", - "@vaadin/vaadin-themable-mixin": "24.1.0-alpha6" + "@vaadin/icon": "24.2.0-alpha16", + "@vaadin/vaadin-themable-mixin": "24.2.0-alpha16" } }, "node_modules/@vaadin/vaadin-material-styles": { - "version": "24.1.0-alpha6", - "resolved": "https://registry.npmjs.org/@vaadin/vaadin-material-styles/-/vaadin-material-styles-24.1.0-alpha6.tgz", - "integrity": "sha512-WE7H2iTMgPBRLJ7wHihl5TQeNE0GkTsSE5LuUn+iZjBMgIuW9rnGwkb+SpL8nBcRvzmwvyHd7q1DNLgxQcd2EA==", + "version": "24.2.0-alpha16", + "resolved": "https://registry.npmjs.org/@vaadin/vaadin-material-styles/-/vaadin-material-styles-24.2.0-alpha16.tgz", + "integrity": "sha512-DcN1kIdnwiDVUIxMiYrL2Pav7oA1Jer9Q+oziLVdEOZ49NKUeo3k0AduYvt05fasf+rrC+6Qd0OHU1r1lW7iHg==", "dependencies": { "@polymer/polymer": "^3.0.0", - "@vaadin/vaadin-themable-mixin": "24.1.0-alpha6" + "@vaadin/vaadin-themable-mixin": "24.2.0-alpha16" } }, "node_modules/@vaadin/vaadin-themable-mixin": { - "version": "24.1.0-alpha6", - "resolved": "https://registry.npmjs.org/@vaadin/vaadin-themable-mixin/-/vaadin-themable-mixin-24.1.0-alpha6.tgz", - "integrity": "sha512-p8m9I/eYDTCbSRwRXGXg77Bxe84zeCTjw3Obb6mUlI7VgEmC4sAZ/yJ4RvancLFAH8c0zrnLg1F8kukSsbA7WA==", + "version": "24.2.0-alpha16", + "resolved": "https://registry.npmjs.org/@vaadin/vaadin-themable-mixin/-/vaadin-themable-mixin-24.2.0-alpha16.tgz", + "integrity": "sha512-vXdhYK2ZTOwFFJr4i+t6dSzA36cih6iRfDQ8UvnnnT0JwuAaXvXQjlAjs2i2Qmdes0k7ia5EQ6wHrm532iTBlg==", "dependencies": { "@open-wc/dedupe-mixin": "^1.3.0", "lit": "^2.0.0" diff --git a/packages/java/tests/spring/native/package.json b/packages/java/tests/spring/native/package.json index 25f28aac29..7bf107fb94 100644 --- a/packages/java/tests/spring/native/package.json +++ b/packages/java/tests/spring/native/package.json @@ -3,16 +3,20 @@ "license": "UNLICENSED", "type": "module", "dependencies": { - "@hilla/frontend": "../../../../ts/hilla-frontend", - "@hilla/generator-typescript-cli": "../../../../ts/generator-typescript-cli", - "@hilla/generator-typescript-core": "../../../../ts/generator-typescript-core", - "@hilla/generator-typescript-plugin-backbone": "../../../../ts/generator-typescript-plugin-backbone", - "@hilla/generator-typescript-plugin-barrel": "../../../../ts/generator-typescript-plugin-barrel", - "@hilla/generator-typescript-plugin-client": "../../../../ts/generator-typescript-plugin-client", - "@hilla/generator-typescript-plugin-model": "../../../../ts/generator-typescript-plugin-model", - "@hilla/generator-typescript-plugin-push": "../../../../ts/generator-typescript-plugin-push", - "@hilla/generator-typescript-utils": "../../../../ts/generator-typescript-utils", + "@hilla/form": "file:../../../../ts/form", + "@hilla/frontend": "file:../../../../ts/frontend", + "@hilla/generator-typescript-cli": "file:../../../../ts/generator-typescript-cli", + "@hilla/generator-typescript-core": "file:../../../../ts/generator-typescript-core", + "@hilla/generator-typescript-plugin-backbone": "file:../../../../ts/generator-typescript-plugin-backbone", + "@hilla/generator-typescript-plugin-barrel": "file:../../../../ts/generator-typescript-plugin-barrel", + "@hilla/generator-typescript-plugin-client": "file:../../../../ts/generator-typescript-plugin-client", + "@hilla/generator-typescript-plugin-model": "file:../../../../ts/generator-typescript-plugin-model", + "@hilla/generator-typescript-plugin-push": "file:../../../../ts/generator-typescript-plugin-push", + "@hilla/generator-typescript-utils": "file:../../../../ts/generator-typescript-utils", + "@hilla/react-auth": "file:../../../../ts/react-auth", "@hilla/react-components": "2.1.0-alpha9", + "@hilla/react-form": "file:../../../../ts/react-form", + "@hilla/react-grid": "file:../../../../ts/react-grid", "@polymer/polymer": "3.5.1", "@vaadin/common-frontend": "0.0.18", "@vaadin/icon": "24.2.0-alpha16", diff --git a/packages/java/tests/spring/react-grid-test/frontend/views/ReadOnlyGridWithHeaderFilter.tsx b/packages/java/tests/spring/react-grid-test/frontend/views/ReadOnlyGridWithHeaderFilter.tsx index c6b9de122d..578414b8e8 100644 --- a/packages/java/tests/spring/react-grid-test/frontend/views/ReadOnlyGridWithHeaderFilter.tsx +++ b/packages/java/tests/spring/react-grid-test/frontend/views/ReadOnlyGridWithHeaderFilter.tsx @@ -1,4 +1,4 @@ -import { ModelConstructor } from '@hilla/form'; +import { AbstractModel, type DetachedModelConstructor } from '@hilla/form'; import { Button } from '@hilla/react-components/Button.js'; import { AutoGrid, CrudService } from '@hilla/react-grid'; import CompanyModel from 'Frontend/generated/dev/hilla/test/reactgrid/CompanyModel'; @@ -7,7 +7,7 @@ import { CompanyService, PersonService } from 'Frontend/generated/endpoints'; import { useState } from 'react'; export function ReadOnlyGridWithHeaderFilters() { - const [model, setModel] = useState[]>([PersonModel]); + const [model, setModel] = useState[]>([PersonModel]); const [service, setService] = useState>(PersonService); const [headerFilters, setHeaderFilters] = useState(true); return ( diff --git a/packages/java/tests/spring/security-contextpath/package-lock.json b/packages/java/tests/spring/security-contextpath/package-lock.json index fe4ec26098..67c573452c 100644 --- a/packages/java/tests/spring/security-contextpath/package-lock.json +++ b/packages/java/tests/spring/security-contextpath/package-lock.json @@ -8,16 +8,19 @@ "license": "UNLICENSED", "dependencies": { "@adobe/lit-mobx": "2.0.0-rc.4", - "@hilla/form": "2.3.0-alpha5", - "@hilla/frontend": "../../../../ts/hilla-frontend", - "@hilla/generator-typescript-cli": "../../../../ts/generator-typescript-cli", - "@hilla/generator-typescript-core": "../../../../ts/generator-typescript-core", - "@hilla/generator-typescript-plugin-backbone": "../../../../ts/generator-typescript-plugin-backbone", - "@hilla/generator-typescript-plugin-barrel": "../../../../ts/generator-typescript-plugin-barrel", - "@hilla/generator-typescript-plugin-client": "../../../../ts/generator-typescript-plugin-client", - "@hilla/generator-typescript-plugin-model": "../../../../ts/generator-typescript-plugin-model", - "@hilla/generator-typescript-plugin-push": "../../../../ts/generator-typescript-plugin-push", - "@hilla/generator-typescript-utils": "../../../../ts/generator-typescript-utils", + "@hilla/form": "file:../../../../ts/form", + "@hilla/frontend": "file:../../../../ts/frontend", + "@hilla/generator-typescript-cli": "file:../../../../ts/generator-typescript-cli", + "@hilla/generator-typescript-core": "file:../../../../ts/generator-typescript-core", + "@hilla/generator-typescript-plugin-backbone": "file:../../../../ts/generator-typescript-plugin-backbone", + "@hilla/generator-typescript-plugin-barrel": "file:../../../../ts/generator-typescript-plugin-barrel", + "@hilla/generator-typescript-plugin-client": "file:../../../../ts/generator-typescript-plugin-client", + "@hilla/generator-typescript-plugin-model": "file:../../../../ts/generator-typescript-plugin-model", + "@hilla/generator-typescript-plugin-push": "file:../../../../ts/generator-typescript-plugin-push", + "@hilla/generator-typescript-utils": "file:../../../../ts/generator-typescript-utils", + "@hilla/react-auth": "file:../../../../ts/react-auth", + "@hilla/react-form": "file:../../../../ts/react-form", + "@hilla/react-grid": "file:../../../../ts/react-grid", "@polymer/iron-icon": "3.0.1", "@polymer/iron-iconset-svg": "3.0.1", "@polymer/iron-list": "3.1.0", @@ -118,7 +121,6 @@ "../../../../ts/form": { "name": "@hilla/form", "version": "2.3.0-alpha5", - "extraneous": true, "license": "Apache-2.0", "dependencies": { "@hilla/frontend": "*", @@ -141,6 +143,36 @@ "lit": "^2.3.0" } }, + "../../../../ts/frontend": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@vaadin/common-frontend": "^0.0.18", + "atmosphere.js": "^3.1.3", + "js-cookie": "^3.0.5" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@open-wc/testing": "^3.2.0", + "@types/atmosphere.js": "^2.1.3", + "@types/chai": "^4.3.5", + "@types/chai-as-promised": "^7.1.5", + "@types/js-cookie": "^3.0.3", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-as-promised": "^7.1.1", + "chai-dom": "^1.11.0", + "fetch-mock": "^9.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "lit": "^2.3.0" + } + }, "../../../../ts/generator-typescript-cli": { "name": "@hilla/generator-typescript-cli", "version": "2.3.0-alpha5", @@ -463,6 +495,7 @@ "../../../../ts/hilla-frontend": { "name": "@hilla/frontend", "version": "2.1.0-alpha4", + "extraneous": true, "license": "Apache-2.0", "dependencies": { "@vaadin/common-frontend": "^0.0.12", @@ -489,6 +522,87 @@ "lit": "^2.3.0" } }, + "../../../../ts/react-auth": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/frontend": "*" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "react-router-dom": "^6.16.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18", + "react-router-dom": "^6" + } + }, + "../../../../ts/react-form": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/form": "*" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18" + } + }, + "../../../../ts/react-grid": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/form": "*", + "@hilla/react-components": "2.2.0-alpha16" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18" + } + }, "node_modules/@adobe/lit-mobx": { "version": "2.0.0-rc.4", "license": "Apache-2.0", @@ -2670,19 +2784,11 @@ } }, "node_modules/@hilla/form": { - "version": "2.3.0-alpha5", - "resolved": "https://registry.npmjs.org/@hilla/form/-/form-2.3.0-alpha5.tgz", - "integrity": "sha512-ZFRx+Fd/qXBNB/mGN0yTH/VHgq3t661sUor4qdRQx7mWPrsImqw3TJ89eNVeVo7tXRyGy5kP7HKzVPVYze32bA==", - "dependencies": { - "@hilla/frontend": "*", - "validator": "^13.11.0" - }, - "peerDependencies": { - "lit": "^2.3.0" - } + "resolved": "../../../../ts/form", + "link": true }, "node_modules/@hilla/frontend": { - "resolved": "../../../../ts/hilla-frontend", + "resolved": "../../../../ts/frontend", "link": true }, "node_modules/@hilla/generator-typescript-cli": { @@ -2717,6 +2823,18 @@ "resolved": "../../../../ts/generator-typescript-utils", "link": true }, + "node_modules/@hilla/react-auth": { + "resolved": "../../../../ts/react-auth", + "link": true + }, + "node_modules/@hilla/react-form": { + "resolved": "../../../../ts/react-form", + "link": true + }, + "node_modules/@hilla/react-grid": { + "resolved": "../../../../ts/react-grid", + "link": true + }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -7391,14 +7509,6 @@ "punycode": "^2.1.0" } }, - "node_modules/validator": { - "version": "13.11.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-13.11.0.tgz", - "integrity": "sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ==", - "engines": { - "node": ">= 0.10" - } - }, "node_modules/vite": { "version": "4.4.9", "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz", @@ -9632,34 +9742,45 @@ "optional": true }, "@hilla/form": { - "version": "2.3.0-alpha5", - "resolved": "https://registry.npmjs.org/@hilla/form/-/form-2.3.0-alpha5.tgz", - "integrity": "sha512-ZFRx+Fd/qXBNB/mGN0yTH/VHgq3t661sUor4qdRQx7mWPrsImqw3TJ89eNVeVo7tXRyGy5kP7HKzVPVYze32bA==", + "version": "file:../../../../ts/form", "requires": { - "@hilla/frontend": "../../../../ts/hilla-frontend", + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/frontend": "*", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6", "validator": "^13.11.0" } }, "@hilla/frontend": { - "version": "file:../../../../ts/hilla-frontend", + "version": "file:../../../../ts/frontend", "requires": { "@esm-bundle/chai": "^4.3.4-fix.0", - "@open-wc/testing": "^2.5.33", - "@types/chai": "^4.2.21", + "@open-wc/testing": "^3.2.0", + "@types/atmosphere.js": "^2.1.3", + "@types/chai": "^4.3.5", + "@types/chai-as-promised": "^7.1.5", "@types/js-cookie": "^3.0.3", - "@types/mocha": "^9.0.0", - "@types/sinon": "^10.0.2", - "@types/sinon-chai": "^3.2.5", - "@types/validator": "^13.6.3", - "@vaadin/common-frontend": "^0.0.12", - "a-atmosphere-javascript": "3.1.3-2", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "@vaadin/common-frontend": "^0.0.18", + "atmosphere.js": "^3.1.3", + "chai-as-promised": "^7.1.1", "chai-dom": "^1.11.0", "fetch-mock": "^9.11.0", - "js-cookie": "^3.0.1", - "rimraf": "^3.0.2", - "sinon": "^11.1.2", + "js-cookie": "^3.0.5", + "sinon": "^15.2.0", "sinon-chai": "^3.7.0", - "typescript": "^5.0.1-rc" + "typescript": "^5.1.6" } }, "@hilla/generator-typescript-cli": { @@ -9907,6 +10028,68 @@ } } }, + "@hilla/react-auth": { + "version": "file:../../../../ts/react-auth", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/frontend": "*", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "react-router-dom": "^6.16.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + } + }, + "@hilla/react-form": { + "version": "file:../../../../ts/react-form", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/form": "*", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + } + }, + "@hilla/react-grid": { + "version": "file:../../../../ts/react-grid", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/form": "*", + "@hilla/react-components": "2.2.0-alpha16", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + } + }, "@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -13131,11 +13314,6 @@ "punycode": "^2.1.0" } }, - "validator": { - "version": "13.11.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-13.11.0.tgz", - "integrity": "sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ==" - }, "vite": { "version": "4.4.9", "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz", diff --git a/packages/java/tests/spring/security-contextpath/package.json b/packages/java/tests/spring/security-contextpath/package.json index 89e465eb8d..3bb70d5c1d 100644 --- a/packages/java/tests/spring/security-contextpath/package.json +++ b/packages/java/tests/spring/security-contextpath/package.json @@ -4,16 +4,19 @@ "type": "module", "dependencies": { "@adobe/lit-mobx": "2.0.0-rc.4", - "@hilla/form": "2.3.0-alpha5", - "@hilla/frontend": "../../../../ts/hilla-frontend", - "@hilla/generator-typescript-cli": "../../../../ts/generator-typescript-cli", - "@hilla/generator-typescript-core": "../../../../ts/generator-typescript-core", - "@hilla/generator-typescript-plugin-backbone": "../../../../ts/generator-typescript-plugin-backbone", - "@hilla/generator-typescript-plugin-barrel": "../../../../ts/generator-typescript-plugin-barrel", - "@hilla/generator-typescript-plugin-client": "../../../../ts/generator-typescript-plugin-client", - "@hilla/generator-typescript-plugin-model": "../../../../ts/generator-typescript-plugin-model", - "@hilla/generator-typescript-plugin-push": "../../../../ts/generator-typescript-plugin-push", - "@hilla/generator-typescript-utils": "../../../../ts/generator-typescript-utils", + "@hilla/form": "file:../../../../ts/form", + "@hilla/frontend": "file:../../../../ts/frontend", + "@hilla/generator-typescript-cli": "file:../../../../ts/generator-typescript-cli", + "@hilla/generator-typescript-core": "file:../../../../ts/generator-typescript-core", + "@hilla/generator-typescript-plugin-backbone": "file:../../../../ts/generator-typescript-plugin-backbone", + "@hilla/generator-typescript-plugin-barrel": "file:../../../../ts/generator-typescript-plugin-barrel", + "@hilla/generator-typescript-plugin-client": "file:../../../../ts/generator-typescript-plugin-client", + "@hilla/generator-typescript-plugin-model": "file:../../../../ts/generator-typescript-plugin-model", + "@hilla/generator-typescript-plugin-push": "file:../../../../ts/generator-typescript-plugin-push", + "@hilla/generator-typescript-utils": "file:../../../../ts/generator-typescript-utils", + "@hilla/react-auth": "file:../../../../ts/react-auth", + "@hilla/react-form": "file:../../../../ts/react-form", + "@hilla/react-grid": "file:../../../../ts/react-grid", "@polymer/iron-icon": "3.0.1", "@polymer/iron-iconset-svg": "3.0.1", "@polymer/iron-list": "3.1.0", diff --git a/packages/java/tests/spring/security-jwt/package-lock.json b/packages/java/tests/spring/security-jwt/package-lock.json index 39a300959a..876f34dcc6 100644 --- a/packages/java/tests/spring/security-jwt/package-lock.json +++ b/packages/java/tests/spring/security-jwt/package-lock.json @@ -8,16 +8,19 @@ "license": "UNLICENSED", "dependencies": { "@adobe/lit-mobx": "2.0.0-rc.4", - "@hilla/form": "2.3.0-alpha5", - "@hilla/frontend": "../../../../ts/hilla-frontend", - "@hilla/generator-typescript-cli": "../../../../ts/generator-typescript-cli", - "@hilla/generator-typescript-core": "../../../../ts/generator-typescript-core", - "@hilla/generator-typescript-plugin-backbone": "../../../../ts/generator-typescript-plugin-backbone", - "@hilla/generator-typescript-plugin-barrel": "../../../../ts/generator-typescript-plugin-barrel", - "@hilla/generator-typescript-plugin-client": "../../../../ts/generator-typescript-plugin-client", - "@hilla/generator-typescript-plugin-model": "../../../../ts/generator-typescript-plugin-model", - "@hilla/generator-typescript-plugin-push": "../../../../ts/generator-typescript-plugin-push", - "@hilla/generator-typescript-utils": "../../../../ts/generator-typescript-utils", + "@hilla/form": "file:../../../../ts/form", + "@hilla/frontend": "file:../../../../ts/frontend", + "@hilla/generator-typescript-cli": "file:../../../../ts/generator-typescript-cli", + "@hilla/generator-typescript-core": "file:../../../../ts/generator-typescript-core", + "@hilla/generator-typescript-plugin-backbone": "file:../../../../ts/generator-typescript-plugin-backbone", + "@hilla/generator-typescript-plugin-barrel": "file:../../../../ts/generator-typescript-plugin-barrel", + "@hilla/generator-typescript-plugin-client": "file:../../../../ts/generator-typescript-plugin-client", + "@hilla/generator-typescript-plugin-model": "file:../../../../ts/generator-typescript-plugin-model", + "@hilla/generator-typescript-plugin-push": "file:../../../../ts/generator-typescript-plugin-push", + "@hilla/generator-typescript-utils": "file:../../../../ts/generator-typescript-utils", + "@hilla/react-auth": "file:../../../../ts/react-auth", + "@hilla/react-form": "file:../../../../ts/react-form", + "@hilla/react-grid": "file:../../../../ts/react-grid", "@polymer/iron-icon": "3.0.1", "@polymer/iron-iconset-svg": "3.0.1", "@polymer/iron-list": "3.1.0", @@ -118,7 +121,6 @@ "../../../../ts/form": { "name": "@hilla/form", "version": "2.3.0-alpha5", - "extraneous": true, "license": "Apache-2.0", "dependencies": { "@hilla/frontend": "*", @@ -141,6 +143,36 @@ "lit": "^2.3.0" } }, + "../../../../ts/frontend": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@vaadin/common-frontend": "^0.0.18", + "atmosphere.js": "^3.1.3", + "js-cookie": "^3.0.5" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@open-wc/testing": "^3.2.0", + "@types/atmosphere.js": "^2.1.3", + "@types/chai": "^4.3.5", + "@types/chai-as-promised": "^7.1.5", + "@types/js-cookie": "^3.0.3", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-as-promised": "^7.1.1", + "chai-dom": "^1.11.0", + "fetch-mock": "^9.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "lit": "^2.3.0" + } + }, "../../../../ts/generator-typescript-cli": { "name": "@hilla/generator-typescript-cli", "version": "2.3.0-alpha5", @@ -458,6 +490,7 @@ "../../../../ts/hilla-frontend": { "name": "@hilla/frontend", "version": "2.1.0-alpha4", + "extraneous": true, "license": "Apache-2.0", "dependencies": { "@vaadin/common-frontend": "^0.0.12", @@ -484,6 +517,87 @@ "lit": "^2.3.0" } }, + "../../../../ts/react-auth": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/frontend": "*" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "react-router-dom": "^6.16.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18", + "react-router-dom": "^6" + } + }, + "../../../../ts/react-form": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/form": "*" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18" + } + }, + "../../../../ts/react-grid": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/form": "*", + "@hilla/react-components": "2.2.0-alpha16" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18" + } + }, "node_modules/@adobe/lit-mobx": { "version": "2.0.0-rc.4", "license": "Apache-2.0", @@ -2665,19 +2779,11 @@ } }, "node_modules/@hilla/form": { - "version": "2.3.0-alpha5", - "resolved": "https://registry.npmjs.org/@hilla/form/-/form-2.3.0-alpha5.tgz", - "integrity": "sha512-ZFRx+Fd/qXBNB/mGN0yTH/VHgq3t661sUor4qdRQx7mWPrsImqw3TJ89eNVeVo7tXRyGy5kP7HKzVPVYze32bA==", - "dependencies": { - "@hilla/frontend": "*", - "validator": "^13.11.0" - }, - "peerDependencies": { - "lit": "^2.3.0" - } + "resolved": "../../../../ts/form", + "link": true }, "node_modules/@hilla/frontend": { - "resolved": "../../../../ts/hilla-frontend", + "resolved": "../../../../ts/frontend", "link": true }, "node_modules/@hilla/generator-typescript-cli": { @@ -2712,6 +2818,18 @@ "resolved": "../../../../ts/generator-typescript-utils", "link": true }, + "node_modules/@hilla/react-auth": { + "resolved": "../../../../ts/react-auth", + "link": true + }, + "node_modules/@hilla/react-form": { + "resolved": "../../../../ts/react-form", + "link": true + }, + "node_modules/@hilla/react-grid": { + "resolved": "../../../../ts/react-grid", + "link": true + }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -7386,14 +7504,6 @@ "punycode": "^2.1.0" } }, - "node_modules/validator": { - "version": "13.11.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-13.11.0.tgz", - "integrity": "sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ==", - "engines": { - "node": ">= 0.10" - } - }, "node_modules/vite": { "version": "4.4.9", "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz", @@ -9627,34 +9737,45 @@ "optional": true }, "@hilla/form": { - "version": "2.3.0-alpha5", - "resolved": "https://registry.npmjs.org/@hilla/form/-/form-2.3.0-alpha5.tgz", - "integrity": "sha512-ZFRx+Fd/qXBNB/mGN0yTH/VHgq3t661sUor4qdRQx7mWPrsImqw3TJ89eNVeVo7tXRyGy5kP7HKzVPVYze32bA==", + "version": "file:../../../../ts/form", "requires": { - "@hilla/frontend": "../../../../ts/hilla-frontend", + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/frontend": "*", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6", "validator": "^13.11.0" } }, "@hilla/frontend": { - "version": "file:../../../../ts/hilla-frontend", + "version": "file:../../../../ts/frontend", "requires": { "@esm-bundle/chai": "^4.3.4-fix.0", - "@open-wc/testing": "^2.5.33", - "@types/chai": "^4.2.21", + "@open-wc/testing": "^3.2.0", + "@types/atmosphere.js": "^2.1.3", + "@types/chai": "^4.3.5", + "@types/chai-as-promised": "^7.1.5", "@types/js-cookie": "^3.0.3", - "@types/mocha": "^9.0.0", - "@types/sinon": "^10.0.2", - "@types/sinon-chai": "^3.2.5", - "@types/validator": "^13.6.3", - "@vaadin/common-frontend": "^0.0.12", - "a-atmosphere-javascript": "3.1.3-2", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "@vaadin/common-frontend": "^0.0.18", + "atmosphere.js": "^3.1.3", + "chai-as-promised": "^7.1.1", "chai-dom": "^1.11.0", "fetch-mock": "^9.11.0", - "js-cookie": "^3.0.1", - "rimraf": "^3.0.2", - "sinon": "^11.1.2", + "js-cookie": "^3.0.5", + "sinon": "^15.2.0", "sinon-chai": "^3.7.0", - "typescript": "^5.0.1-rc" + "typescript": "^5.1.6" } }, "@hilla/generator-typescript-cli": { @@ -9896,6 +10017,68 @@ } } }, + "@hilla/react-auth": { + "version": "file:../../../../ts/react-auth", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/frontend": "*", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "react-router-dom": "^6.16.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + } + }, + "@hilla/react-form": { + "version": "file:../../../../ts/react-form", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/form": "*", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + } + }, + "@hilla/react-grid": { + "version": "file:../../../../ts/react-grid", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/form": "*", + "@hilla/react-components": "2.2.0-alpha16", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + } + }, "@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -13122,11 +13305,6 @@ "punycode": "^2.1.0" } }, - "validator": { - "version": "13.11.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-13.11.0.tgz", - "integrity": "sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ==" - }, "vite": { "version": "4.4.9", "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz", diff --git a/packages/java/tests/spring/security-jwt/package.json b/packages/java/tests/spring/security-jwt/package.json index 41bd95e326..820475c4bc 100644 --- a/packages/java/tests/spring/security-jwt/package.json +++ b/packages/java/tests/spring/security-jwt/package.json @@ -4,16 +4,19 @@ "type": "module", "dependencies": { "@adobe/lit-mobx": "2.0.0-rc.4", - "@hilla/form": "2.3.0-alpha5", - "@hilla/frontend": "../../../../ts/hilla-frontend", - "@hilla/generator-typescript-cli": "../../../../ts/generator-typescript-cli", - "@hilla/generator-typescript-core": "../../../../ts/generator-typescript-core", - "@hilla/generator-typescript-plugin-backbone": "../../../../ts/generator-typescript-plugin-backbone", - "@hilla/generator-typescript-plugin-barrel": "../../../../ts/generator-typescript-plugin-barrel", - "@hilla/generator-typescript-plugin-client": "../../../../ts/generator-typescript-plugin-client", - "@hilla/generator-typescript-plugin-model": "../../../../ts/generator-typescript-plugin-model", - "@hilla/generator-typescript-plugin-push": "../../../../ts/generator-typescript-plugin-push", - "@hilla/generator-typescript-utils": "../../../../ts/generator-typescript-utils", + "@hilla/form": "file:../../../../ts/form", + "@hilla/frontend": "file:../../../../ts/frontend", + "@hilla/generator-typescript-cli": "file:../../../../ts/generator-typescript-cli", + "@hilla/generator-typescript-core": "file:../../../../ts/generator-typescript-core", + "@hilla/generator-typescript-plugin-backbone": "file:../../../../ts/generator-typescript-plugin-backbone", + "@hilla/generator-typescript-plugin-barrel": "file:../../../../ts/generator-typescript-plugin-barrel", + "@hilla/generator-typescript-plugin-client": "file:../../../../ts/generator-typescript-plugin-client", + "@hilla/generator-typescript-plugin-model": "file:../../../../ts/generator-typescript-plugin-model", + "@hilla/generator-typescript-plugin-push": "file:../../../../ts/generator-typescript-plugin-push", + "@hilla/generator-typescript-utils": "file:../../../../ts/generator-typescript-utils", + "@hilla/react-auth": "file:../../../../ts/react-auth", + "@hilla/react-form": "file:../../../../ts/react-form", + "@hilla/react-grid": "file:../../../../ts/react-grid", "@polymer/iron-icon": "3.0.1", "@polymer/iron-iconset-svg": "3.0.1", "@polymer/iron-list": "3.1.0", diff --git a/packages/java/tests/spring/security-urlmapping/package-lock.json b/packages/java/tests/spring/security-urlmapping/package-lock.json index 8e7bfb212c..4a6c65a37f 100644 --- a/packages/java/tests/spring/security-urlmapping/package-lock.json +++ b/packages/java/tests/spring/security-urlmapping/package-lock.json @@ -8,16 +8,19 @@ "license": "UNLICENSED", "dependencies": { "@adobe/lit-mobx": "2.0.0-rc.4", - "@hilla/form": "2.3.0-alpha5", - "@hilla/frontend": "../../../../ts/hilla-frontend", - "@hilla/generator-typescript-cli": "../../../../ts/generator-typescript-cli", - "@hilla/generator-typescript-core": "../../../../ts/generator-typescript-core", - "@hilla/generator-typescript-plugin-backbone": "../../../../ts/generator-typescript-plugin-backbone", - "@hilla/generator-typescript-plugin-barrel": "../../../../ts/generator-typescript-plugin-barrel", - "@hilla/generator-typescript-plugin-client": "../../../../ts/generator-typescript-plugin-client", - "@hilla/generator-typescript-plugin-model": "../../../../ts/generator-typescript-plugin-model", - "@hilla/generator-typescript-plugin-push": "../../../../ts/generator-typescript-plugin-push", - "@hilla/generator-typescript-utils": "../../../../ts/generator-typescript-utils", + "@hilla/form": "file:../../../../ts/form", + "@hilla/frontend": "file:../../../../ts/frontend", + "@hilla/generator-typescript-cli": "file:../../../../ts/generator-typescript-cli", + "@hilla/generator-typescript-core": "file:../../../../ts/generator-typescript-core", + "@hilla/generator-typescript-plugin-backbone": "file:../../../../ts/generator-typescript-plugin-backbone", + "@hilla/generator-typescript-plugin-barrel": "file:../../../../ts/generator-typescript-plugin-barrel", + "@hilla/generator-typescript-plugin-client": "file:../../../../ts/generator-typescript-plugin-client", + "@hilla/generator-typescript-plugin-model": "file:../../../../ts/generator-typescript-plugin-model", + "@hilla/generator-typescript-plugin-push": "file:../../../../ts/generator-typescript-plugin-push", + "@hilla/generator-typescript-utils": "file:../../../../ts/generator-typescript-utils", + "@hilla/react-auth": "file:../../../../ts/react-auth", + "@hilla/react-form": "file:../../../../ts/react-form", + "@hilla/react-grid": "file:../../../../ts/react-grid", "@polymer/iron-icon": "3.0.1", "@polymer/iron-iconset-svg": "3.0.1", "@polymer/iron-list": "3.1.0", @@ -118,7 +121,6 @@ "../../../../ts/form": { "name": "@hilla/form", "version": "2.3.0-alpha5", - "extraneous": true, "license": "Apache-2.0", "dependencies": { "@hilla/frontend": "*", @@ -141,6 +143,36 @@ "lit": "^2.3.0" } }, + "../../../../ts/frontend": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@vaadin/common-frontend": "^0.0.18", + "atmosphere.js": "^3.1.3", + "js-cookie": "^3.0.5" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@open-wc/testing": "^3.2.0", + "@types/atmosphere.js": "^2.1.3", + "@types/chai": "^4.3.5", + "@types/chai-as-promised": "^7.1.5", + "@types/js-cookie": "^3.0.3", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-as-promised": "^7.1.1", + "chai-dom": "^1.11.0", + "fetch-mock": "^9.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "lit": "^2.3.0" + } + }, "../../../../ts/generator-typescript-cli": { "name": "@hilla/generator-typescript-cli", "version": "2.3.0-alpha5", @@ -463,6 +495,7 @@ "../../../../ts/hilla-frontend": { "name": "@hilla/frontend", "version": "2.1.0-alpha4", + "extraneous": true, "license": "Apache-2.0", "dependencies": { "@vaadin/common-frontend": "^0.0.12", @@ -489,6 +522,87 @@ "lit": "^2.3.0" } }, + "../../../../ts/react-auth": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/frontend": "*" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "react-router-dom": "^6.16.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18", + "react-router-dom": "^6" + } + }, + "../../../../ts/react-form": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/form": "*" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18" + } + }, + "../../../../ts/react-grid": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/form": "*", + "@hilla/react-components": "2.2.0-alpha16" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18" + } + }, "node_modules/@adobe/lit-mobx": { "version": "2.0.0-rc.4", "license": "Apache-2.0", @@ -2670,19 +2784,11 @@ } }, "node_modules/@hilla/form": { - "version": "2.3.0-alpha5", - "resolved": "https://registry.npmjs.org/@hilla/form/-/form-2.3.0-alpha5.tgz", - "integrity": "sha512-ZFRx+Fd/qXBNB/mGN0yTH/VHgq3t661sUor4qdRQx7mWPrsImqw3TJ89eNVeVo7tXRyGy5kP7HKzVPVYze32bA==", - "dependencies": { - "@hilla/frontend": "*", - "validator": "^13.11.0" - }, - "peerDependencies": { - "lit": "^2.3.0" - } + "resolved": "../../../../ts/form", + "link": true }, "node_modules/@hilla/frontend": { - "resolved": "../../../../ts/hilla-frontend", + "resolved": "../../../../ts/frontend", "link": true }, "node_modules/@hilla/generator-typescript-cli": { @@ -2717,6 +2823,18 @@ "resolved": "../../../../ts/generator-typescript-utils", "link": true }, + "node_modules/@hilla/react-auth": { + "resolved": "../../../../ts/react-auth", + "link": true + }, + "node_modules/@hilla/react-form": { + "resolved": "../../../../ts/react-form", + "link": true + }, + "node_modules/@hilla/react-grid": { + "resolved": "../../../../ts/react-grid", + "link": true + }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -7383,14 +7501,6 @@ "punycode": "^2.1.0" } }, - "node_modules/validator": { - "version": "13.11.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-13.11.0.tgz", - "integrity": "sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ==", - "engines": { - "node": ">= 0.10" - } - }, "node_modules/vite": { "version": "4.4.9", "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz", @@ -9624,34 +9734,45 @@ "optional": true }, "@hilla/form": { - "version": "2.3.0-alpha5", - "resolved": "https://registry.npmjs.org/@hilla/form/-/form-2.3.0-alpha5.tgz", - "integrity": "sha512-ZFRx+Fd/qXBNB/mGN0yTH/VHgq3t661sUor4qdRQx7mWPrsImqw3TJ89eNVeVo7tXRyGy5kP7HKzVPVYze32bA==", + "version": "file:../../../../ts/form", "requires": { - "@hilla/frontend": "../../../../ts/hilla-frontend", + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/frontend": "*", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6", "validator": "^13.11.0" } }, "@hilla/frontend": { - "version": "file:../../../../ts/hilla-frontend", + "version": "file:../../../../ts/frontend", "requires": { "@esm-bundle/chai": "^4.3.4-fix.0", - "@open-wc/testing": "^2.5.33", - "@types/chai": "^4.2.21", + "@open-wc/testing": "^3.2.0", + "@types/atmosphere.js": "^2.1.3", + "@types/chai": "^4.3.5", + "@types/chai-as-promised": "^7.1.5", "@types/js-cookie": "^3.0.3", - "@types/mocha": "^9.0.0", - "@types/sinon": "^10.0.2", - "@types/sinon-chai": "^3.2.5", - "@types/validator": "^13.6.3", - "@vaadin/common-frontend": "^0.0.12", - "a-atmosphere-javascript": "3.1.3-2", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "@vaadin/common-frontend": "^0.0.18", + "atmosphere.js": "^3.1.3", + "chai-as-promised": "^7.1.1", "chai-dom": "^1.11.0", "fetch-mock": "^9.11.0", - "js-cookie": "^3.0.1", - "rimraf": "^3.0.2", - "sinon": "^11.1.2", + "js-cookie": "^3.0.5", + "sinon": "^15.2.0", "sinon-chai": "^3.7.0", - "typescript": "^5.0.1-rc" + "typescript": "^5.1.6" } }, "@hilla/generator-typescript-cli": { @@ -9899,6 +10020,68 @@ } } }, + "@hilla/react-auth": { + "version": "file:../../../../ts/react-auth", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/frontend": "*", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "react-router-dom": "^6.16.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + } + }, + "@hilla/react-form": { + "version": "file:../../../../ts/react-form", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/form": "*", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + } + }, + "@hilla/react-grid": { + "version": "file:../../../../ts/react-grid", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/form": "*", + "@hilla/react-components": "2.2.0-alpha16", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + } + }, "@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -13109,11 +13292,6 @@ "punycode": "^2.1.0" } }, - "validator": { - "version": "13.11.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-13.11.0.tgz", - "integrity": "sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ==" - }, "vite": { "version": "4.4.9", "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz", diff --git a/packages/java/tests/spring/security-urlmapping/package.json b/packages/java/tests/spring/security-urlmapping/package.json index 41bd95e326..820475c4bc 100644 --- a/packages/java/tests/spring/security-urlmapping/package.json +++ b/packages/java/tests/spring/security-urlmapping/package.json @@ -4,16 +4,19 @@ "type": "module", "dependencies": { "@adobe/lit-mobx": "2.0.0-rc.4", - "@hilla/form": "2.3.0-alpha5", - "@hilla/frontend": "../../../../ts/hilla-frontend", - "@hilla/generator-typescript-cli": "../../../../ts/generator-typescript-cli", - "@hilla/generator-typescript-core": "../../../../ts/generator-typescript-core", - "@hilla/generator-typescript-plugin-backbone": "../../../../ts/generator-typescript-plugin-backbone", - "@hilla/generator-typescript-plugin-barrel": "../../../../ts/generator-typescript-plugin-barrel", - "@hilla/generator-typescript-plugin-client": "../../../../ts/generator-typescript-plugin-client", - "@hilla/generator-typescript-plugin-model": "../../../../ts/generator-typescript-plugin-model", - "@hilla/generator-typescript-plugin-push": "../../../../ts/generator-typescript-plugin-push", - "@hilla/generator-typescript-utils": "../../../../ts/generator-typescript-utils", + "@hilla/form": "file:../../../../ts/form", + "@hilla/frontend": "file:../../../../ts/frontend", + "@hilla/generator-typescript-cli": "file:../../../../ts/generator-typescript-cli", + "@hilla/generator-typescript-core": "file:../../../../ts/generator-typescript-core", + "@hilla/generator-typescript-plugin-backbone": "file:../../../../ts/generator-typescript-plugin-backbone", + "@hilla/generator-typescript-plugin-barrel": "file:../../../../ts/generator-typescript-plugin-barrel", + "@hilla/generator-typescript-plugin-client": "file:../../../../ts/generator-typescript-plugin-client", + "@hilla/generator-typescript-plugin-model": "file:../../../../ts/generator-typescript-plugin-model", + "@hilla/generator-typescript-plugin-push": "file:../../../../ts/generator-typescript-plugin-push", + "@hilla/generator-typescript-utils": "file:../../../../ts/generator-typescript-utils", + "@hilla/react-auth": "file:../../../../ts/react-auth", + "@hilla/react-form": "file:../../../../ts/react-form", + "@hilla/react-grid": "file:../../../../ts/react-grid", "@polymer/iron-icon": "3.0.1", "@polymer/iron-iconset-svg": "3.0.1", "@polymer/iron-list": "3.1.0", diff --git a/packages/java/tests/spring/security/package-lock.json b/packages/java/tests/spring/security/package-lock.json index 2a3ca6421d..f8ffd60a42 100644 --- a/packages/java/tests/spring/security/package-lock.json +++ b/packages/java/tests/spring/security/package-lock.json @@ -8,16 +8,19 @@ "license": "UNLICENSED", "dependencies": { "@adobe/lit-mobx": "2.0.0-rc.4", - "@hilla/form": "2.3.0-alpha5", - "@hilla/frontend": "../../../../ts/hilla-frontend", - "@hilla/generator-typescript-cli": "../../../../ts/generator-typescript-cli", - "@hilla/generator-typescript-core": "../../../../ts/generator-typescript-core", - "@hilla/generator-typescript-plugin-backbone": "../../../../ts/generator-typescript-plugin-backbone", - "@hilla/generator-typescript-plugin-barrel": "../../../../ts/generator-typescript-plugin-barrel", - "@hilla/generator-typescript-plugin-client": "../../../../ts/generator-typescript-plugin-client", - "@hilla/generator-typescript-plugin-model": "../../../../ts/generator-typescript-plugin-model", - "@hilla/generator-typescript-plugin-push": "../../../../ts/generator-typescript-plugin-push", - "@hilla/generator-typescript-utils": "../../../../ts/generator-typescript-utils", + "@hilla/form": "file:../../../../ts/form", + "@hilla/frontend": "file:../../../../ts/frontend", + "@hilla/generator-typescript-cli": "file:../../../../ts/generator-typescript-cli", + "@hilla/generator-typescript-core": "file:../../../../ts/generator-typescript-core", + "@hilla/generator-typescript-plugin-backbone": "file:../../../../ts/generator-typescript-plugin-backbone", + "@hilla/generator-typescript-plugin-barrel": "file:../../../../ts/generator-typescript-plugin-barrel", + "@hilla/generator-typescript-plugin-client": "file:../../../../ts/generator-typescript-plugin-client", + "@hilla/generator-typescript-plugin-model": "file:../../../../ts/generator-typescript-plugin-model", + "@hilla/generator-typescript-plugin-push": "file:../../../../ts/generator-typescript-plugin-push", + "@hilla/generator-typescript-utils": "file:../../../../ts/generator-typescript-utils", + "@hilla/react-auth": "file:../../../../ts/react-auth", + "@hilla/react-form": "file:../../../../ts/react-form", + "@hilla/react-grid": "file:../../../../ts/react-grid", "@polymer/polymer": "3.5.1", "@vaadin/a11y-base": "24.2.0-alpha16", "@vaadin/accordion": "24.2.0-alpha16", @@ -113,7 +116,6 @@ "../../../../ts/form": { "name": "@hilla/form", "version": "2.3.0-alpha5", - "extraneous": true, "license": "Apache-2.0", "dependencies": { "@hilla/frontend": "*", @@ -136,6 +138,36 @@ "lit": "^2.3.0" } }, + "../../../../ts/frontend": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@vaadin/common-frontend": "^0.0.18", + "atmosphere.js": "^3.1.3", + "js-cookie": "^3.0.5" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@open-wc/testing": "^3.2.0", + "@types/atmosphere.js": "^2.1.3", + "@types/chai": "^4.3.5", + "@types/chai-as-promised": "^7.1.5", + "@types/js-cookie": "^3.0.3", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-as-promised": "^7.1.1", + "chai-dom": "^1.11.0", + "fetch-mock": "^9.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "lit": "^2.3.0" + } + }, "../../../../ts/generator-typescript-cli": { "name": "@hilla/generator-typescript-cli", "version": "2.3.0-alpha5", @@ -458,6 +490,7 @@ "../../../../ts/hilla-frontend": { "name": "@hilla/frontend", "version": "2.1.0-alpha4", + "extraneous": true, "license": "Apache-2.0", "dependencies": { "@vaadin/common-frontend": "^0.0.12", @@ -484,6 +517,87 @@ "lit": "^2.3.0" } }, + "../../../../ts/react-auth": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/frontend": "*" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "react-router-dom": "^6.16.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18", + "react-router-dom": "^6" + } + }, + "../../../../ts/react-form": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/form": "*" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18" + } + }, + "../../../../ts/react-grid": { + "version": "2.3.0-alpha5", + "license": "Apache-2.0", + "dependencies": { + "@hilla/form": "*", + "@hilla/react-components": "2.2.0-alpha16" + }, + "devDependencies": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + }, + "peerDependencies": { + "react": "^18" + } + }, "node_modules/@adobe/lit-mobx": { "version": "2.0.0-rc.4", "license": "Apache-2.0", @@ -2665,19 +2779,11 @@ } }, "node_modules/@hilla/form": { - "version": "2.3.0-alpha5", - "resolved": "https://registry.npmjs.org/@hilla/form/-/form-2.3.0-alpha5.tgz", - "integrity": "sha512-ZFRx+Fd/qXBNB/mGN0yTH/VHgq3t661sUor4qdRQx7mWPrsImqw3TJ89eNVeVo7tXRyGy5kP7HKzVPVYze32bA==", - "dependencies": { - "@hilla/frontend": "*", - "validator": "^13.11.0" - }, - "peerDependencies": { - "lit": "^2.3.0" - } + "resolved": "../../../../ts/form", + "link": true }, "node_modules/@hilla/frontend": { - "resolved": "../../../../ts/hilla-frontend", + "resolved": "../../../../ts/frontend", "link": true }, "node_modules/@hilla/generator-typescript-cli": { @@ -2712,6 +2818,18 @@ "resolved": "../../../../ts/generator-typescript-utils", "link": true }, + "node_modules/@hilla/react-auth": { + "resolved": "../../../../ts/react-auth", + "link": true + }, + "node_modules/@hilla/react-form": { + "resolved": "../../../../ts/react-form", + "link": true + }, + "node_modules/@hilla/react-grid": { + "resolved": "../../../../ts/react-grid", + "link": true + }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -7316,14 +7434,6 @@ "punycode": "^2.1.0" } }, - "node_modules/validator": { - "version": "13.11.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-13.11.0.tgz", - "integrity": "sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ==", - "engines": { - "node": ">= 0.10" - } - }, "node_modules/vite": { "version": "4.4.9", "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz", @@ -9557,34 +9667,45 @@ "optional": true }, "@hilla/form": { - "version": "2.3.0-alpha5", - "resolved": "https://registry.npmjs.org/@hilla/form/-/form-2.3.0-alpha5.tgz", - "integrity": "sha512-ZFRx+Fd/qXBNB/mGN0yTH/VHgq3t661sUor4qdRQx7mWPrsImqw3TJ89eNVeVo7tXRyGy5kP7HKzVPVYze32bA==", + "version": "file:../../../../ts/form", "requires": { - "@hilla/frontend": "../../../../ts/hilla-frontend", + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/frontend": "*", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6", "validator": "^13.11.0" } }, "@hilla/frontend": { - "version": "file:../../../../ts/hilla-frontend", + "version": "file:../../../../ts/frontend", "requires": { "@esm-bundle/chai": "^4.3.4-fix.0", - "@open-wc/testing": "^2.5.33", - "@types/chai": "^4.2.21", + "@open-wc/testing": "^3.2.0", + "@types/atmosphere.js": "^2.1.3", + "@types/chai": "^4.3.5", + "@types/chai-as-promised": "^7.1.5", "@types/js-cookie": "^3.0.3", - "@types/mocha": "^9.0.0", - "@types/sinon": "^10.0.2", - "@types/sinon-chai": "^3.2.5", - "@types/validator": "^13.6.3", - "@vaadin/common-frontend": "^0.0.12", - "a-atmosphere-javascript": "3.1.3-2", + "@types/mocha": "^10.0.1", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "@vaadin/common-frontend": "^0.0.18", + "atmosphere.js": "^3.1.3", + "chai-as-promised": "^7.1.1", "chai-dom": "^1.11.0", "fetch-mock": "^9.11.0", - "js-cookie": "^3.0.1", - "rimraf": "^3.0.2", - "sinon": "^11.1.2", + "js-cookie": "^3.0.5", + "sinon": "^15.2.0", "sinon-chai": "^3.7.0", - "typescript": "^5.0.1-rc" + "typescript": "^5.1.6" } }, "@hilla/generator-typescript-cli": { @@ -9832,6 +9953,68 @@ } } }, + "@hilla/react-auth": { + "version": "file:../../../../ts/react-auth", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/frontend": "*", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "react-router-dom": "^6.16.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + } + }, + "@hilla/react-form": { + "version": "file:../../../../ts/react-form", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/form": "*", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + } + }, + "@hilla/react-grid": { + "version": "file:../../../../ts/react-grid", + "requires": { + "@esm-bundle/chai": "^4.3.4-fix.0", + "@hilla/form": "*", + "@hilla/react-components": "2.2.0-alpha16", + "@testing-library/react": "^14.0.0", + "@testing-library/user-event": "^14.4.3", + "@types/chai": "^4.3.5", + "@types/chai-dom": "^1.11.0", + "@types/mocha": "^10.0.1", + "@types/react": "^18.2.20", + "@types/sinon": "^10.0.16", + "@types/sinon-chai": "^3.2.9", + "@types/validator": "^13.11.1", + "chai-dom": "^1.11.0", + "sinon": "^15.2.0", + "sinon-chai": "^3.7.0", + "typescript": "^5.1.6" + } + }, "@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -12986,11 +13169,6 @@ "punycode": "^2.1.0" } }, - "validator": { - "version": "13.11.0", - "resolved": "https://registry.npmjs.org/validator/-/validator-13.11.0.tgz", - "integrity": "sha512-Ii+sehpSfZy+At5nPdnyMhx78fEoPDkR2XW/zimHEL3MyGJQOCQ7WeP20jPYRz7ZCpcKLB21NxuXHF3bxjStBQ==" - }, "vite": { "version": "4.4.9", "resolved": "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz", diff --git a/packages/java/tests/spring/security/package.json b/packages/java/tests/spring/security/package.json index 766fe19698..56b91e79ed 100644 --- a/packages/java/tests/spring/security/package.json +++ b/packages/java/tests/spring/security/package.json @@ -4,16 +4,19 @@ "type": "module", "dependencies": { "@adobe/lit-mobx": "2.0.0-rc.4", - "@hilla/form": "2.3.0-alpha5", - "@hilla/frontend": "../../../../ts/hilla-frontend", - "@hilla/generator-typescript-cli": "../../../../ts/generator-typescript-cli", - "@hilla/generator-typescript-core": "../../../../ts/generator-typescript-core", - "@hilla/generator-typescript-plugin-backbone": "../../../../ts/generator-typescript-plugin-backbone", - "@hilla/generator-typescript-plugin-barrel": "../../../../ts/generator-typescript-plugin-barrel", - "@hilla/generator-typescript-plugin-client": "../../../../ts/generator-typescript-plugin-client", - "@hilla/generator-typescript-plugin-model": "../../../../ts/generator-typescript-plugin-model", - "@hilla/generator-typescript-plugin-push": "../../../../ts/generator-typescript-plugin-push", - "@hilla/generator-typescript-utils": "../../../../ts/generator-typescript-utils", + "@hilla/form": "file:../../../../ts/form", + "@hilla/frontend": "file:../../../../ts/frontend", + "@hilla/generator-typescript-cli": "file:../../../../ts/generator-typescript-cli", + "@hilla/generator-typescript-core": "file:../../../../ts/generator-typescript-core", + "@hilla/generator-typescript-plugin-backbone": "file:../../../../ts/generator-typescript-plugin-backbone", + "@hilla/generator-typescript-plugin-barrel": "file:../../../../ts/generator-typescript-plugin-barrel", + "@hilla/generator-typescript-plugin-client": "file:../../../../ts/generator-typescript-plugin-client", + "@hilla/generator-typescript-plugin-model": "file:../../../../ts/generator-typescript-plugin-model", + "@hilla/generator-typescript-plugin-push": "file:../../../../ts/generator-typescript-plugin-push", + "@hilla/generator-typescript-utils": "file:../../../../ts/generator-typescript-utils", + "@hilla/react-auth": "file:../../../../ts/react-auth", + "@hilla/react-form": "file:../../../../ts/react-form", + "@hilla/react-grid": "file:../../../../ts/react-grid", "@polymer/polymer": "3.5.1", "@vaadin/a11y-base": "24.2.0-alpha16", "@vaadin/accordion": "24.2.0-alpha16", diff --git a/packages/ts/form/.eslintrc b/packages/ts/form/.eslintrc index 7983e9cc9f..672c841364 100644 --- a/packages/ts/form/.eslintrc +++ b/packages/ts/form/.eslintrc @@ -1,6 +1,8 @@ { "extends": ["../../../.eslintrc"], "rules": { + "@typescript-eslint/no-use-before-define": "off", + "import/no-cycle": "off", "perfectionist/sort-enums": "off", "perfectionist/sort-objects": "off" }, diff --git a/packages/ts/form/src/Binder.ts b/packages/ts/form/src/Binder.ts index a7e2e4f8e6..5c38f046fc 100644 --- a/packages/ts/form/src/Binder.ts +++ b/packages/ts/form/src/Binder.ts @@ -1,6 +1,8 @@ import type { LitElement } from 'lit'; +import type { Constructor } from 'type-fest'; import { BinderRoot, type BinderConfiguration } from './BinderRoot.js'; -import type { AbstractModel, ModelConstructor } from './Models.js'; +import type { AbstractModel } from './Models.js'; +import type { Value } from './Models.js'; /** * A Binder controls all aspects of a single form. @@ -10,7 +12,7 @@ import type { AbstractModel, ModelConstructor } from './Models.js'; * @typeParam T - Type of the value that binds to a form * @typeParam M - Type of the model that describes the structure of the value */ -export class Binder> extends BinderRoot { +export class Binder extends BinderRoot { context: Element; /** @@ -25,7 +27,7 @@ export class Binder> extends BinderRoot { * binder = new Binder(orderView, OrderModel, {onSubmit: async (order) => {endpoint.save(order)}}); * ``` */ - constructor(context: Element, Model: ModelConstructor, config?: BinderConfiguration) { + constructor(context: Element, Model: Constructor, config?: BinderConfiguration>) { const changeCallback = config?.onChange ?? (typeof (context as LitElement).requestUpdate === 'function' diff --git a/packages/ts/form/src/BinderNode.ts b/packages/ts/form/src/BinderNode.ts index 7bc84f28dc..d280ea040b 100644 --- a/packages/ts/form/src/BinderNode.ts +++ b/packages/ts/form/src/BinderNode.ts @@ -15,60 +15,77 @@ */ // TODO: Fix dependency cycle -import type { Binder } from './Binder.js'; -// eslint-disable-next-line import/no-cycle +import type { BinderRoot } from './BinderRoot.js'; import { - _binderNode, - _ItemModel, + _createEmptyItemValue, _key, _parent, _validators, AbstractModel, + type ArrayItemModel, ArrayModel, - getBinderNode, + getObjectModelOwnAndParentGetters, ObjectModel, + type Value, } from './Models.js'; import type { Validator, ValueError } from './Validation.js'; import { ValidityStateValidator } from './Validators.js'; import { _validity } from './Validity.js'; -const _ownErrors = Symbol('ownErrorsSymbol'); -const _visited = Symbol('visited'); +export const _updateValidation = Symbol('updateValidation'); +export const _update = Symbol('update'); +export const _setErrorsWithDescendants = Symbol('setErrorsWithDescendants'); +export const _clearValidation = Symbol('clearValidation'); -function getErrorPropertyName(valueError: ValueError): string { +const nodes = new WeakMap(); + +export function getBinderNode(model: M): BinderNode { + let node = nodes.get(model); + + if (!node) { + node = new BinderNode(model); + nodes.set(model, node); + } + + return node as BinderNode; +} + +function getErrorPropertyName(valueError: ValueError): string { return typeof valueError.property === 'string' ? valueError.property : getBinderNode(valueError.property).name; } -type ArrayBinderNode = BinderNode>>; +export const CHANGED = new Event('binder-node-changed'); -type ArrayItemBinderNode> = Omit, 'parent'> & { - parent: ArrayBinderNode; -}; +class NotArrayModelError extends Error { + constructor() { + super('The model does not represent array'); + } +} -const defaultArrayItemCache = new WeakMap(); -const getDefaultArrayItem = (arrayNode: ArrayBinderNode): TItem => { - const cache = defaultArrayItemCache as WeakMap; - if (cache.has(arrayNode)) { - return defaultArrayItemCache.get(arrayNode) as TItem; +class NotArrayItemModelError extends Error { + constructor() { + super('The model does not represent array item'); } - const defaultArrayItem = arrayNode.model[_ItemModel].createEmptyValue(); - cache.set(arrayNode, defaultArrayItem); - return defaultArrayItem; -}; +} -export const CHANGED = new Event('binder-node-changed'); +declare class ArrayItemBinderNode extends BinderNode { + // @ts-expect-error: re-defining the parent getter. + declare readonly parent: BinderNode>; +} + +const defaultArrayItemCache = new WeakMap(); /** - * The BinderNode\ class provides the form binding related APIs + * The BinderNode\ class provides the form binding related APIs * with respect to a particular model instance. * * Structurally, model instances form a tree, in which the object * and array models have child nodes of field and array item model * instances. */ -export class BinderNode> extends EventTarget { +export class BinderNode extends EventTarget { + declare readonly ['constructor']: typeof BinderNode; readonly model: M; - /** * The validity state read from the bound element, if any. Represents the * HTML element internal validation. @@ -77,80 +94,54 @@ export class BinderNode> extends EventTarget { * bound element is considered as invalid. */ [_validity]?: ValidityState; - - private [_visited] = false; - - private [_validators]: ReadonlyArray>; - - private [_ownErrors]?: ReadonlyArray>; - - private readonly validityStateValidator: ValidityStateValidator; + #ownErrors?: ReadonlyArray>>; + #validators: ReadonlyArray>>; + readonly #validityStateValidator: ValidityStateValidator>; + #visited = false; constructor(model: M) { super(); this.model = model; - model[_binderNode] = this; - this.validityStateValidator = new ValidityStateValidator(); - this.initializeValue(); - this[_validators] = model[_validators]; - } + nodes.set(model, this); + this.#validityStateValidator = new ValidityStateValidator>(); + this.#validators = model[_validators]; - /** - * The parent node, if this binder node corresponds to a nested model, - * otherwise undefined for the top-level binder. - */ - get parent(): BinderNode> | undefined { - const modelParent = this.model[_parent]; - return modelParent instanceof AbstractModel ? getBinderNode(modelParent) : undefined; + // Workaround for children initialization with private props + if (this.constructor === BinderNode) { + this.initializeValue(); + } } /** * The binder for the top-level model. */ - get binder(): Binder> { - return this.parent ? this.parent.binder : (this as any); - } - - /** - * The name generated from the model structure, used to set the name - * attribute on the field components. - */ - get name(): string { - let model = this.model as AbstractModel; - const strings = []; - while (model[_parent] instanceof AbstractModel) { - strings.unshift(String(model[_key])); - model = model[_parent]; - } - return strings.join('.'); - } + get binder(): BinderRoot { + const binder = this.parent?.binder; - /** - * The current value related to the model - */ - get value(): T | undefined { - if (this.parent!.value === undefined) { - this.parent!.initializeValue(true); + if (!binder) { + throw new TypeError('BinderNode is detached'); } - const key = this.model[_key]; - return (this.parent!.value as { readonly [key in typeof key]: T })[key]; - } - set value(value: T | undefined) { - this.setValueState(value); + return binder; } /** * The default value related to the model */ - get defaultValue(): T { - if (this.isArrayItem()) { - const arrayNode = this.parent.asArray(); - return getDefaultArrayItem(arrayNode); + get defaultValue(): Value | undefined { + if (this.#isArrayItem()) { + let value = defaultArrayItemCache.get(this.parent); + + if (!value) { + value = this.model.constructor.createEmptyValue(); + defaultArrayItemCache.set(this.parent, value); + } + + return value as Value; } const key = this.model[_key]; - return (this.parent!.defaultValue as { readonly [key in typeof key]: T })[key]; + return (this.parent!.defaultValue as { readonly [key in typeof key]: Value })[key]; } /** @@ -161,92 +152,111 @@ export class BinderNode> extends EventTarget { } /** - * The array of validators for the model. The default value is defined in the - * model. + * The combined array of all errors for this node’s model and all its nested + * models */ - get validators(): ReadonlyArray> { - return this[_validators]; + get errors(): readonly ValueError[] { + return [...Array.from(this.#getChildBinderNodes(), (node) => node.errors).flat(), ...this.ownErrors]; } - set validators(validators: ReadonlyArray>) { - this[_validators] = validators; - this.dispatchEvent(CHANGED); + /** + * Indicates if there is any error for the node's model. + */ + get invalid(): boolean { + return this.errors.length > 0; } /** - * True if the bound field was ever focused and blurred by the user. + * The name generated from the model structure, used to set the name + * attribute on the field components. */ - get visited(): boolean { - return this[_visited]; - } + get name(): string { + let { model }: { model: AbstractModel } = this; + let name = ''; - set visited(v: boolean) { - if (this[_visited] !== v) { - this[_visited] = v; - this.updateValidation().catch(() => {}); - this.dispatchEvent(CHANGED); + while (model[_parent] instanceof AbstractModel) { + name = `${String(model[_key])}${name ? `.${name}` : ''}`; + model = model[_parent]; } - } - /** - * The combined array of all errors for this node’s model and all its nested - * models - */ - get errors(): ReadonlyArray> { - const descendantsErrors = [...this.getChildBinderNodes()].reduce( - (errors, childBinderNode) => [...errors, ...childBinderNode.errors], - [], - ); - return descendantsErrors.concat(this.ownErrors); + return name; } /** * The array of validation errors directly related with the model. */ - get ownErrors(): ReadonlyArray> { - return this[_ownErrors] ? this[_ownErrors] : []; + get ownErrors(): ReadonlyArray>> { + return this.#ownErrors ? this.#ownErrors : []; } /** - * Indicates if there is any error for the node's model. + * The parent node, if this binder node corresponds to a nested model, + * otherwise undefined for the top-level binder. */ - get invalid(): boolean { - return this.errors.length > 0; + get parent(): BinderNode | undefined { + const modelParent = this.model[_parent]; + return modelParent instanceof AbstractModel ? getBinderNode(modelParent) : undefined; } /** * True if the value is required to be non-empty. */ get required(): boolean { - return this[_validators].some((validator) => validator.impliesRequired); + return this.#validators.some((validator) => validator.impliesRequired); } /** - * Returns a binder node for the nested model instance. - * - * @param model - The nested model instance + * The array of validators for the model. The default value is defined in the + * model. */ - for>(model: NM): BinderNode, NM> { - const binderNode = getBinderNode(model); - if (binderNode.binder !== this.binder) { - throw new Error('Unknown binder'); + get validators(): ReadonlyArray>> { + return this.#validators; + } + + set validators(validators: ReadonlyArray>>) { + this.#validators = validators; + this.dispatchEvent(CHANGED); + } + + /** + * The current value related to the model + */ + get value(): Value | undefined { + if (!this.parent) { + return undefined; } - return binderNode; + let { value } = this.parent; + + if (value === undefined) { + this.parent.initializeValue(true); + ({ value } = this.parent); + } + + const key = this.model[_key]; + + // The value of parent in unknown, so we need to cast it. + type ParentValue = { readonly [K in typeof key]: Value }; + return (value as ParentValue)[key]; + } + + set value(value: Value | undefined) { + this.#setValueState(value); } /** - * Runs all validation callbacks potentially affecting this - * or any nested model. Returns the combined array of all - * errors as in the errors property. + * True if the bound field was ever focused and blurred by the user. */ - async validate(): Promise>> { - const errors = ( - await Promise.all([...this.requestValidationOfDescendants(), ...this.requestValidationWithAncestors()]) - ).flat(); - this.setErrorsWithDescendants(errors.length ? errors : undefined); - this.update(); - return errors; + get visited(): boolean { + return this.#visited; + } + + set visited(v: boolean) { + if (this.#visited !== v) { + this.#visited = v; + this[_updateValidation]().catch(() => {}); + this.dispatchEvent(CHANGED); + } } /** @@ -254,8 +264,8 @@ export class BinderNode> extends EventTarget { * * @param validator - a validator */ - addValidator(validator: Validator): void { - this.validators = [...this[_validators], validator]; + addValidator(validator: Validator>): void { + this.validators = [...this.#validators, validator]; this.dispatchEvent(CHANGED); } @@ -264,100 +274,121 @@ export class BinderNode> extends EventTarget { * * Requires the context model to be an array reference. * - * @param itemValue - optional new item value, an empty item is + * @param item - optional new item value, an empty item is * appended if the argument is omitted */ - appendItem> ? TArrayItem : never>( - itemValue?: TItem, - ): void { - const arrayNode = this.asArray(); - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - const itemValueOrEmptyValue = itemValue ?? arrayNode.model[_ItemModel].createEmptyValue(); - arrayNode.value = [...(arrayNode.value ?? []), itemValueOrEmptyValue]; + appendItem(item?: Value>): void { + if (this.#isArray()) { + const itemValueOrEmptyValue = item ?? this.model[_createEmptyItemValue](); + (this as BinderNode).value = [...(this.value ?? []), itemValueOrEmptyValue]; + } else { + throw new NotArrayModelError(); + } } /** - * Prepend an item to the array value. - * - * Requires the context model to be an array reference. + * Returns a binder node for the nested model instance. * - * @param itemValue - optional new item value, an empty item is prepended if - * the argument is omitted + * @param model - The nested model instance */ - prependItem> ? TArrayItem : never>( - itemValue?: TItem, - ): void { - const arrayNode = this.asArray(); - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - const itemValueOrEmptyValue = itemValue ?? arrayNode.model[_ItemModel].createEmptyValue(); - arrayNode.value = [itemValueOrEmptyValue, ...(arrayNode.value ?? [])]; + for(model: N): BinderNode { + const binderNode = getBinderNode(model); + if (binderNode.binder !== this.binder) { + throw new Error('Unknown binder'); + } + + return binderNode; + } + + prependItem(item?: Value>): void { + if (this.#isArray()) { + const itemValueOrEmptyValue = item ?? this.model[_createEmptyItemValue](); + (this as BinderNode).value = [itemValueOrEmptyValue, ...(this.value ?? [])]; + } else { + throw new NotArrayModelError(); + } + } + + removeSelf(): void { + if (this.#isArrayItem()) { + this.parent.value = (this.parent.value ?? []).filter((_, i) => i !== this.model[_key]); + } else { + throw new NotArrayItemModelError(); + } } /** - * Remove itself from the parent array value. - * - * Requires the context model to be an array item reference. + * Runs all validation callbacks potentially affecting this + * or any nested model. Returns the combined array of all + * errors as in the errors property. */ - removeSelf(): void { - const arrayItemNode = this.asArrayItem(); - const itemIndex = this.model[_key]; - const arrayNode = arrayItemNode.parent; - arrayNode.value = (arrayNode.value ?? []).filter((_, i) => i !== itemIndex); + async validate(): Promise { + const errors = await Promise.all([ + ...this.#requestValidationOfDescendants(), + ...this.#requestValidationWithAncestors(), + ]).then((arr) => arr.flat()); + this[_setErrorsWithDescendants](errors.length ? errors : undefined); + this[_update](); + return errors; } - protected clearValidation(): boolean { - if (this[_visited]) { - this[_visited] = false; + protected [_clearValidation](): boolean { + if (this.#visited) { + this.#visited = false; this.dispatchEvent(CHANGED); } let needsUpdate = false; - if (this[_ownErrors]) { - this[_ownErrors] = undefined; + if (this.#ownErrors) { + this.#ownErrors = undefined; needsUpdate = true; this.dispatchEvent(CHANGED); } - if ([...this.getChildBinderNodes()].filter((childBinderNode) => childBinderNode.clearValidation()).length > 0) { + if ([...this.#getChildBinderNodes()].filter((childBinderNode) => childBinderNode[_clearValidation]()).length > 0) { needsUpdate = true; } return needsUpdate; } - protected async updateValidation(): Promise { - if (this[_visited]) { - await this.validate(); - } else if (this.dirty || this.invalid) { - await Promise.all( - [...this.getChildBinderNodes()].map(async (childBinderNode) => childBinderNode.updateValidation()), - ); + protected [_setErrorsWithDescendants](errors?: readonly ValueError[]): void { + const { name } = this; + const ownErrors = errors + ? (errors.filter((valueError) => getErrorPropertyName(valueError) === name) as ReadonlyArray< + ValueError> + >) + : undefined; + const relatedErrors = errors + ? errors.filter((valueError) => getErrorPropertyName(valueError).startsWith(name)) + : undefined; + this.#ownErrors = ownErrors; + for (const childBinderNode of this.#getChildBinderNodes()) { + childBinderNode[_setErrorsWithDescendants](relatedErrors); } + this.dispatchEvent(CHANGED); } - protected update(_?: T): void { + protected [_update](_?: Value): void { if (this.parent) { - this.parent.update(); + this.parent[_update](); } } - protected setErrorsWithDescendants(errors?: ReadonlyArray>): void { - const { name } = this; - const ownErrors = errors ? errors.filter((valueError) => getErrorPropertyName(valueError) === name) : undefined; - const relatedErrors = errors - ? errors.filter((valueError) => getErrorPropertyName(valueError).startsWith(name)) - : undefined; - this[_ownErrors] = ownErrors; - for (const childBinderNode of this.getChildBinderNodes()) { - childBinderNode.setErrorsWithDescendants(relatedErrors); + protected async [_updateValidation](): Promise { + if (this.#visited) { + await this.validate(); + } else if (this.dirty || this.invalid) { + await Promise.all( + [...this.#getChildBinderNodes()].map(async (childBinderNode) => childBinderNode[_updateValidation]()), + ); } - this.dispatchEvent(CHANGED); } - private *getChildBinderNodes(): Generator>> { + *#getChildBinderNodes(): Generator { if (this.value === undefined) { // Undefined value cannot have child properties and items. return; } - if (this.model instanceof ObjectModel) { + if (this.#isObject()) { // We need to skip all non-initialised optional fields here in order to // prevent infinite recursion for circular references in the model. // Here we rely on presence of keys in `defaultValue` to detect all @@ -365,136 +396,118 @@ export class BinderNode> extends EventTarget { // non-optional fields plus those optional fields whose values were set // from initial `binder.read()` or `binder.clear()` or by using a // binder node (e.g., form binding) for a nested field. - if (this.defaultValue) { - for (const [, getter] of ObjectModel.getOwnAndParentGetters(this.model)) { - const childModel = getter.call(this.model); - if (childModel instanceof AbstractModel) { - yield getBinderNode(childModel); - } + if (this.defaultValue !== undefined) { + for (const [, getter] of getObjectModelOwnAndParentGetters(this.model)) { + yield getBinderNode(getter.call(this.model)); } } - } else if (this.model instanceof ArrayModel) { + } else if (this.#isArray()) { for (const childBinderNode of this.model) { yield childBinderNode; } } } - private runOwnValidators(): ReadonlyArray>>> { - if (this[_validity] && !this[_validity].valid) { - // The element's internal validation reported invalid state. + #isArray(): this is BinderNode { + return this.model instanceof ArrayModel; + } - if (this[_validity].badInput) { - // Bad input means the `value` cannot be used and even meaningfully - // validated with the validators in the binder, because it cannot be - // parsed, for example, if a date is entered with incorrect format. - // - // Skip running the validators, and instead assume the only error - // from the validity state. - return [this.binder.requestValidation(this.model, this.validityStateValidator)]; - } - // Validate the value, but also raise the error from the validity state. - return [...this[_validators], this.validityStateValidator].map(async (validator) => - this.binder.requestValidation(this.model, validator), - ); - } + #isArrayItem(): this is ArrayItemBinderNode { + return this.model[_parent] instanceof ArrayModel; + } - return this[_validators].map(async (validator) => this.binder.requestValidation(this.model, validator)); + #isObject(): this is BinderNode { + return this.model instanceof ObjectModel; } - private requestValidationOfDescendants(): ReadonlyArray>>> { - return [...this.getChildBinderNodes()].reduce>>>>( - (promises, childBinderNode) => [ - ...promises, - ...childBinderNode.runOwnValidators(), - ...childBinderNode.requestValidationOfDescendants(), - ], - [], - ); + *#requestValidationOfDescendants(): Generator, void, void> { + for (const node of this.#getChildBinderNodes()) { + yield* node.#runOwnValidators(); + yield* node.#requestValidationOfDescendants(); + } } - private requestValidationWithAncestors(): ReadonlyArray>>> { - return [...this.runOwnValidators(), ...(this.parent ? this.parent.requestValidationWithAncestors() : [])]; + *#requestValidationWithAncestors(): Generator, void, void> { + yield* this.#runOwnValidators(); + + if (this.parent) { + yield* this.parent.#requestValidationWithAncestors(); + } + } + + *#runOwnValidators(): Generator, void, void> { + const hasInvalidState = this[_validity] && !this[_validity].valid; + const hasBadInput = !!this[_validity]?.badInput; + + if ((hasInvalidState && !hasBadInput) || !hasInvalidState) { + for (const validator of this.#validators) { + yield this.binder.requestValidation(this.model, validator); + } + } + + if (hasInvalidState) { + yield this.binder.requestValidation(this.model, this.#validityStateValidator); + } } initializeValue(forceInitialize = false): void { // First, make sure parents have value initialized - if (this.parent && (this.parent.value === undefined || (this.parent.defaultValue as T | undefined) === undefined)) { + if ( + this.parent && + (this.parent.value === undefined || (this.parent.defaultValue as Value | undefined) === undefined) + ) { this.parent.initializeValue(true); } const key = this.model[_key]; - let value: T | undefined = this.parent - ? (this.parent.value as { readonly [key in typeof key]: T })[this.model[_key]] + let value: Value | undefined = this.parent + ? (this.parent.value as { [key in typeof key]: Value })[this.model[_key]] : undefined; if (value === undefined) { // Initialize value if this is the root level node, or it is enforced if (forceInitialize || !this.parent) { - value = this.model.constructor.createEmptyValue() as T; - this.setValueState(value, this.defaultValue === undefined); + value = this.model.constructor.createEmptyValue() as Value; + this.#setValueState(value, this.defaultValue === undefined); } else if ( this.parent.model instanceof ObjectModel && - !(key in ((this.parent.value || {}) as { readonly [key in typeof key]?: T })) + !(key in ((this.parent.value || {}) as { [key in typeof key]?: Value })) ) { - this.setValueState(undefined, this.defaultValue === undefined); + this.#setValueState(undefined, this.defaultValue === undefined); } } } - private setValueState(value: T | undefined, keepPristine = false): void { - const modelParent = this.model[_parent]; + #setValueState(value: Value | undefined, keepPristine = false): void { + const { parent } = this; const key = this.model[_key]; - if (modelParent instanceof ObjectModel) { - // Value contained in object - replace object in parent - const object: { readonly [key in typeof key]?: T } = { - ...(this.parent!.value as { readonly [key in typeof key]?: T }), - [key]: value, - }; - this.parent!.setValueState(object, keepPristine); - return; + + if (parent) { + if (parent.#isObject()) { + // Value contained in object - replace object in parent + parent.#setValueState({ ...parent.value, [key]: value }, keepPristine); + + return; + } } if (value === undefined) { throw new TypeError('Unexpected undefined value'); } - if (this.isArrayItem()) { + if (this.#isArrayItem()) { // Value contained in array - replace array in parent const array = (this.parent.value ?? []).slice(); array[key as number] = value; - this.parent.setValueState(array, keepPristine); + this.parent.#setValueState(array, keepPristine); } else { // Value contained elsewhere, probably binder - use value property setter - const binder = modelParent as Binder; + const binder = this.model[_parent] as BinderRoot; + if (keepPristine && !binder.dirty) { binder.defaultValue = value; } binder.value = value!; } } - - private isArray(): this is ArrayBinderNode { - return this.model instanceof ArrayModel; - } - - private asArray(): ArrayBinderNode { - if (!this.isArray()) { - throw new TypeError('Model is not array'); - } - - return this as ArrayBinderNode; - } - - private isArrayItem(): this is ArrayItemBinderNode { - return this.parent?.model instanceof ArrayModel; - } - - private asArrayItem(): ArrayItemBinderNode { - if (!this.isArrayItem()) { - throw new TypeError('Model is not an array item'); - } - - return this as ArrayItemBinderNode; - } } diff --git a/packages/ts/form/src/BinderRoot.ts b/packages/ts/form/src/BinderRoot.ts index 1ed07af8c6..7b22922e40 100644 --- a/packages/ts/form/src/BinderRoot.ts +++ b/packages/ts/form/src/BinderRoot.ts @@ -1,7 +1,20 @@ import { EndpointValidationError, type ValidationErrorData } from '@hilla/frontend/EndpointErrors.js'; -import { BinderNode, CHANGED } from './BinderNode.js'; -import { type FieldStrategy, getDefaultFieldStrategy } from './Field.js'; -import { _parent, type AbstractModel, type HasValue, type ModelConstructor } from './Models.js'; +import { + _clearValidation, + _setErrorsWithDescendants, + _update, + _updateValidation, + BinderNode, + CHANGED, +} from './BinderNode.js'; +import { type FieldElement, type FieldStrategy, getDefaultFieldStrategy } from './Field.js'; +import { + createDetachedModel, + _parent, + type AbstractModel, + type DetachedModelConstructor, + type Value, +} from './Models.js'; import { type InterpolateMessageCallback, runValidator, @@ -11,25 +24,14 @@ import { type ValueError, } from './Validation.js'; -export { CHANGED }; - -const _submitting = Symbol('submitting'); -const _defaultValue = Symbol('defaultValue'); -const _value = Symbol('value'); -const _emptyValue = Symbol('emptyValue'); -const _config = Symbol('config'); -const _validations = Symbol('validations'); -const _validating = Symbol('validating'); -const _validationRequestSymbol = Symbol('validationRequest'); - export type BinderConfiguration = Readonly<{ onChange?(oldValue?: T): void; - onSubmit?(value: T): Promise | Promise; + onSubmit?(value: T): Promise; }>; export type BinderRootConfiguration = BinderConfiguration & Readonly<{ - context?: any; + context?: unknown; }>; /** @@ -39,26 +41,26 @@ export type BinderRootConfiguration = BinderConfiguration & * @typeParam T - Type of the value that binds to a form * @typeParam M - Type of the model that describes the structure of the value */ -export class BinderRoot> extends BinderNode { +export class BinderRoot extends BinderNode { static interpolateMessageCallback?: InterpolateMessageCallback; - private [_defaultValue]!: T; // Initialized in the `read()` method + #defaultValue!: Value; // Initialized in the `read()` method - private [_value]!: T; // Initialized in the `read()` method + #value!: Value; // Initialized in the `read()` method - private [_emptyValue]: T; + readonly #emptyValue: Value; - private [_submitting] = false; + #submitting = false; - private [_validating] = false; + #validating = false; - private [_validationRequestSymbol]?: Promise; + #validationRequest?: Promise; - private [_config]?: BinderRootConfiguration; + #config?: BinderRootConfiguration>; - private [_validations] = new Map, Map, Promise>>>>(); + #validations = new Map>>(); - #context: any = this; + readonly #context: unknown = this; /** * @@ -71,45 +73,49 @@ export class BinderRoot> extends BinderNode * binder = new BinderRoot(OrderModel, {onSubmit: async (order) => {endpoint.save(order)}}); * ``` */ - constructor(Model: ModelConstructor, config?: BinderRootConfiguration) { - const valueContainer: HasValue = { value: undefined }; - super(new Model(valueContainer, 'value', false)); - this[_emptyValue] = valueContainer.value!; + constructor(Model: DetachedModelConstructor, config?: BinderRootConfiguration>) { + super(createDetachedModel(Model)); // @ts-expect-error the model's parent is the binder this.model[_parent] = this; this.#context = config?.context ?? this; - this[_config] = config; - this.read(this[_emptyValue]); + this.#config = config; + // Initialize value instead of the parent. + this.initializeValue(true); + this.#emptyValue = this.value; } /** * The initial value of the form, before any fields are edited by the user. */ - override get defaultValue(): T { - return this[_defaultValue]; + override get defaultValue(): Value { + return this.#defaultValue; } - override set defaultValue(newValue: T) { - this[_defaultValue] = newValue; + override set defaultValue(newValue: Value) { + this.#defaultValue = newValue; this.dispatchEvent(CHANGED); } + override get binder(): BinderRoot { + return this as BinderRoot; + } + /** * The current value of the form. */ - override get value(): T { - return this[_value]; + override get value(): Value { + return this.#value; } - override set value(newValue: T) { - if (newValue === this[_value]) { + override set value(newValue: Value) { + if (newValue === this.#value) { return; } - const oldValue = this[_value]; - this[_value] = newValue; - this.update(oldValue); - this.updateValidation().catch(() => {}); + const oldValue = this.#value; + this.#value = newValue; + this[_update](oldValue); + this[_updateValidation]().catch(() => {}); } /** @@ -117,7 +123,7 @@ export class BinderRoot> extends BinderNode * True if the form was submitted, but the submit promise is not resolved yet. */ get submitting(): boolean { - return this[_submitting]; + return this.#submitting; } /** @@ -125,7 +131,7 @@ export class BinderRoot> extends BinderNode * True when there is an ongoing validation. */ get validating(): boolean { - return this[_validating]; + return this.#validating; } /** @@ -133,7 +139,7 @@ export class BinderRoot> extends BinderNode * * @param value - The value to read, or undefined to clear. */ - read(value: T | null | undefined): void { + read(value: Value | null | undefined): void { if (value === undefined || value === null) { this.clear(); return; @@ -143,12 +149,12 @@ export class BinderRoot> extends BinderNode // Skip when no value is set yet (e.g., invoked from constructor) this.value && // Clear validation state, then proceed if update is needed - this.clearValidation() && + this[_clearValidation]() && // When value is dirty, another update is coming from invoking the value // setter below, so we skip this one to prevent duplicate updates this.value === value ) { - this.update(this.value); + this[_update](this.value); } this.value = this.defaultValue; @@ -158,14 +164,14 @@ export class BinderRoot> extends BinderNode * Reset the form to the previous value */ reset(): void { - this.read(this[_defaultValue]); + this.read(this.#defaultValue); } /** * Sets the form to empty value, as defined in the Model. */ clear(): void { - this.read(this[_emptyValue]); + this.read(this.#emptyValue); } /** @@ -174,11 +180,12 @@ export class BinderRoot> extends BinderNode * * It's a no-op if the onSubmit callback is undefined. */ - async submit(): Promise { - const onSubmit = this[_config]?.onSubmit; + async submit(): Promise | undefined | void> { + const onSubmit = this.#config?.onSubmit; if (onSubmit) { - return this.submitTo(onSubmit as (value: T) => Promise); + return this.submitTo(onSubmit); } + return undefined; } @@ -187,14 +194,14 @@ export class BinderRoot> extends BinderNode * * @param endpointMethod - the callback function */ - async submitTo(endpointMethod: (value: T) => Promise): Promise { + async submitTo(endpointMethod: (value: Value) => Promise): Promise { const errors = await this.validate(); if (errors.length) { throw new ValidationError(errors); } - this[_submitting] = true; - this.update(this.value); + this.#submitting = true; + this[_update](this.value); this.dispatchEvent(CHANGED); try { return await endpointMethod.call(this.#context, this.value); @@ -214,28 +221,32 @@ export class BinderRoot> extends BinderNode value, }); }); - this.setErrorsWithDescendants(valueErrors); + this[_setErrorsWithDescendants](valueErrors); throw new ValidationError(valueErrors); } throw error; } finally { - this[_submitting] = false; + this.#submitting = false; this.defaultValue = this.value; - this.update(this.value); + this[_update](this.value); } } - async requestValidation>( + async requestValidation( model: NM, - validator: Validator, - ): Promise>> { - let modelValidations: Map, Promise>>>; - if (this[_validations].has(model)) { - modelValidations = this[_validations].get(model) as Map, Promise>>>; + validator: Validator>, + ): Promise>>> { + let modelValidations: Map>, Promise>>>>; + + if (this.#validations.has(model)) { + modelValidations = this.#validations.get(model) as Map< + Validator>, + Promise>>> + >; } else { modelValidations = new Map(); - this[_validations].set(model, modelValidations); + this.#validations.set(model, modelValidations); } await this.performValidation(); @@ -250,9 +261,9 @@ export class BinderRoot> extends BinderNode modelValidations.delete(validator); if (modelValidations.size === 0) { - this[_validations].delete(model); + this.#validations.delete(model); } - if (this[_validations].size === 0) { + if (this.#validations.size === 0) { this.completeValidation(); } @@ -267,31 +278,28 @@ export class BinderRoot> extends BinderNode * @param elm - the bound element * @param model - the bound model */ - getFieldStrategy(elm: any, model?: AbstractModel): FieldStrategy { - return getDefaultFieldStrategy(elm, model); + getFieldStrategy(elm: HTMLElement, model?: AbstractModel): FieldStrategy { + return getDefaultFieldStrategy(elm as FieldElement, model); } protected performValidation(): Promise | void { - if (!this[_validationRequestSymbol]) { - this[_validating] = true; + if (!this.#validationRequest) { + this.#validating = true; this.dispatchEvent(CHANGED); - this[_validationRequestSymbol] = Promise.resolve().then(() => { - this[_validationRequestSymbol] = undefined; + this.#validationRequest = Promise.resolve().then(() => { + this.#validationRequest = undefined; }); } - return this[_validationRequestSymbol]; + return this.#validationRequest; } protected completeValidation(): void { - this[_validating] = false; + this.#validating = false; this.dispatchEvent(CHANGED); } - protected override update(oldValue: T): void { - const onChange = this[_config]?.onChange; - if (onChange) { - onChange.call(this.#context, oldValue); - } + protected override [_update](oldValue: Value): void { + this.#config?.onChange?.call(this.#context, oldValue); this.dispatchEvent(CHANGED); } } diff --git a/packages/ts/form/src/Field.ts b/packages/ts/form/src/Field.ts index 4fd27c6fbe..20ecc3a1e9 100644 --- a/packages/ts/form/src/Field.ts +++ b/packages/ts/form/src/Field.ts @@ -1,15 +1,8 @@ /* eslint-disable accessor-pairs,sort-keys */ import { type ElementPart, noChange, nothing, type PropertyPart } from 'lit'; import { directive, Directive, type DirectiveParameters, type PartInfo, PartType } from 'lit/directive.js'; -import { - _fromString, - type AbstractModel, - ArrayModel, - BooleanModel, - ObjectModel, - getBinderNode, - hasFromString, -} from './Models.js'; +import { getBinderNode } from './BinderNode.js'; +import { _fromString, type AbstractModel, ArrayModel, BooleanModel, hasFromString, ObjectModel } from './Models.js'; import type { ValueError } from './Validation.js'; import { _validity, defaultValidity } from './Validity.js'; @@ -28,7 +21,7 @@ export type FieldConstraintValidation = Readonly<{ checkValidity(): boolean; }>; -export type FieldElement = FieldBase & HTMLElement & Partial; +export type FieldElement = FieldBase & HTMLElement & Partial; const props = ['required', 'invalid', 'errorMessage', 'value', 'validity', 'checkValidity']; export function isFieldElement(element: HTMLElement): element is FieldElement { @@ -69,21 +62,21 @@ export abstract class AbstractFieldStrategy = readonly model?: AbstractModel; - private _element: E; + #element: E; /** * @privateRemarks * Fallback for missing .validity property API in Vaadin components. */ - private _validityFallback: ValidityState = defaultValidity; + #validityFallback: ValidityState = defaultValidity; constructor(element: E, model?: AbstractModel) { - this._element = element; + this.#element = element; this.model = model; } get element(): E { - return this._element; + return this.#element; } /** @@ -91,56 +84,56 @@ export abstract class AbstractFieldStrategy = * @deprecated will be read-only in future */ set element(element: E) { - this._element = element; + this.#element = element; } get value(): T | undefined { - return this.element.value; + return this.#element.value; } set value(value: T | undefined) { - this.element.value = value; + this.#element.value = value; } - set errorMessage(_: string) {} // eslint-disable-line @typescript-eslint/no-empty-function + set errorMessage(_: string) {} get validity(): ValidityState { - return this.element.validity ?? this._validityFallback; + return this.#element.validity ?? this.#validityFallback; } checkValidity(): boolean { - if (!this.element.checkValidity) { + if (!this.#element.checkValidity) { return true; } - const valid = this.element.checkValidity(); - this._validityFallback = { + const valid = this.#element.checkValidity(); + this.#validityFallback = { ...defaultValidity, valid, - ...(valid ? {} : this._detectValidityError()), + ...(valid ? {} : this.#detectValidityError()), }; return valid; } setAttribute(key: string, val: any): void { if (val) { - this.element.setAttribute(key, ''); + this.#element.setAttribute(key, ''); } else { - this.element.removeAttribute(key); + this.#element.removeAttribute(key); } } removeEventListeners(): void {} - private _detectValidityError(): Readonly> { - if (!('inputElement' in this.element)) { + #detectValidityError(): Readonly> { + if (!('inputElement' in this.#element)) { // Not a Vaadin component field return { customError: true }; } - const inputElement = this.element.inputElement as FieldElement; + const inputElement = this.#element.inputElement as FieldElement; - if (this.element.value === '') { + if (this.#element.value === '') { if (inputElement.value === '') { return { valueMissing: true }; } @@ -157,13 +150,12 @@ export class VaadinFieldStrategy = FieldEleme T, E > { - private _invalid = false; - private readonly _boundOnValidated = this._onValidated.bind(this); + #invalid = false; + readonly #boundOnValidated = this.#onValidated.bind(this); constructor(element: E, model?: AbstractModel) { super(element, model); - - (element as EventTarget).addEventListener('validated', this._boundOnValidated); + element.addEventListener('validated', this.#boundOnValidated); } set required(value: boolean) { @@ -171,7 +163,7 @@ export class VaadinFieldStrategy = FieldEleme } set invalid(value: boolean) { - this._invalid = value; + this.#invalid = value; this.element.invalid = value; } @@ -180,10 +172,10 @@ export class VaadinFieldStrategy = FieldEleme } override removeEventListeners(): void { - this.element.removeEventListener('validated', this._boundOnValidated); + this.element.removeEventListener('validated', this.#boundOnValidated); } - private _onValidated(e: Event): void { + #onValidated(e: Event): void { if (!(e instanceof CustomEvent) || typeof e.detail !== 'object') { return; } @@ -191,8 +183,8 @@ export class VaadinFieldStrategy = FieldEleme // Override built-in changes of the `invalid` flag in Vaadin components // to keep the `invalid` property state of the web component in sync. const invalid = !(e.detail satisfies Partial as Partial).valid; - if (this._invalid !== invalid) { - this.element.invalid = this._invalid; + if (this.#invalid !== invalid) { + this.element.invalid = this.#invalid; } } } @@ -321,7 +313,7 @@ export function getDefaultFieldStrategy(elm: FieldElement, model?: Abstrac } } -function convertFieldValue>(model: T, fieldValue: unknown) { +function convertFieldValue(model: T, fieldValue: unknown) { return typeof fieldValue === 'string' && hasFromString(model) ? model[_fromString](fieldValue) : fieldValue; } @@ -353,7 +345,7 @@ export const field = directive( } override update(part: ElementPart | PropertyPart, [model, effect]: DirectiveParameters) { - const element = part.element as FieldElement & HTMLInputElement; + const element = part.element as FieldElement & HTMLInputElement; const binderNode = getBinderNode(model); diff --git a/packages/ts/form/src/Models.ts b/packages/ts/form/src/Models.ts index df93192412..c8cc827ccb 100644 --- a/packages/ts/form/src/Models.ts +++ b/packages/ts/form/src/Models.ts @@ -1,31 +1,18 @@ -// TODO: Fix dependency cycle - import isNumeric from 'validator/es/lib/isNumeric.js'; -// eslint-disable-next-line import/no-cycle -import { BinderNode } from './BinderNode.js'; +import { type BinderNode, getBinderNode } from './BinderNode.js'; import type { Validator } from './Validation.js'; import { IsNumber } from './Validators.js'; -export const _ItemModel = Symbol('ItemModel'); +export const _createEmptyItemValue = Symbol('itemModel'); export const _parent = Symbol('parent'); export const _key = Symbol('key'); export const _fromString = Symbol('fromString'); export const _validators = Symbol('validators'); -export const _binderNode = Symbol('binderNode'); export const _getPropertyModel = Symbol('getPropertyModel'); export const _enum = Symbol('enum'); -const _properties = Symbol('properties'); const _optional = Symbol('optional'); -export function getBinderNode, T extends ModelValue>(model: M): BinderNode { - if (!model[_binderNode]) { - model[_binderNode] = new BinderNode(model); - } - - return model[_binderNode]!; -} - export interface HasFromString { [_fromString](value: string): T; } @@ -34,57 +21,38 @@ export function hasFromString(model: AbstractModel): model is AbstractMode return _fromString in model; } -export interface HasValue { - value?: T; -} +export type Value = M extends AbstractModel ? T : never; + +export const modelDetachedParent = { $value$: undefined }; + +export type ModelParent = AbstractModel | BinderNode | typeof modelDetachedParent; -export type ModelParent = AbstractModel | HasValue; -export type ModelValue> = ReturnType; +export type DetachedModelConstructor = new ( + parent: typeof modelDetachedParent, + key: '$value$', + optional: boolean, +) => M; -export interface ModelConstructor> { - new (parent: ModelParent, key: keyof any, optional: boolean, ...args: any[]): M; - createEmptyValue(): T; +export function createDetachedModel(type: DetachedModelConstructor): M { + return new type(modelDetachedParent, '$value$', false); } -type ModelVariableArguments = C extends new ( - parent: ModelParent, - key: keyof any, - ...args: infer R extends [boolean, ...any] -) => AbstractModel - ? R - : never; - -type ModelCtor = { - new (parent: ModelParent, key: keyof any, ...args: any[]): any; - createEmptyValue(): unknown; -}; - -export type ModelInstance> = C extends new ( - parent: ModelParent, - key: keyof any, - ...args: MArgs -) => infer M - ? M - : never; - -export abstract class AbstractModel { +export abstract class AbstractModel { static createEmptyValue(): unknown { return undefined; } - declare readonly ['constructor']: typeof AbstractModel; + declare readonly ['constructor']: typeof AbstractModel; - readonly [_parent]: ModelParent; + readonly [_parent]?: ModelParent; readonly [_validators]: ReadonlyArray>; readonly [_optional]: boolean; - [_binderNode]?: BinderNode; - [_key]: keyof any; - constructor(parent: ModelParent, key: keyof any, optional: boolean, ...validators: ReadonlyArray>) { + constructor(parent: ModelParent, key: keyof any, optional: boolean, ...validators: ReadonlyArray>) { this[_parent] = parent; this[_key] = key; this[_optional] = optional; @@ -97,10 +65,12 @@ export abstract class AbstractModel { valueOf(): T { const { value } = getBinderNode(this); + if (value === undefined) { throw new TypeError('Value is undefined'); } - return value; + + return value! as T; } } @@ -119,12 +89,7 @@ export class BooleanModel extends PrimitiveModel implements HasFromStri export class NumberModel extends PrimitiveModel implements HasFromString { static override createEmptyValue = Number; - constructor( - parent: ModelParent, - key: keyof any, - optional: boolean, - ...validators: ReadonlyArray> - ) { + constructor(parent: ModelParent, key: keyof any, optional: boolean, ...validators: ReadonlyArray>) { // Prepend a built-in validator to indicate NaN input super(parent, key, optional, new IsNumber(optional), ...validators); } @@ -139,28 +104,22 @@ export class NumberModel extends PrimitiveModel implements HasFromString export class StringModel extends PrimitiveModel implements HasFromString { static override createEmptyValue = String; - [_fromString] = String; } declare enum Enum {} -export abstract class EnumModel +export function makeEnumEmptyValueCreator(type: DetachedModelConstructor): () => Value { + const { [_enum]: enumObject } = createDetachedModel(type); + const defaultValue = Object.values(enumObject)[0] as Value; + + return () => defaultValue; +} + +export abstract class EnumModel extends AbstractModel implements HasFromString { - static override createEmptyValue(): unknown { - if (this === EnumModel) { - throw new Error('Cannot create an instance of an abstract class'); - } - - // @ts-expect-error: the instantiation of the abstract class is handled above. - // Now only the children instantiation could happen. - const { [_enum]: enumObject } = new this({ value: undefined }, 'value', false); - - return Object.values(enumObject)[0]; - } - abstract readonly [_enum]: E; [_fromString](value: string): E[keyof E] | undefined { @@ -168,102 +127,105 @@ export abstract class EnumModel } } -export class ObjectModel extends AbstractModel { - static *getOwnAndParentGetters>( - model: M, - ): Generator unknown]> { - for ( - let proto = Object.getPrototypeOf(model); - proto !== ObjectModel.prototype; - proto = Object.getPrototypeOf(proto) - ) { - const descriptors = Object.getOwnPropertyDescriptors(proto); - for (const [name, { get }] of Object.entries(descriptors)) { - if (get) { - yield [name, get]; - } +export function* getObjectModelOwnAndParentGetters( + model: M, +): Generator, getter: () => AbstractModel]> { + for ( + let proto = Object.getPrototypeOf(model); + proto !== ObjectModel.prototype; + proto = Object.getPrototypeOf(proto) + ) { + const descriptors = Object.getOwnPropertyDescriptors(proto); + for (const [name, { get }] of Object.entries(descriptors)) { + if (get) { + yield [name as keyof Value, get]; } } } +} - static override createEmptyValue(): { readonly [key in never]: unknown } { - const model = new this({ value: undefined as any }, 'value' as keyof any, false); - const obj: Record = {}; +export function makeObjectEmptyValueCreator(type: DetachedModelConstructor): () => Value { + const model = createDetachedModel(type); + + return () => { + // eslint-disable-next-line @typescript-eslint/consistent-type-assertions + const obj: Partial> = {}; // Iterate the model class hierarchy up to the ObjectModel, and extract // the property getter names from every prototypes - for (const [key, getter] of this.getOwnAndParentGetters(model)) { - const propertyModel = getter.call(model) as AbstractModel; - obj[key] = propertyModel[_optional] ? undefined : propertyModel.constructor.createEmptyValue(); + for (const [key, getter] of getObjectModelOwnAndParentGetters(model)) { + const propertyModel = getter.call(model); + obj[key] = ( + propertyModel[_optional] ? undefined : propertyModel.constructor.createEmptyValue() + ) as Value[keyof Value]; } - return obj; - } + return obj as Value; + }; +} + +type ChildModel, K extends keyof T> = AbstractModel>; + +export class ObjectModel = Record> extends AbstractModel { + static override createEmptyValue = makeObjectEmptyValueCreator(ObjectModel); - private [_properties]: { [name in keyof T]?: AbstractModel } = {}; + #properties: { [K in keyof T]?: ChildModel } = {}; - protected [_getPropertyModel]< - KChild extends keyof T, - C extends ModelCtor, - MArgs extends ModelVariableArguments, - M extends ModelInstance, - >(key: KChild, ValueModel: C, valueModelArgs: MArgs): M { - if (this[_properties][key] === undefined) { - this[_properties][key] = new ValueModel(this, key, ...valueModelArgs); + protected [_getPropertyModel]>( + key: K, + init: (parent: this, key: K) => M, + ): M { + if (!this.#properties[key]) { + this.#properties[key] = init(this, key); } - return this[_properties][key]! as M; + return this.#properties[key] as M; } } -export class ArrayModel< - T extends ModelValue, - M extends ModelInstance, - C extends ModelCtor = ModelConstructor, - MArgs extends ModelVariableArguments = ModelVariableArguments, -> extends AbstractModel { +export type ArrayItemModel = M extends ArrayModel ? MItem : never; + +export class ArrayModel extends AbstractModel>> { static override createEmptyValue(): [] { return []; } - private readonly [_ItemModel]: C; - - private readonly itemModelArgs: MArgs; + [_createEmptyItemValue]: () => Value; - private readonly itemModels: M[] = []; + readonly #createItem: (parent: this, index: number) => MItem; + #items: Array = []; constructor( - parent: ModelParent, + parent: ModelParent, key: keyof any, optional: boolean, - ItemModel: C, - itemModelArgs: MArgs, - ...validators: ReadonlyArray> + createItem: (parent: ArrayModel, key: number) => MItem, + ...validators: ReadonlyArray>>> ) { super(parent, key, optional, ...validators); - this[_ItemModel] = ItemModel; - this.itemModelArgs = itemModelArgs; + this.#createItem = createItem; + this[_createEmptyItemValue] = createItem(this, 0).constructor.createEmptyValue as () => Value; } /** * Iterates the current array value and yields a binder node for every item. */ - *[Symbol.iterator](): IterableIterator> { + *[Symbol.iterator](): IterableIterator> { const array = this.valueOf(); - const ItemModel = this[_ItemModel]; - if (array.length !== this.itemModels.length) { - this.itemModels.length = array.length; + + if (array.length !== this.#items.length) { + this.#items.length = array.length; } - for (const i of array.keys()) { - let itemModel: M | undefined = this.itemModels[i]; - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - if (itemModel === undefined) { - // const [optional, ...rest] = this.itemModelArgs; - itemModel = new ItemModel(this, i, ...this.itemModelArgs); - // @ts-expect-error M always matches the expected type - this.itemModels[i] = itemModel; + + for (let i = 0; i < array.length; i++) { + let item: MItem | undefined = this.#items[i]; + + if (!item) { + item = this.#createItem(this, i); + this.#items[i] = item; } - yield getBinderNode(itemModel!) as unknown as BinderNode; + + yield getBinderNode(item); } } } diff --git a/packages/ts/form/src/Validation.ts b/packages/ts/form/src/Validation.ts index 7a4a62175e..a27bc9aa59 100644 --- a/packages/ts/form/src/Validation.ts +++ b/packages/ts/form/src/Validation.ts @@ -1,29 +1,25 @@ -// TODO: Fix dependency cycle - -// eslint-disable-next-line import/no-cycle - -import type { Binder } from './Binder.js'; import type { BinderNode } from './BinderNode.js'; -import { type AbstractModel, NumberModel, getBinderNode } from './Models.js'; -// eslint-disable-next-line import/no-cycle +import { getBinderNode } from './BinderNode.js'; +import type { BinderRoot } from './BinderRoot.js'; +import { type AbstractModel, NumberModel, type Value } from './Models.js'; import { Required } from './Validators.js'; -export interface ValueError { - property: AbstractModel | string; +export interface ValueError { + property: AbstractModel | string; message: string; value: T; validator: Validator; } export interface ValidationResult { - property: AbstractModel | string; + property: AbstractModel | string; message?: string; } export class ValidationError extends Error { - errors: ReadonlyArray>; + errors: readonly ValueError[]; - constructor(errors: ReadonlyArray>) { + constructor(errors: readonly ValueError[]) { super( [ 'There are validation errors in the form.', @@ -37,28 +33,26 @@ export class ValidationError extends Error { } } -export type ValidationCallback = ( - value: T, - binder: Binder>, -) => - | Promise - | ValidationResult - | boolean - | readonly ValidationResult[]; - -export type InterpolateMessageCallback = ( +export type InterpolateMessageCallback = ( message: string, - validator: Validator, - binderNode: BinderNode>, + validator: Validator>, + binderNode: BinderNode, ) => string; -export interface Validator { - validate: ValidationCallback; +export interface Validator { message: string; impliesRequired?: boolean; + validate( + value: T, + binder: BinderRoot, + ): + | Promise + | ValidationResult + | boolean + | readonly ValidationResult[]; } -export class ServerValidator implements Validator { +export class ServerValidator implements Validator { message: string; constructor(message: string) { @@ -76,13 +70,13 @@ function setPropertyAbsolutePath(binderNodeName: string, result: ValidationResul return result; } -export async function runValidator( - model: AbstractModel, - validator: Validator, - interpolateMessageCallback?: InterpolateMessageCallback, -): Promise>> { +export async function runValidator( + model: M, + validator: Validator>, + interpolateMessageCallback?: InterpolateMessageCallback, +): Promise>>> { const binderNode = getBinderNode(model); - const value = binderNode.value!; + const value = binderNode.value as Value; const interpolateMessage = (message: string) => { if (!interpolateMessageCallback) { @@ -97,33 +91,37 @@ export async function runValidator( if (!binderNode.required && !new Required().validate(value) && !(model instanceof NumberModel)) { return []; } - return (async () => validator.validate(value, binderNode.binder))() - .catch((error) => { - console.error(`${binderNode.name} - Validator ${validator.constructor.name} threw an error:`, error); - return [{ message: 'Validator threw an error', property: binderNode.name, validator, value }]; - }) - .then((result) => { - if (result === false) { - return [{ message: interpolateMessage(validator.message), property: binderNode.name, validator, value }]; - } - if (result === true || (Array.isArray(result) && result.length === 0)) { - return []; - } - if (Array.isArray(result)) { - return result.map((result2) => ({ - message: interpolateMessage(validator.message), - ...setPropertyAbsolutePath(binderNode.name, result2), - validator, - value, - })); - } - return [ - { - message: interpolateMessage(validator.message), - ...setPropertyAbsolutePath(binderNode.name, result as ValidationResult), - validator, - value, - }, - ]; - }); + + try { + const result = await validator.validate(value, binderNode.binder); + + if (result === false) { + return [{ message: interpolateMessage(validator.message), property: binderNode.name, validator, value }]; + } + + if (result === true || (Array.isArray(result) && result.length === 0)) { + return []; + } + + if (Array.isArray(result)) { + return result.map((result2) => ({ + message: interpolateMessage(validator.message), + ...setPropertyAbsolutePath(binderNode.name, result2), + validator, + value, + })); + } + + return [ + { + message: interpolateMessage(validator.message), + ...setPropertyAbsolutePath(binderNode.name, result as ValidationResult), + validator, + value, + }, + ]; + } catch (error: unknown) { + console.error(`${binderNode.name} - Validator ${validator.constructor.name} threw an error:`, error); + return [{ message: 'Validator threw an error', property: binderNode.name, validator, value }]; + } } diff --git a/packages/ts/form/src/Validity.ts b/packages/ts/form/src/Validity.ts index c209f2c4a2..f0e4e64d3f 100644 --- a/packages/ts/form/src/Validity.ts +++ b/packages/ts/form/src/Validity.ts @@ -17,6 +17,5 @@ export const defaultValidity: ValidityState = { tooShort: false, typeMismatch: false, valueMissing: false, - // eslint-disable-next-line sort-keys valid: true, }; diff --git a/packages/ts/form/src/index.ts b/packages/ts/form/src/index.ts index d6015183dd..5fa3e9687f 100644 --- a/packages/ts/form/src/index.ts +++ b/packages/ts/form/src/index.ts @@ -2,6 +2,7 @@ import type { VaadinWindow } from './types.js'; export * from './Binder.js'; export * from './BinderRoot.js'; +export * from './BinderNode.js'; export * from './Field.js'; export * from './Models.js'; export * from './Validation.js'; @@ -16,5 +17,5 @@ $wnd.Vaadin ??= {}; $wnd.Vaadin.registrations ??= []; $wnd.Vaadin.registrations.push({ is: '@hilla/form', - version: /* updated-by-script */ '2.3.0-alpha5', + version: __VERSION__, }); diff --git a/packages/ts/form/test/Binder.test.ts b/packages/ts/form/test/Binder.test.ts index 014df7b693..f3b1215eea 100644 --- a/packages/ts/form/test/Binder.test.ts +++ b/packages/ts/form/test/Binder.test.ts @@ -67,7 +67,7 @@ describe('@hilla/form', () => { }); describe('name value', () => { - let binder: Binder; + let binder: Binder; const expectedEmptyOrder: Order = { idString: '', @@ -237,8 +237,8 @@ describe('@hilla/form', () => { }); it('should be able to set null to object type property', () => { - const myBinder = new Binder(document.createElement('div'), TestModel); - myBinder.for(myBinder.model.fieldAny).value = null; + const myBinder = new Binder(document.createElement('div'), TestModel); + myBinder.for(myBinder.model.fieldAny).value = undefined; myBinder .for(myBinder.model.fieldAny) .validate() @@ -249,7 +249,7 @@ describe('@hilla/form', () => { }); it('should be able to set undefined to object type property', () => { - const myBinder = new Binder(document.createElement('div'), TestModel); + const myBinder = new Binder(document.createElement('div'), TestModel); myBinder.for(myBinder.model.fieldAny).value = undefined; myBinder .for(myBinder.model.fieldAny) @@ -262,7 +262,7 @@ describe('@hilla/form', () => { }); describe('optional', () => { - let binder: Binder; + let binder: Binder; const litEmployeeView = document.createElement('lit-employee-view') as LitEmployeeView; const expectedEmptyEmployee: Employee = { diff --git a/packages/ts/form/test/Field.test.ts b/packages/ts/form/test/Field.test.ts index 44f2ecc4ab..d61b73af53 100644 --- a/packages/ts/form/test/Field.test.ts +++ b/packages/ts/form/test/Field.test.ts @@ -9,20 +9,21 @@ import sinonChai from 'sinon-chai'; import type { BinderNode } from '../src/BinderNode.js'; // API to test import { + AbstractFieldStrategy, + type AbstractModel, Binder, - field, CheckedFieldStrategy, + ComboBoxFieldStrategy, + field, + type FieldElement, + type FieldStrategy, GenericFieldStrategy, + MultiSelectComboBoxFieldStrategy, + Required, SelectedFieldStrategy, VaadinFieldStrategy, - Required, - type AbstractModel, - type FieldStrategy, - AbstractFieldStrategy, - ComboBoxFieldStrategy, - MultiSelectComboBoxFieldStrategy, } from '../src/index.js'; -import { OrderModel, TestModel, type TestEntity, type Order } from './TestModels.js'; +import { OrderModel, TestModel } from './TestModels.js'; use(sinonChai); use(chaiDom); @@ -254,7 +255,7 @@ describe('@hilla/form', () => { describe('number model', () => { let view: OrderViewWithTextField; let priorityField: MockTextFieldElement; - let binder: Binder; + let binder: Binder; beforeEach(async () => { view = orderViewWithTextField; @@ -406,7 +407,7 @@ describe('@hilla/form', () => { describe('number model', () => { let view: OrderViewWithInput; let priorityField: MockInputElement; - let binder: Binder; + let binder: Binder; beforeEach(async () => { view = orderViewWithInput; @@ -475,17 +476,12 @@ describe('@hilla/form', () => { describe('field/Strategy', () => { const div = document.createElement('div'); - let currentStrategy: FieldStrategy; - const binder = new (class StrategySpyBinder> extends Binder { - override getFieldStrategy(elm: any, model?: AbstractModel): FieldStrategy { - currentStrategy = super.getFieldStrategy(elm, model); - return currentStrategy; - } - })(div, TestModel); + const binder = new Binder(div, TestModel); + const getFieldStrategySpy = sinon.spy(binder, 'getFieldStrategy'); - async function resetBinderNodeValidation(binderNode: BinderNode>) { - binderNode.validators = []; - await binderNode.validate(); + async function resetBinderNodeValidation(node: BinderNode) { + node.validators = []; + await node.validate(); } @customElement('any-vaadin-element-tag') @@ -499,6 +495,7 @@ describe('@hilla/form', () => { } beforeEach(() => { + getFieldStrategySpy.resetHistory(); render(nothing, div); }); @@ -524,6 +521,8 @@ describe('@hilla/form', () => { renderElement(); + const currentStrategy: FieldStrategy = getFieldStrategySpy.lastCall.returnValue; + expect(currentStrategy instanceof GenericFieldStrategy).to.be.true; expect(currentStrategy.value).to.be.equal('foo'); expect(currentStrategy.model).to.be.equal(model); @@ -573,6 +572,8 @@ describe('@hilla/form', () => { element = renderElement(); + const currentStrategy: FieldStrategy = getFieldStrategySpy.lastCall.returnValue; + expect(currentStrategy instanceof CheckedFieldStrategy).to.be.true; expect(currentStrategy.value).to.be.true; expect(currentStrategy.model).to.be.equal(model); @@ -601,6 +602,8 @@ describe('@hilla/form', () => { element = renderElement(); + const currentStrategy: FieldStrategy = getFieldStrategySpy.lastCall.returnValue; + expect(currentStrategy instanceof SelectedFieldStrategy).to.be.true; expect(currentStrategy.value).to.be.true; expect(currentStrategy.model).to.be.equal(model); @@ -645,6 +648,8 @@ describe('@hilla/form', () => { element = renderElement(); + const currentStrategy: FieldStrategy = getFieldStrategySpy.lastCall.returnValue; + expect(currentStrategy instanceof VaadinFieldStrategy).to.be.true; expect(currentStrategy.value).to.be.equal(value); expect(currentStrategy.model).to.be.equal(model); @@ -691,6 +696,8 @@ describe('@hilla/form', () => { binderNode.validators = [{ message: 'any-err-msg', validate: () => false }, new Required()]; element = renderElement(); + const currentStrategy: FieldStrategy = getFieldStrategySpy.lastCall.returnValue; + expect(currentStrategy.constructor).to.equal(ComboBoxFieldStrategy); expect(currentStrategy.value).to.be.equal(value); expect(currentStrategy.model).to.be.equal(model); @@ -738,6 +745,8 @@ describe('@hilla/form', () => { binderNode.validators = [{ message: 'any-err-msg', validate: () => false }, new Required()]; element = renderElement(); + const currentStrategy: FieldStrategy = getFieldStrategySpy.lastCall.returnValue; + expect(currentStrategy.constructor).to.equal(ComboBoxFieldStrategy); expect(currentStrategy.value).to.be.equal(value); expect(currentStrategy.model).to.be.equal(model); @@ -784,6 +793,8 @@ describe('@hilla/form', () => { binderNode.validators = [{ message: 'any-err-msg', validate: () => false }, new Required()]; element = renderElement(); + const currentStrategy: FieldStrategy = getFieldStrategySpy.lastCall.returnValue; + expect(currentStrategy.constructor).to.equal(MultiSelectComboBoxFieldStrategy); expect(currentStrategy.value).to.be.equal(value); expect(currentStrategy.model).to.be.equal(model); @@ -806,68 +817,155 @@ describe('@hilla/form', () => { }); }); - it(`Dynamic strategy`, async () => { - const stringValue = 'a-string-value'; - let model = binder.model.fieldString as AbstractModel; - let binderNode = binder.for(model); - binderNode.value = stringValue; - await resetBinderNodeValidation(binderNode); - - let element; - const renderElement = (tag: string, renderModel: AbstractModel) => { + describe('Dynamic strategy', () => { + function renderElement(tag: string, renderModel: AbstractModel): T { const tagName = unsafeStatic(tag); + render( html` <${tagName} ${field(renderModel)}>`, div, ); - return div.firstElementChild as HTMLInputElement & { - value?: any; + + return div.firstElementChild as T; + } + + const stringValue = 'a-string-value'; + let model: AbstractModel; + let binderNode: BinderNode; + + beforeEach(async () => { + model = binder.model.fieldString; + binderNode = binder.for(model); + binderNode.value = stringValue; + await resetBinderNodeValidation(binderNode); + }); + + it('should work for an input element', () => { + let element = renderElement('some-text-field', model); + + let currentStrategy: FieldStrategy = getFieldStrategySpy.lastCall.returnValue; + + expect(element.localName).to.equal('some-text-field'); + const textFieldElement = element; + expect(currentStrategy).to.be.instanceof(GenericFieldStrategy); + const textFieldStrategy = currentStrategy; + expect((currentStrategy as AbstractFieldStrategy).element).to.equal(element); + expect(element.value).to.equal(stringValue); + + element = renderElement('some-text-field', model); + currentStrategy = getFieldStrategySpy.lastCall.returnValue; + + expect(element).to.equal(textFieldElement); + expect(currentStrategy).to.equal(textFieldStrategy); + expect(element.value).to.equal(stringValue); + + element = renderElement('some-password-field', model); + currentStrategy = getFieldStrategySpy.lastCall.returnValue; + + expect(element.localName).to.equal('some-password-field'); + expect(currentStrategy).to.be.instanceof(GenericFieldStrategy); + expect(currentStrategy).to.not.equal(textFieldStrategy); + expect((currentStrategy as AbstractFieldStrategy).element).to.equal(element); + expect(element.value).to.equal(stringValue); + }); + + it('should work for ComboBox element', async () => { + type ComboBoxFieldElement = FieldElement & { + value: string; + selectedItem: T | null; }; - }; - element = renderElement('some-text-field', model); - - expect(element.localName).to.equal('some-text-field'); - const textFieldElement = element; - expect(currentStrategy).to.be.instanceof(GenericFieldStrategy); - const textFieldStrategy = currentStrategy; - expect((currentStrategy as AbstractFieldStrategy).element).to.equal(element); - expect(element.value).to.equal(stringValue); - - element = renderElement('some-text-field', model); - - expect(element).to.equal(textFieldElement); - expect(currentStrategy).to.equal(textFieldStrategy); - expect(element.value).to.equal(stringValue); - - element = renderElement('some-password-field', model); - expect(element.localName).to.equal('some-password-field'); - expect(currentStrategy).to.be.instanceof(GenericFieldStrategy); - expect(currentStrategy).to.not.equal(textFieldStrategy); - expect((currentStrategy as AbstractFieldStrategy).element).to.equal(element); - expect(element.value).to.equal(stringValue); - - element = renderElement('vaadin-combo-box', model); - expect(currentStrategy).to.be.instanceof(ComboBoxFieldStrategy); - const comboBoxFieldStrategy = currentStrategy; - expect(element.value).to.equal(stringValue); - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect((element as any).selectedItem).to.be.undefined; - - model = binder.model.fieldObject; - binderNode = binder.for(model); - binderNode.value = { label: 'Object string item', value: 'obj-string-value' }; - await resetBinderNodeValidation(binderNode); - - element = renderElement('vaadin-combo-box', model); - expect(currentStrategy).to.be.instanceof(ComboBoxFieldStrategy); - expect(currentStrategy).to.not.equal(comboBoxFieldStrategy); - expect(element.value).to.equal(stringValue); - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - expect((element as any).selectedItem).to.equal(binderNode.value); + const stringElement = renderElement>('vaadin-combo-box', model); + let currentStrategy = getFieldStrategySpy.lastCall.returnValue; + + expect(currentStrategy).to.be.instanceof(ComboBoxFieldStrategy); + const comboBoxFieldStrategy = currentStrategy; + expect(stringElement.value).to.equal(stringValue); + expect(stringElement.selectedItem).to.be.undefined; + + type ValueObject = { label: string; value: string }; + + model = binder.model.fieldObject; + binderNode = binder.for(model); + binderNode.value = { label: 'Object string item', value: 'obj-string-value' }; + await resetBinderNodeValidation(binderNode); + + const objectElement = renderElement>('vaadin-combo-box', model); + currentStrategy = getFieldStrategySpy.lastCall.returnValue; + expect(currentStrategy).to.be.instanceof(ComboBoxFieldStrategy); + expect(currentStrategy).to.not.equal(comboBoxFieldStrategy); + expect(objectElement.value).to.equal(stringValue); + expect(objectElement.selectedItem).to.equal(binderNode.value); + }); }); + // it(`Dynamic strategy`, async () => { + // const stringValue = 'a-string-value'; + // let model = binder.model.fieldString; + // let binderNode = binder.for(model); + // binderNode.value = stringValue; + // await resetBinderNodeValidation(binderNode); + // + // const renderElement = (tag: string, renderModel: AbstractModel) => { + // const tagName = unsafeStatic(tag); + // + // render( + // html` + // <${tagName} ${field(renderModel)}>`, + // div, + // ); + // + // return div.firstElementChild as T; + // }; + // + // let element = renderElement('some-text-field', model); + // + // let currentStrategy: FieldStrategy = getFieldStrategySpy.lastCall.returnValue; + // + // expect(element.localName).to.equal('some-text-field'); + // const textFieldElement = element; + // expect(currentStrategy).to.be.instanceof(GenericFieldStrategy); + // const textFieldStrategy = currentStrategy; + // expect((currentStrategy as AbstractFieldStrategy).element).to.equal(element); + // expect(element.value).to.equal(stringValue); + // + // element = renderElement('some-text-field', model); + // currentStrategy = getFieldStrategySpy.lastCall.returnValue; + // + // expect(element).to.equal(textFieldElement); + // expect(currentStrategy).to.equal(textFieldStrategy); + // expect(element.value).to.equal(stringValue); + // + // element = renderElement('some-password-field', model); + // currentStrategy = getFieldStrategySpy.lastCall.returnValue; + // + // expect(element.localName).to.equal('some-password-field'); + // expect(currentStrategy).to.be.instanceof(GenericFieldStrategy); + // expect(currentStrategy).to.not.equal(textFieldStrategy); + // expect((currentStrategy as AbstractFieldStrategy).element).to.equal(element); + // expect(element.value).to.equal(stringValue); + // + // element = renderElement('vaadin-combo-box', model); + // currentStrategy = getFieldStrategySpy.lastCall.returnValue; + // + // expect(currentStrategy).to.be.instanceof(ComboBoxFieldStrategy); + // const comboBoxFieldStrategy = currentStrategy; + // expect(element.value).to.equal(stringValue); + // expect(element.selectedItem).to.be.undefined; + // + // model = binder.model.fieldObject; + // binderNode = binder.for(model); + // binderNode.value = { label: 'Object string item', value: 'obj-string-value' }; + // await resetBinderNodeValidation(binderNode); + // + // const comboBoxElement = renderElement('vaadin-combo-box', model); + // expect(currentStrategy).to.be.instanceof(ComboBoxFieldStrategy); + // expect(currentStrategy).to.not.equal(comboBoxFieldStrategy); + // expect(element.value).to.equal(stringValue); + // expect(element.selectedItem).to.equal(binderNode.value); + // }); + it(`Strategy can be overridden in binder`, async () => { const element = document.createElement('div'); @@ -877,21 +975,25 @@ describe('@hilla/form', () => { required = true; } - class MyBinder extends Binder { + class MyBinder extends Binder { constructor(elm: Element) { super(elm, TestModel); } override getFieldStrategy(elm: any, model: AbstractModel): FieldStrategy { - currentStrategy = new MyStrategy(elm, model); - return currentStrategy; + return new MyStrategy(elm, model); } } const myBinder = new MyBinder(element); + const myBinderGetFieldStrategySpy = sinon.spy(myBinder, 'getFieldStrategy'); + const { model } = myBinder; render(html`
`, element); + + const currentStrategy: FieldStrategy = myBinderGetFieldStrategySpy.lastCall.returnValue; + expect(currentStrategy instanceof MyStrategy).to.be.true; expect(currentStrategy.model).to.be.equal(model); }); diff --git a/packages/ts/form/test/Model.test.ts b/packages/ts/form/test/Model.test.ts index 74df3f9e2a..2d5d292f31 100644 --- a/packages/ts/form/test/Model.test.ts +++ b/packages/ts/form/test/Model.test.ts @@ -21,14 +21,13 @@ import { IdEntityModel, RecordStatus, RecordStatusModel, - WithPossibleCharListModel, - type TestEntity, TestModel, + WithPossibleCharListModel, } from './TestModels.js'; describe('@hilla/form', () => { describe('Model', () => { - let binder: Binder; + let binder: Binder; beforeEach(() => { binder = new Binder(document.createElement('div'), TestModel); @@ -280,7 +279,7 @@ describe('@hilla/form', () => { const nodes1 = [...binder.model.fieldArrayModel].slice(); [0, 1].forEach((i) => expect(nodes1[i].value).to.be.equal(idEntities[i])); - binder.for(binder.model.fieldArrayModel).value = idEntities; + binder.for(binder.model.fieldArrayModel).value = idEntities.slice(); const nodes2 = [...binder.model.fieldArrayModel].slice(); [0, 1].forEach((i) => { expect(nodes1[i]).to.be.equal(nodes2[i]); @@ -365,8 +364,8 @@ describe('@hilla/form', () => { expect(binder.model.fieldEnum.valueOf()).to.equal(RecordStatus.REMOVED); }); - it('should fail if the EnumModel.createEmptyValue() is used', () => { - expect(() => EnumModel.createEmptyValue()).to.throw('Cannot create an instance of an abstract class'); + it('should be undefined if the EnumModel.createEmptyValue() is used', () => { + expect(EnumModel.createEmptyValue()).to.be.undefined; }); it('should extract value from string', () => { diff --git a/packages/ts/form/test/TestModels.ts b/packages/ts/form/test/TestModels.ts index 689c8f2f2c..15785c2020 100644 --- a/packages/ts/form/test/TestModels.ts +++ b/packages/ts/form/test/TestModels.ts @@ -1,4 +1,4 @@ -/* eslint-disable no-use-before-define, @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-unnecessary-type-assertion */ +/* eslint-disable @typescript-eslint/no-use-before-define, @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-unnecessary-type-assertion, @typescript-eslint/no-shadow */ // API to test import { _enum, @@ -6,7 +6,8 @@ import { ArrayModel, BooleanModel, EnumModel, - type ModelConstructor, + makeEnumEmptyValueCreator, + makeObjectEmptyValueCreator, NotBlank, NumberModel, ObjectModel, @@ -21,10 +22,10 @@ export interface IdEntity { idString: string; } export class IdEntityModel extends ObjectModel { - declare static createEmptyValue: () => IdEntity; + static override createEmptyValue = makeObjectEmptyValueCreator(IdEntityModel); get idString(): StringModel { - return this[_getPropertyModel]('idString', StringModel, [false]); + return this[_getPropertyModel]('idString', (parent, key) => new StringModel(parent, key, false)); } } @@ -34,18 +35,18 @@ export interface Product extends IdEntity { isInStock: boolean; } export class ProductModel extends IdEntityModel { - declare static createEmptyValue: () => Product; + static override createEmptyValue = makeObjectEmptyValueCreator(ProductModel); - get description() { - return this[_getPropertyModel]('description', StringModel, [false, new Required()]); + get description(): StringModel { + return this[_getPropertyModel]('description', (parent, key) => new StringModel(parent, key, false, new Required())); } - get price() { - return this[_getPropertyModel]('price', NumberModel, [false, new Positive()]); + get price(): NumberModel { + return this[_getPropertyModel]('price', (parent, key) => new NumberModel(parent, key, false, new Positive())); } - get isInStock() { - return this[_getPropertyModel]('isInStock', BooleanModel, [false]); + get isInStock(): BooleanModel { + return this[_getPropertyModel]('isInStock', (parent, key) => new BooleanModel(parent, key, false)); } } @@ -54,14 +55,20 @@ export interface Customer extends IdEntity { nickName: string; } export class CustomerModel extends IdEntityModel { - declare static createEmptyValue: () => Customer; + static override createEmptyValue = makeObjectEmptyValueCreator(CustomerModel); - get fullName() { - return this[_getPropertyModel]('fullName', StringModel, [false, new Size({ min: 4 }), new Required()]); + get fullName(): StringModel { + return this[_getPropertyModel]( + 'fullName', + (parent, key) => new StringModel(parent, key, false, new Size({ min: 4 }), new Required()), + ); } - get nickName() { - return this[_getPropertyModel]('nickName', StringModel, [false, new Pattern('....*')]); + get nickName(): StringModel { + return this[_getPropertyModel]( + 'nickName', + (parent, key) => new StringModel(parent, key, false, new Pattern('....*')), + ); } } @@ -73,30 +80,29 @@ export interface Order extends IdEntity { total?: number; } export class OrderModel extends IdEntityModel { - declare static createEmptyValue: () => Order; + static override createEmptyValue = makeObjectEmptyValueCreator(OrderModel); get customer(): CustomerModel { - return this[_getPropertyModel]('customer', CustomerModel, [false, new Required()]); + return this[_getPropertyModel]('customer', (parent, key) => new CustomerModel(parent, key, false, new Required())); } get notes(): StringModel { - return this[_getPropertyModel]('notes', StringModel, [false, new Required()]); + return this[_getPropertyModel]('notes', (parent, key) => new StringModel(parent, key, false, new Required())); } get priority(): NumberModel { - return this[_getPropertyModel]('priority', NumberModel, [false]); + return this[_getPropertyModel]('priority', (parent, key) => new NumberModel(parent, key, false)); } - get products(): ArrayModel { + get products(): ArrayModel { return this[_getPropertyModel]( 'products', - ArrayModel as ModelConstructor>, - [false, ProductModel, [false]], + (parent, key) => new ArrayModel(parent, key, false, (parent, key) => new ProductModel(parent, key, false)), ); } get total(): NumberModel { - return this[_getPropertyModel]('total', NumberModel, [true]); + return this[_getPropertyModel]('total', (parent, key) => new NumberModel(parent, key, true)); } } @@ -105,60 +111,66 @@ export interface TestEntity { fieldNumber: number; fieldBoolean: boolean; fieldObject: Record; - fieldArrayString: string[]; - fieldArrayModel: IdEntity[]; - fieldMatrixNumber: number[][]; + fieldArrayString: readonly string[]; + fieldArrayModel: readonly IdEntity[]; + fieldMatrixNumber: ReadonlyArray; fieldEnum: RecordStatus; fieldAny: any; } + export class TestModel extends ObjectModel { - declare static createEmptyValue: () => TestEntity; + static override createEmptyValue = makeObjectEmptyValueCreator(TestModel); - get fieldString() { - return this[_getPropertyModel]('fieldString', StringModel, [false]); + get fieldString(): StringModel { + return this[_getPropertyModel]('fieldString', (parent, key) => new StringModel(parent, key, false)); } - get fieldNumber() { - return this[_getPropertyModel]('fieldNumber', NumberModel, [false]); + get fieldNumber(): NumberModel { + return this[_getPropertyModel]('fieldNumber', (parent, key) => new NumberModel(parent, key, false)); } - get fieldBoolean() { - return this[_getPropertyModel]('fieldBoolean', BooleanModel, [false]); + get fieldBoolean(): BooleanModel { + return this[_getPropertyModel]('fieldBoolean', (parent, key) => new BooleanModel(parent, key, false)); } get fieldObject(): ObjectModel> { - return this[_getPropertyModel]('fieldObject', ObjectModel, [false]) as ObjectModel>; + return this[_getPropertyModel]('fieldObject', (parent, key) => new ObjectModel(parent, key, false)); } - get fieldArrayString() { - return this[_getPropertyModel]('fieldArrayString', ArrayModel, [false, StringModel, [false]]) as ArrayModel< - string, - StringModel - >; + get fieldArrayString(): ArrayModel { + return this[_getPropertyModel]( + 'fieldArrayString', + (parent, key) => new ArrayModel(parent, key, false, (parent, key) => new StringModel(parent, key, false)), + ); } - get fieldArrayModel() { - return this[_getPropertyModel]('fieldArrayModel', ArrayModel, [false, IdEntityModel, [false]]) as ArrayModel< - IdEntity, - IdEntityModel - >; + get fieldArrayModel(): ArrayModel { + return this[_getPropertyModel]( + 'fieldArrayModel', + (parent, key) => new ArrayModel(parent, key, false, (parent, key) => new IdEntityModel(parent, key, false)), + ); } - get fieldMatrixNumber() { - return this[_getPropertyModel]('fieldMatrixNumber', ArrayModel, [ - false, - ArrayModel, - [false, NumberModel, [false, new Positive()]], - ]) as ArrayModel>; + get fieldMatrixNumber(): ArrayModel> { + return this[_getPropertyModel]( + 'fieldMatrixNumber', + (parent, key) => + new ArrayModel( + parent, + key, + false, + (parent, key) => + new ArrayModel(parent, key, false, (parent, key) => new NumberModel(parent, key, false, new Positive())), + ), + ); } - get fieldEnum() { - // eslint-disable-next-line @typescript-eslint/no-use-before-define - return this[_getPropertyModel]('fieldEnum', RecordStatusModel, [false]); + get fieldEnum(): RecordStatusModel { + return this[_getPropertyModel]('fieldEnum', (parent, key) => new RecordStatusModel(parent, key, false)); } - get fieldAny() { - return this[_getPropertyModel]('fieldAny', ObjectModel, [false]) as ObjectModel; + get fieldAny(): ObjectModel { + return this[_getPropertyModel]('fieldAny', (parent, key) => new ObjectModel(parent, key, false)); } } @@ -168,18 +180,21 @@ export interface Employee extends IdEntity { colleagues?: Employee[]; } export class EmployeeModel extends IdEntityModel { - declare static createEmptyValue: () => Employee; + static override createEmptyValue = makeObjectEmptyValueCreator(EmployeeModel); - get fullName() { - return this[_getPropertyModel]('fullName', StringModel, [false]); + get fullName(): StringModel { + return this[_getPropertyModel]('fullName', (parent, key) => new StringModel(parent, key, false)); } get supervisor(): EmployeeModel { - return this[_getPropertyModel]('supervisor', EmployeeModel, [true]); + return this[_getPropertyModel]('supervisor', (parent, key) => new EmployeeModel(parent, key, true)); } - get colleagues() { - return this[_getPropertyModel]('colleagues', ArrayModel, [true, EmployeeModel, [false]]); + get colleagues(): ArrayModel { + return this[_getPropertyModel]( + 'colleagues', + (parent, key) => new ArrayModel(parent, key, true, (parent, key) => new EmployeeModel(parent, key, false)), + ); } } @@ -190,14 +205,20 @@ export interface TestMessageInterpolationEntity { export class TestMessageInterpolationModel< T extends TestMessageInterpolationEntity = TestMessageInterpolationEntity, > extends ObjectModel { - declare static createEmptyValue: () => TestMessageInterpolationEntity; + static override createEmptyValue = makeObjectEmptyValueCreator(TestMessageInterpolationModel); - get stringMinSize() { - return this[_getPropertyModel]('stringMinSize', StringModel, [false, new Size({ min: 4 }), new Required()]); + get stringMinSize(): StringModel { + return this[_getPropertyModel]( + 'stringMinSize', + (parent, key) => new StringModel(parent, key, false, new Size({ min: 4 }), new Required()), + ); } - get stringNotBlank() { - return this[_getPropertyModel]('stringNotBlank', StringModel, [false, new NotBlank(), new Required()]); + get stringNotBlank(): StringModel { + return this[_getPropertyModel]( + 'stringNotBlank', + (parent, key) => new StringModel(parent, key, false, new NotBlank(), new Required()), + ); } } @@ -208,6 +229,8 @@ export enum RecordStatus { } export class RecordStatusModel extends EnumModel { + static override createEmptyValue = makeEnumEmptyValueCreator(RecordStatusModel); + readonly [_enum] = RecordStatus; } @@ -216,9 +239,9 @@ export interface WithPossibleCharList { } export class WithPossibleCharListModel extends ObjectModel { - declare static createEmptyValue: () => WithPossibleCharList; + static override createEmptyValue = makeObjectEmptyValueCreator(WithPossibleCharListModel); - get charList() { - return this[_getPropertyModel]('charList', StringModel, [true]); + get charList(): StringModel { + return this[_getPropertyModel]('charList', (parent, key) => new StringModel(parent, key, true)); } } diff --git a/packages/ts/form/test/Validation.test.ts b/packages/ts/form/test/Validation.test.ts index a0777c26c7..565e852047 100644 --- a/packages/ts/form/test/Validation.test.ts +++ b/packages/ts/form/test/Validation.test.ts @@ -22,14 +22,12 @@ import { } from '../src/index.js'; import { type Customer, - type IdEntity, IdEntityModel, type Order, OrderModel, type TestEntity, - TestModel, - type TestMessageInterpolationEntity, TestMessageInterpolationModel, + TestModel, } from './TestModels.js'; use(sinonChai); @@ -140,7 +138,7 @@ const fireEvent = async (elm: Element, name: string) => { describe('@hilla/form', () => { describe('Validation', () => { - let binder: Binder; + let binder: Binder; const view = document.createElement('div'); beforeEach(async () => { @@ -156,36 +154,36 @@ describe('@hilla/form', () => { expect(errors.map((e) => e.validator.constructor.name).sort()).to.eql(['Required', 'Size']); })); - it('should run all nested validations per model', async () => - binder.validate().then((errors) => { - expect(errors.map((e) => e.property)).to.eql(['customer.fullName', 'customer.fullName', 'notes']); - })); + it('should run all nested validations per model', async () => { + const errors = await binder.validate(); + expect(errors.map((e) => e.property)).to.eql(['customer.fullName', 'customer.fullName', 'notes']); + }); it('should run all validations per array items', async () => { binder.for(binder.model.products).appendItem(); binder.for(binder.model.products).appendItem(); - return binder.validate().then((errors) => { - expect(errors.map((e) => e.property)).to.eql([ - 'customer.fullName', - 'customer.fullName', - 'notes', - 'products.0.description', - 'products.0.price', - 'products.1.description', - 'products.1.price', - ]); - }); + + const errors = await binder.validate(); + + expect(errors.map((e) => e.property)).to.eql([ + 'customer.fullName', + 'customer.fullName', + 'notes', + 'products.0.description', + 'products.0.price', + 'products.1.description', + 'products.1.price', + ]); }); describe('clearing', () => { - ['reset', 'clear'].forEach((methodName) => { + (['reset', 'clear'] as const).forEach((methodName) => { it(`should reset validation on ${methodName}`, async () => { - await binder.validate(); + const errors = await binder.validate(); expect(binder.invalid).to.be.true; expect(binder.for(binder.model.customer.fullName).invalid).to.be.true; - // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access - (binder as any)[methodName](); + binder[methodName](); expect(binder.invalid).to.be.false; expect(binder.for(binder.model.customer.fullName).invalid).to.be.false; @@ -375,7 +373,7 @@ describe('@hilla/form', () => { }); describe('model add validator', () => { - let idBinder: Binder; + let idBinder: Binder; beforeEach(async () => { idBinder = new Binder(view, IdEntityModel); @@ -483,7 +481,7 @@ describe('@hilla/form', () => { }); describe('model add validator (multiple fields)', () => { - let testBinder: Binder; + let testBinder: Binder; beforeEach(async () => { testBinder = new Binder(view, TestModel); @@ -790,7 +788,7 @@ describe('@hilla/form', () => { }); describe('message interpolation', () => { - let testMessageBinder: Binder; + let testMessageBinder: Binder; beforeEach(async () => { testMessageBinder = new Binder(view, TestMessageInterpolationModel); diff --git a/packages/ts/generator-typescript-plugin-model/src/EntityModelProcessor.ts b/packages/ts/generator-typescript-plugin-model/src/EntityModelProcessor.ts index 86f968883b..e0ece30771 100644 --- a/packages/ts/generator-typescript-plugin-model/src/EntityModelProcessor.ts +++ b/packages/ts/generator-typescript-plugin-model/src/EntityModelProcessor.ts @@ -28,7 +28,7 @@ import ts, { type Statement, } from 'typescript'; import { ModelSchemaExpressionProcessor, ModelSchemaTypeProcessor } from './ModelSchemaProcessor.js'; -import { importBuiltInFormModel, type Context } from './utils.js'; +import { importBuiltInFormModel, type Context, createModelBuildingCallback, createEmptyValueMaker } from './utils.js'; export type DependencyData = Readonly<{ id: Identifier; @@ -104,6 +104,7 @@ export class EntityClassModelProcessor extends EntityModelProcessor { readonly #context: Context; readonly #fullyQualifiedName: string; readonly #getPropertyModelSymbol: Identifier; + readonly #makeObjectEmptyValueCreator: Identifier; constructor(name: string, component: Schema, context: Context) { super(name, true); @@ -113,6 +114,10 @@ export class EntityClassModelProcessor extends EntityModelProcessor { this.#fullyQualifiedName = name; this.#getPropertyModelSymbol = this[$dependencies].imports.named.add('@hilla/form', '_getPropertyModel'); + this.#makeObjectEmptyValueCreator = this[$dependencies].imports.named.add( + '@hilla/form', + 'makeObjectEmptyValueCreator', + ); } protected [$processDeclaration](): ClassDeclaration | undefined { @@ -162,17 +167,10 @@ export class EntityClassModelProcessor extends EntityModelProcessor { ts.factory.createBlock( [ ts.factory.createReturnStatement( - ts.factory.createAsExpression( - ts.factory.createCallExpression( - ts.factory.createElementAccessExpression(ts.factory.createThis(), this.#getPropertyModelSymbol), - undefined, - [ - ts.factory.createStringLiteral(name), - type.typeName as Identifier, - ts.factory.createArrayLiteralExpression(args), - ], - ), - type, + ts.factory.createCallExpression( + ts.factory.createElementAccessExpression(ts.factory.createThis(), this.#getPropertyModelSymbol), + undefined, + [ts.factory.createStringLiteral(name), createModelBuildingCallback(type.typeName as Identifier, args)], ), ), ], @@ -202,14 +200,6 @@ export class EntityClassModelProcessor extends EntityModelProcessor { ts.factory.createTypeReferenceNode(entity), ); - const emptyValueElement = ts.factory.createPropertyDeclaration( - [ts.factory.createModifier(ts.SyntaxKind.DeclareKeyword), ts.factory.createModifier(ts.SyntaxKind.StaticKeyword)], - 'createEmptyValue', - undefined, - ts.factory.createFunctionTypeNode(undefined, [], ts.factory.createTypeReferenceNode(entity)), - undefined, - ); - return ts.factory.createClassDeclaration( undefined, this[$model].id, @@ -219,7 +209,10 @@ export class EntityClassModelProcessor extends EntityModelProcessor { ts.factory.createExpressionWithTypeArguments(parent, [ts.factory.createTypeReferenceNode(typeT)]), ]), ], - [emptyValueElement, ...this.#processClassElements(schema)], + [ + createEmptyValueMaker(this.#makeObjectEmptyValueCreator, this[$model].id), + ...this.#processClassElements(schema), + ], ); } @@ -243,6 +236,7 @@ export class EntityEnumModelProcessor extends EntityModelProcessor { protected [$processDeclaration](): ClassDeclaration { const enumModel = importBuiltInFormModel('EnumModel', this[$dependencies]); const enumPropertySymbol = this[$dependencies].imports.named.add('@hilla/form', '_enum'); + const makeEnumEmptyValueCreator = this[$dependencies].imports.named.add('@hilla/form', 'makeEnumEmptyValueCreator'); return ts.factory.createClassDeclaration( undefined, @@ -256,6 +250,7 @@ export class EntityEnumModelProcessor extends EntityModelProcessor { ]), ], [ + createEmptyValueMaker(makeEnumEmptyValueCreator, this[$model].id), ts.factory.createPropertyDeclaration( [ts.factory.createModifier(ts.SyntaxKind.ReadonlyKeyword)], ts.factory.createComputedPropertyName(enumPropertySymbol), diff --git a/packages/ts/generator-typescript-plugin-model/src/ModelSchemaProcessor.ts b/packages/ts/generator-typescript-plugin-model/src/ModelSchemaProcessor.ts index 86279b2d88..90e43216b8 100644 --- a/packages/ts/generator-typescript-plugin-model/src/ModelSchemaProcessor.ts +++ b/packages/ts/generator-typescript-plugin-model/src/ModelSchemaProcessor.ts @@ -23,7 +23,7 @@ import { import type DependencyManager from '@hilla/generator-typescript-utils/dependencies/DependencyManager.js'; import ts, { type Expression, type Identifier, type TypeNode, type TypeReferenceNode } from 'typescript'; import { AnnotationParser, isValidationConstrainedSchema, type ValidationConstrainedSchema } from './annotation.js'; -import { importBuiltInFormModel } from './utils.js'; +import { createModelBuildingCallback, importBuiltInFormModel } from './utils.js'; const $dependencies = Symbol(); const $processArray = Symbol(); @@ -36,8 +36,6 @@ const $processUnknown = Symbol(); const $originalSchema = Symbol(); const $schema = Symbol(); -export type OptionalChecker = (schema: Schema) => boolean; - export abstract class ModelSchemaPartProcessor { protected readonly [$dependencies]: DependencyManager; protected readonly [$originalSchema]: Schema; @@ -178,7 +176,6 @@ export class ModelSchemaTypeProcessor extends ModelSchemaPartProcessor ts.factory.createParameterDeclaration(undefined, undefined, arg)), + undefined, + ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken), + ts.factory.createNewExpression(name, undefined, [...defaults, ...args]), + ); +} + +export function createEmptyValueMaker(maker: Identifier, model: Identifier): PropertyDeclaration { + return ts.factory.createPropertyDeclaration( + [ts.factory.createModifier(ts.SyntaxKind.StaticKeyword), ts.factory.createModifier(ts.SyntaxKind.OverrideKeyword)], + 'createEmptyValue', + undefined, + undefined, + ts.factory.createCallExpression(maker, undefined, [model]), + ); +} diff --git a/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormArrayTypesModel.snap.ts b/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormArrayTypesModel.snap.ts index 37fa554dc1..a95199cdde 100644 --- a/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormArrayTypesModel.snap.ts +++ b/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormArrayTypesModel.snap.ts @@ -1,32 +1,30 @@ -import { _getPropertyModel as _getPropertyModel_1, ArrayModel as ArrayModel_1, NumberModel as NumberModel_1, ObjectModel as ObjectModel_1, StringModel as StringModel_1 } from "@hilla/form"; +import { _getPropertyModel as _getPropertyModel_1, ArrayModel as ArrayModel_1, makeObjectEmptyValueCreator as makeObjectEmptyValueCreator_1, NumberModel as NumberModel_1, ObjectModel as ObjectModel_1, StringModel as StringModel_1 } from "@hilla/form"; import type FormArrayTypes_1 from "./FormArrayTypes.js"; import FormArrayTypesModel_1 from "./FormArrayTypesModel.js"; -import type FormEntity_1 from "./FormEntity.js"; -import type FormEntityHierarchy_1 from "./FormEntityHierarchy.js"; import FormEntityHierarchyModel_1 from "./FormEntityHierarchyModel.js"; import FormEntityModel_1 from "./FormEntityModel.js"; class FormArrayTypesModel extends ObjectModel_1 { - declare static createEmptyValue: () => FormArrayTypes_1; - get stringList(): ArrayModel_1 { - return this[_getPropertyModel_1]("stringList", ArrayModel_1, [false, StringModel_1, [true]]) as ArrayModel_1; + static override createEmptyValue = makeObjectEmptyValueCreator_1(FormArrayTypesModel); + get stringList(): ArrayModel_1 { + return this[_getPropertyModel_1]("stringList", (parent, key) => new ArrayModel_1(parent, key, false, (parent, key) => new StringModel_1(parent, key, true))); } - get entityHierarchyList(): ArrayModel_1 { - return this[_getPropertyModel_1]("entityHierarchyList", ArrayModel_1, [false, FormEntityHierarchyModel_1, [true]]) as ArrayModel_1; + get entityHierarchyList(): ArrayModel_1 { + return this[_getPropertyModel_1]("entityHierarchyList", (parent, key) => new ArrayModel_1(parent, key, false, (parent, key) => new FormEntityHierarchyModel_1(parent, key, true))); } - get selfReferenceList(): ArrayModel_1 { - return this[_getPropertyModel_1]("selfReferenceList", ArrayModel_1, [false, FormArrayTypesModel_1, [true]]) as ArrayModel_1; + get selfReferenceList(): ArrayModel_1 { + return this[_getPropertyModel_1]("selfReferenceList", (parent, key) => new ArrayModel_1(parent, key, false, (parent, key) => new FormArrayTypesModel_1(parent, key, true))); } - get stringArray(): ArrayModel_1 { - return this[_getPropertyModel_1]("stringArray", ArrayModel_1, [false, StringModel_1, [true]]) as ArrayModel_1; + get stringArray(): ArrayModel_1 { + return this[_getPropertyModel_1]("stringArray", (parent, key) => new ArrayModel_1(parent, key, false, (parent, key) => new StringModel_1(parent, key, true))); } - get numberMatrix(): ArrayModel_1, ArrayModel_1> { - return this[_getPropertyModel_1]("numberMatrix", ArrayModel_1, [false, ArrayModel_1, [true, NumberModel_1, [true]]]) as ArrayModel_1, ArrayModel_1>; + get numberMatrix(): ArrayModel_1> { + return this[_getPropertyModel_1]("numberMatrix", (parent, key) => new ArrayModel_1(parent, key, false, (parent, key) => new ArrayModel_1(parent, key, true, (parent, key) => new NumberModel_1(parent, key, true)))); } - get entityMatrix(): ArrayModel_1, ArrayModel_1> { - return this[_getPropertyModel_1]("entityMatrix", ArrayModel_1, [false, ArrayModel_1, [true, FormEntityModel_1, [true]]]) as ArrayModel_1, ArrayModel_1>; + get entityMatrix(): ArrayModel_1> { + return this[_getPropertyModel_1]("entityMatrix", (parent, key) => new ArrayModel_1(parent, key, false, (parent, key) => new ArrayModel_1(parent, key, true, (parent, key) => new FormEntityModel_1(parent, key, true)))); } - get nestedArrays(): ArrayModel_1>>, ArrayModel_1>, ObjectModel_1>>>> { - return this[_getPropertyModel_1]("nestedArrays", ArrayModel_1, [false, ArrayModel_1, [true, ObjectModel_1, [true]]]) as ArrayModel_1>>, ArrayModel_1>, ObjectModel_1>>>>; + get nestedArrays(): ArrayModel_1>>>> { + return this[_getPropertyModel_1]("nestedArrays", (parent, key) => new ArrayModel_1(parent, key, false, (parent, key) => new ArrayModel_1(parent, key, true, (parent, key) => new ObjectModel_1(parent, key, true)))); } } export default FormArrayTypesModel; diff --git a/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormDataPrimitivesModel.snap.ts b/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormDataPrimitivesModel.snap.ts index d32dbbbf45..26929f6fc6 100644 --- a/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormDataPrimitivesModel.snap.ts +++ b/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormDataPrimitivesModel.snap.ts @@ -1,39 +1,39 @@ -import { _getPropertyModel as _getPropertyModel_1, BooleanModel as BooleanModel_1, NumberModel as NumberModel_1, ObjectModel as ObjectModel_1, StringModel as StringModel_1 } from "@hilla/form"; +import { _getPropertyModel as _getPropertyModel_1, BooleanModel as BooleanModel_1, makeObjectEmptyValueCreator as makeObjectEmptyValueCreator_1, NumberModel as NumberModel_1, ObjectModel as ObjectModel_1, StringModel as StringModel_1 } from "@hilla/form"; import type FormDataPrimitives_1 from "./FormDataPrimitives.js"; class FormDataPrimitivesModel extends ObjectModel_1 { - declare static createEmptyValue: () => FormDataPrimitives_1; + static override createEmptyValue = makeObjectEmptyValueCreator_1(FormDataPrimitivesModel); get stringProp(): StringModel_1 { - return this[_getPropertyModel_1]("stringProp", StringModel_1, [false]) as StringModel_1; + return this[_getPropertyModel_1]("stringProp", (parent, key) => new StringModel_1(parent, key, false)); } get longWrapperProp(): NumberModel_1 { - return this[_getPropertyModel_1]("longWrapperProp", NumberModel_1, [false]) as NumberModel_1; + return this[_getPropertyModel_1]("longWrapperProp", (parent, key) => new NumberModel_1(parent, key, false)); } get longProp(): NumberModel_1 { - return this[_getPropertyModel_1]("longProp", NumberModel_1, [false]) as NumberModel_1; + return this[_getPropertyModel_1]("longProp", (parent, key) => new NumberModel_1(parent, key, false)); } get integerWrapperProp(): NumberModel_1 { - return this[_getPropertyModel_1]("integerWrapperProp", NumberModel_1, [false]) as NumberModel_1; + return this[_getPropertyModel_1]("integerWrapperProp", (parent, key) => new NumberModel_1(parent, key, false)); } get integerProp(): NumberModel_1 { - return this[_getPropertyModel_1]("integerProp", NumberModel_1, [false]) as NumberModel_1; + return this[_getPropertyModel_1]("integerProp", (parent, key) => new NumberModel_1(parent, key, false)); } get doubleWrapperProp(): NumberModel_1 { - return this[_getPropertyModel_1]("doubleWrapperProp", NumberModel_1, [false]) as NumberModel_1; + return this[_getPropertyModel_1]("doubleWrapperProp", (parent, key) => new NumberModel_1(parent, key, false)); } get doubleProp(): NumberModel_1 { - return this[_getPropertyModel_1]("doubleProp", NumberModel_1, [false]) as NumberModel_1; + return this[_getPropertyModel_1]("doubleProp", (parent, key) => new NumberModel_1(parent, key, false)); } get floatWrapperProp(): NumberModel_1 { - return this[_getPropertyModel_1]("floatWrapperProp", NumberModel_1, [false]) as NumberModel_1; + return this[_getPropertyModel_1]("floatWrapperProp", (parent, key) => new NumberModel_1(parent, key, false)); } get floatProp(): NumberModel_1 { - return this[_getPropertyModel_1]("floatProp", NumberModel_1, [false]) as NumberModel_1; + return this[_getPropertyModel_1]("floatProp", (parent, key) => new NumberModel_1(parent, key, false)); } get booleanWrapperProp(): BooleanModel_1 { - return this[_getPropertyModel_1]("booleanWrapperProp", BooleanModel_1, [false]) as BooleanModel_1; + return this[_getPropertyModel_1]("booleanWrapperProp", (parent, key) => new BooleanModel_1(parent, key, false)); } get booleanProp(): BooleanModel_1 { - return this[_getPropertyModel_1]("booleanProp", BooleanModel_1, [false]) as BooleanModel_1; + return this[_getPropertyModel_1]("booleanProp", (parent, key) => new BooleanModel_1(parent, key, false)); } } export default FormDataPrimitivesModel; diff --git a/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormEntityHierarchyModel.snap.ts b/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormEntityHierarchyModel.snap.ts index c62169dd81..ce74c0e8a9 100644 --- a/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormEntityHierarchyModel.snap.ts +++ b/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormEntityHierarchyModel.snap.ts @@ -1,13 +1,13 @@ -import { _getPropertyModel as _getPropertyModel_1, NumberModel as NumberModel_1, StringModel as StringModel_1 } from "@hilla/form"; +import { _getPropertyModel as _getPropertyModel_1, makeObjectEmptyValueCreator as makeObjectEmptyValueCreator_1, NumberModel as NumberModel_1, StringModel as StringModel_1 } from "@hilla/form"; import type FormEntityHierarchy_1 from "./FormEntityHierarchy.js"; import FormEntityIdModel_1 from "./FormEntityIdModel.js"; class FormEntityHierarchyModel extends FormEntityIdModel_1 { - declare static createEmptyValue: () => FormEntityHierarchy_1; + static override createEmptyValue = makeObjectEmptyValueCreator_1(FormEntityHierarchyModel); get lorem(): StringModel_1 { - return this[_getPropertyModel_1]("lorem", StringModel_1, [false]) as StringModel_1; + return this[_getPropertyModel_1]("lorem", (parent, key) => new StringModel_1(parent, key, false)); } get ipsum(): NumberModel_1 { - return this[_getPropertyModel_1]("ipsum", NumberModel_1, [false]) as NumberModel_1; + return this[_getPropertyModel_1]("ipsum", (parent, key) => new NumberModel_1(parent, key, false)); } } export default FormEntityHierarchyModel; diff --git a/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormEntityIdModel.snap.ts b/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormEntityIdModel.snap.ts index 4a725a65cb..8830ee4b7c 100644 --- a/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormEntityIdModel.snap.ts +++ b/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormEntityIdModel.snap.ts @@ -1,9 +1,9 @@ -import { _getPropertyModel as _getPropertyModel_1, NotNull as NotNull_1, NumberModel as NumberModel_1, ObjectModel as ObjectModel_1 } from "@hilla/form"; +import { _getPropertyModel as _getPropertyModel_1, makeObjectEmptyValueCreator as makeObjectEmptyValueCreator_1, NotNull as NotNull_1, NumberModel as NumberModel_1, ObjectModel as ObjectModel_1 } from "@hilla/form"; import type FormEntityId_1 from "./FormEntityId.js"; class FormEntityIdModel extends ObjectModel_1 { - declare static createEmptyValue: () => FormEntityId_1; + static override createEmptyValue = makeObjectEmptyValueCreator_1(FormEntityIdModel); get Id(): NumberModel_1 { - return this[_getPropertyModel_1]("Id", NumberModel_1, [false, new NotNull_1()]) as NumberModel_1; + return this[_getPropertyModel_1]("Id", (parent, key) => new NumberModel_1(parent, key, false, new NotNull_1())); } } export default FormEntityIdModel; diff --git a/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormEntityModel.snap.ts b/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormEntityModel.snap.ts index db1c9ebb17..a65a21ea5a 100644 --- a/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormEntityModel.snap.ts +++ b/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormEntityModel.snap.ts @@ -1,4 +1,4 @@ -import { _getPropertyModel as _getPropertyModel_1, NumberModel as NumberModel_1, ObjectModel as ObjectModel_1 } from "@hilla/form"; +import { _getPropertyModel as _getPropertyModel_1, makeObjectEmptyValueCreator as makeObjectEmptyValueCreator_1, NumberModel as NumberModel_1, ObjectModel as ObjectModel_1 } from "@hilla/form"; import FormArrayTypesModel_1 from "./FormArrayTypesModel.js"; import FormDataPrimitivesModel_1 from "./FormDataPrimitivesModel.js"; import type FormEntity_1 from "./FormEntity.js"; @@ -11,39 +11,39 @@ import FormRecordTypesModel_1 from "./FormRecordTypesModel.js"; import FormTemporalTypesModel_1 from "./FormTemporalTypesModel.js"; import FormValidationConstraintsModel_1 from "./FormValidationConstraintsModel.js"; class FormEntityModel extends FormEntityIdModel_1 { - declare static createEmptyValue: () => FormEntity_1; + static override createEmptyValue = makeObjectEmptyValueCreator_1(FormEntityModel); get myId(): NumberModel_1 { - return this[_getPropertyModel_1]("myId", NumberModel_1, [false]) as NumberModel_1; + return this[_getPropertyModel_1]("myId", (parent, key) => new NumberModel_1(parent, key, false)); } get dataPrimitives(): FormDataPrimitivesModel_1 { - return this[_getPropertyModel_1]("dataPrimitives", FormDataPrimitivesModel_1, [false]) as FormDataPrimitivesModel_1; + return this[_getPropertyModel_1]("dataPrimitives", (parent, key) => new FormDataPrimitivesModel_1(parent, key, false)); } get entityHierarchy(): FormEntityHierarchyModel_1 { - return this[_getPropertyModel_1]("entityHierarchy", FormEntityHierarchyModel_1, [false]) as FormEntityHierarchyModel_1; + return this[_getPropertyModel_1]("entityHierarchy", (parent, key) => new FormEntityHierarchyModel_1(parent, key, false)); } get temporalTypes(): FormTemporalTypesModel_1 { - return this[_getPropertyModel_1]("temporalTypes", FormTemporalTypesModel_1, [false]) as FormTemporalTypesModel_1; + return this[_getPropertyModel_1]("temporalTypes", (parent, key) => new FormTemporalTypesModel_1(parent, key, false)); } get arrayTypes(): FormArrayTypesModel_1 { - return this[_getPropertyModel_1]("arrayTypes", FormArrayTypesModel_1, [false]) as FormArrayTypesModel_1; + return this[_getPropertyModel_1]("arrayTypes", (parent, key) => new FormArrayTypesModel_1(parent, key, false)); } get enumTypes(): FormEnumTypesModel_1 { - return this[_getPropertyModel_1]("enumTypes", FormEnumTypesModel_1, [false]) as FormEnumTypesModel_1; + return this[_getPropertyModel_1]("enumTypes", (parent, key) => new FormEnumTypesModel_1(parent, key, false)); } get recordTypes(): FormRecordTypesModel_1 { - return this[_getPropertyModel_1]("recordTypes", FormRecordTypesModel_1, [false]) as FormRecordTypesModel_1; + return this[_getPropertyModel_1]("recordTypes", (parent, key) => new FormRecordTypesModel_1(parent, key, false)); } get validationConstraints(): FormValidationConstraintsModel_1 { - return this[_getPropertyModel_1]("validationConstraints", FormValidationConstraintsModel_1, [false]) as FormValidationConstraintsModel_1; + return this[_getPropertyModel_1]("validationConstraints", (parent, key) => new FormValidationConstraintsModel_1(parent, key, false)); } get myOptionalTypes(): FormOptionalTypesModel_1 { - return this[_getPropertyModel_1]("myOptionalTypes", FormOptionalTypesModel_1, [false]) as FormOptionalTypesModel_1; + return this[_getPropertyModel_1]("myOptionalTypes", (parent, key) => new FormOptionalTypesModel_1(parent, key, false)); } get nonnullTypes(): FormNonnullTypesModel_1 { - return this[_getPropertyModel_1]("nonnullTypes", FormNonnullTypesModel_1, [false]) as FormNonnullTypesModel_1; + return this[_getPropertyModel_1]("nonnullTypes", (parent, key) => new FormNonnullTypesModel_1(parent, key, false)); } get unknownModel(): ObjectModel_1 { - return this[_getPropertyModel_1]("unknownModel", ObjectModel_1, [true]) as ObjectModel_1; + return this[_getPropertyModel_1]("unknownModel", (parent, key) => new ObjectModel_1(parent, key, true)); } } export default FormEntityModel; diff --git a/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormEnumTypesModel.snap.ts b/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormEnumTypesModel.snap.ts index a902b930e9..e354c1c425 100644 --- a/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormEnumTypesModel.snap.ts +++ b/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormEnumTypesModel.snap.ts @@ -1,6 +1,7 @@ -import { _enum as _enum_1, EnumModel as EnumModel_1 } from "@hilla/form"; +import { _enum as _enum_1, EnumModel as EnumModel_1, makeEnumEmptyValueCreator as makeEnumEmptyValueCreator_1 } from "@hilla/form"; import FormEnumTypes_1 from "./FormEnumTypes.js"; class FormEnumTypesModel extends EnumModel_1 { + static override createEmptyValue = makeEnumEmptyValueCreator_1(FormEnumTypesModel); readonly [_enum_1] = FormEnumTypes_1; } export default FormEnumTypesModel; diff --git a/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormNonnullTypesModel.snap.ts b/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormNonnullTypesModel.snap.ts index 1ccddd49b4..e7c27ead3c 100644 --- a/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormNonnullTypesModel.snap.ts +++ b/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormNonnullTypesModel.snap.ts @@ -1,15 +1,15 @@ -import { _getPropertyModel as _getPropertyModel_1, ArrayModel as ArrayModel_1, ObjectModel as ObjectModel_1, StringModel as StringModel_1 } from "@hilla/form"; +import { _getPropertyModel as _getPropertyModel_1, ArrayModel as ArrayModel_1, makeObjectEmptyValueCreator as makeObjectEmptyValueCreator_1, ObjectModel as ObjectModel_1, StringModel as StringModel_1 } from "@hilla/form"; import type FormNonnullTypes_1 from "./FormNonnullTypes.js"; class FormNonnullTypesModel extends ObjectModel_1 { - declare static createEmptyValue: () => FormNonnullTypes_1; + static override createEmptyValue = makeObjectEmptyValueCreator_1(FormNonnullTypesModel); get nonNullableString(): StringModel_1 { - return this[_getPropertyModel_1]("nonNullableString", StringModel_1, [false]) as StringModel_1; + return this[_getPropertyModel_1]("nonNullableString", (parent, key) => new StringModel_1(parent, key, false)); } - get nonNullableList(): ArrayModel_1 { - return this[_getPropertyModel_1]("nonNullableList", ArrayModel_1, [false, StringModel_1, [true]]) as ArrayModel_1; + get nonNullableList(): ArrayModel_1 { + return this[_getPropertyModel_1]("nonNullableList", (parent, key) => new ArrayModel_1(parent, key, false, (parent, key) => new StringModel_1(parent, key, true))); } - get nonNullableMatrix(): ArrayModel_1, ArrayModel_1> { - return this[_getPropertyModel_1]("nonNullableMatrix", ArrayModel_1, [false, ArrayModel_1, [true, StringModel_1, [true]]]) as ArrayModel_1, ArrayModel_1>; + get nonNullableMatrix(): ArrayModel_1> { + return this[_getPropertyModel_1]("nonNullableMatrix", (parent, key) => new ArrayModel_1(parent, key, false, (parent, key) => new ArrayModel_1(parent, key, true, (parent, key) => new StringModel_1(parent, key, true)))); } } export default FormNonnullTypesModel; diff --git a/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormOptionalTypesModel.snap.ts b/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormOptionalTypesModel.snap.ts index e0ac90b3b3..bbfb163b01 100644 --- a/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormOptionalTypesModel.snap.ts +++ b/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormOptionalTypesModel.snap.ts @@ -1,19 +1,19 @@ -import { _getPropertyModel as _getPropertyModel_1, ArrayModel as ArrayModel_1, ObjectModel as ObjectModel_1, StringModel as StringModel_1 } from "@hilla/form"; +import { _getPropertyModel as _getPropertyModel_1, ArrayModel as ArrayModel_1, makeObjectEmptyValueCreator as makeObjectEmptyValueCreator_1, ObjectModel as ObjectModel_1, StringModel as StringModel_1 } from "@hilla/form"; import FormEntityModel_1 from "./FormEntityModel.js"; import type FormOptionalTypes_1 from "./FormOptionalTypes.js"; class FormOptionalTypesModel extends ObjectModel_1 { - declare static createEmptyValue: () => FormOptionalTypes_1; + static override createEmptyValue = makeObjectEmptyValueCreator_1(FormOptionalTypesModel); get optionalString(): StringModel_1 { - return this[_getPropertyModel_1]("optionalString", StringModel_1, [false]) as StringModel_1; + return this[_getPropertyModel_1]("optionalString", (parent, key) => new StringModel_1(parent, key, false)); } get optionalEntity(): FormEntityModel_1 { - return this[_getPropertyModel_1]("optionalEntity", FormEntityModel_1, [false]) as FormEntityModel_1; + return this[_getPropertyModel_1]("optionalEntity", (parent, key) => new FormEntityModel_1(parent, key, false)); } - get optionalList(): ArrayModel_1 { - return this[_getPropertyModel_1]("optionalList", ArrayModel_1, [false, StringModel_1, [true]]) as ArrayModel_1; + get optionalList(): ArrayModel_1 { + return this[_getPropertyModel_1]("optionalList", (parent, key) => new ArrayModel_1(parent, key, false, (parent, key) => new StringModel_1(parent, key, true))); } - get optionalMatrix(): ArrayModel_1, ArrayModel_1> { - return this[_getPropertyModel_1]("optionalMatrix", ArrayModel_1, [false, ArrayModel_1, [true, StringModel_1, [true]]]) as ArrayModel_1, ArrayModel_1>; + get optionalMatrix(): ArrayModel_1> { + return this[_getPropertyModel_1]("optionalMatrix", (parent, key) => new ArrayModel_1(parent, key, false, (parent, key) => new ArrayModel_1(parent, key, true, (parent, key) => new StringModel_1(parent, key, true)))); } } export default FormOptionalTypesModel; diff --git a/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormRecordTypesModel.snap.ts b/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormRecordTypesModel.snap.ts index 38b5a06153..b83e198d94 100644 --- a/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormRecordTypesModel.snap.ts +++ b/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormRecordTypesModel.snap.ts @@ -1,26 +1,26 @@ -import { _getPropertyModel as _getPropertyModel_1, ObjectModel as ObjectModel_1 } from "@hilla/form"; +import { _getPropertyModel as _getPropertyModel_1, makeObjectEmptyValueCreator as makeObjectEmptyValueCreator_1, ObjectModel as ObjectModel_1 } from "@hilla/form"; import type FormEntityHierarchy_1 from "./FormEntityHierarchy.js"; import type FormOptionalTypes_1 from "./FormOptionalTypes.js"; import type FormRecordTypes_1 from "./FormRecordTypes.js"; class FormRecordTypesModel extends ObjectModel_1 { - declare static createEmptyValue: () => FormRecordTypes_1; + static override createEmptyValue = makeObjectEmptyValueCreator_1(FormRecordTypesModel); get stringMap(): ObjectModel_1> { - return this[_getPropertyModel_1]("stringMap", ObjectModel_1, [false]) as ObjectModel_1>; + return this[_getPropertyModel_1]("stringMap", (parent, key) => new ObjectModel_1(parent, key, false)); } get entityHierarchyMap(): ObjectModel_1> { - return this[_getPropertyModel_1]("entityHierarchyMap", ObjectModel_1, [false]) as ObjectModel_1>; + return this[_getPropertyModel_1]("entityHierarchyMap", (parent, key) => new ObjectModel_1(parent, key, false)); } get stringListMap(): ObjectModel_1>> { - return this[_getPropertyModel_1]("stringListMap", ObjectModel_1, [false]) as ObjectModel_1>>; + return this[_getPropertyModel_1]("stringListMap", (parent, key) => new ObjectModel_1(parent, key, false)); } get selfReferenceMap(): ObjectModel_1> { - return this[_getPropertyModel_1]("selfReferenceMap", ObjectModel_1, [false]) as ObjectModel_1>; + return this[_getPropertyModel_1]("selfReferenceMap", (parent, key) => new ObjectModel_1(parent, key, false)); } get complexMap(): ObjectModel_1>>> { - return this[_getPropertyModel_1]("complexMap", ObjectModel_1, [false]) as ObjectModel_1>>>; + return this[_getPropertyModel_1]("complexMap", (parent, key) => new ObjectModel_1(parent, key, false)); } get objectMap(): ObjectModel_1> { - return this[_getPropertyModel_1]("objectMap", ObjectModel_1, [false]) as ObjectModel_1>; + return this[_getPropertyModel_1]("objectMap", (parent, key) => new ObjectModel_1(parent, key, false)); } } export default FormRecordTypesModel; diff --git a/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormTemporalTypesModel.snap.ts b/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormTemporalTypesModel.snap.ts index 08d77588a8..5ff272d231 100644 --- a/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormTemporalTypesModel.snap.ts +++ b/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormTemporalTypesModel.snap.ts @@ -1,12 +1,12 @@ -import { _getPropertyModel as _getPropertyModel_1, ObjectModel as ObjectModel_1, StringModel as StringModel_1 } from "@hilla/form"; +import { _getPropertyModel as _getPropertyModel_1, makeObjectEmptyValueCreator as makeObjectEmptyValueCreator_1, ObjectModel as ObjectModel_1, StringModel as StringModel_1 } from "@hilla/form"; import type FormTemporalTypes_1 from "./FormTemporalTypes.js"; class FormTemporalTypesModel extends ObjectModel_1 { - declare static createEmptyValue: () => FormTemporalTypes_1; + static override createEmptyValue = makeObjectEmptyValueCreator_1(FormTemporalTypesModel); get localDate(): StringModel_1 { - return this[_getPropertyModel_1]("localDate", StringModel_1, [false]) as StringModel_1; + return this[_getPropertyModel_1]("localDate", (parent, key) => new StringModel_1(parent, key, false)); } get localTime(): StringModel_1 { - return this[_getPropertyModel_1]("localTime", StringModel_1, [false]) as StringModel_1; + return this[_getPropertyModel_1]("localTime", (parent, key) => new StringModel_1(parent, key, false)); } } export default FormTemporalTypesModel; diff --git a/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormValidationConstraintsModel.snap.ts b/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormValidationConstraintsModel.snap.ts index 849525bb2c..37df81d162 100644 --- a/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormValidationConstraintsModel.snap.ts +++ b/packages/ts/generator-typescript-plugin-model/test/model/fixtures/FormValidationConstraintsModel.snap.ts @@ -1,76 +1,76 @@ -import { _getPropertyModel as _getPropertyModel_1, ArrayModel as ArrayModel_1, AssertFalse as AssertFalse_1, AssertTrue as AssertTrue_1, DecimalMax as DecimalMax_1, DecimalMin as DecimalMin_1, Digits as Digits_1, Email as Email_1, Future as Future_1, Max as Max_1, Min as Min_1, Negative as Negative_1, NegativeOrZero as NegativeOrZero_1, NotBlank as NotBlank_1, NotEmpty as NotEmpty_1, NotNull as NotNull_1, Null as Null_1, NumberModel as NumberModel_1, ObjectModel as ObjectModel_1, Past as Past_1, Pattern as Pattern_1, Positive as Positive_1, PositiveOrZero as PositiveOrZero_1, Size as Size_1, StringModel as StringModel_1 } from "@hilla/form"; +import { _getPropertyModel as _getPropertyModel_1, ArrayModel as ArrayModel_1, AssertFalse as AssertFalse_1, AssertTrue as AssertTrue_1, DecimalMax as DecimalMax_1, DecimalMin as DecimalMin_1, Digits as Digits_1, Email as Email_1, Future as Future_1, makeObjectEmptyValueCreator as makeObjectEmptyValueCreator_1, Max as Max_1, Min as Min_1, Negative as Negative_1, NegativeOrZero as NegativeOrZero_1, NotBlank as NotBlank_1, NotEmpty as NotEmpty_1, NotNull as NotNull_1, Null as Null_1, NumberModel as NumberModel_1, ObjectModel as ObjectModel_1, Past as Past_1, Pattern as Pattern_1, Positive as Positive_1, PositiveOrZero as PositiveOrZero_1, Size as Size_1, StringModel as StringModel_1 } from "@hilla/form"; import FormEntityModel_1 from "./FormEntityModel.js"; import type FormValidationConstraints_1 from "./FormValidationConstraints.js"; class FormValidationConstraintsModel extends ObjectModel_1 { - declare static createEmptyValue: () => FormValidationConstraints_1; - get list(): ArrayModel_1 { - return this[_getPropertyModel_1]("list", ArrayModel_1, [false, StringModel_1, [true], new NotEmpty_1()]) as ArrayModel_1; + static override createEmptyValue = makeObjectEmptyValueCreator_1(FormValidationConstraintsModel); + get list(): ArrayModel_1 { + return this[_getPropertyModel_1]("list", (parent, key) => new ArrayModel_1(parent, key, false, (parent, key) => new StringModel_1(parent, key, true), new NotEmpty_1())); } get email(): StringModel_1 { - return this[_getPropertyModel_1]("email", StringModel_1, [false, new Email_1({ message: "foo" })]) as StringModel_1; + return this[_getPropertyModel_1]("email", (parent, key) => new StringModel_1(parent, key, false, new Email_1({ message: "foo" }))); } get isNull(): StringModel_1 { - return this[_getPropertyModel_1]("isNull", StringModel_1, [false, new Null_1()]) as StringModel_1; + return this[_getPropertyModel_1]("isNull", (parent, key) => new StringModel_1(parent, key, false, new Null_1())); } get notNull(): StringModel_1 { - return this[_getPropertyModel_1]("notNull", StringModel_1, [false, new NotNull_1()]) as StringModel_1; + return this[_getPropertyModel_1]("notNull", (parent, key) => new StringModel_1(parent, key, false, new NotNull_1())); } get notEmpty(): StringModel_1 { - return this[_getPropertyModel_1]("notEmpty", StringModel_1, [false, new NotEmpty_1(), new NotNull_1()]) as StringModel_1; + return this[_getPropertyModel_1]("notEmpty", (parent, key) => new StringModel_1(parent, key, false, new NotEmpty_1(), new NotNull_1())); } get notNullEntity(): FormEntityModel_1 { - return this[_getPropertyModel_1]("notNullEntity", FormEntityModel_1, [false]) as FormEntityModel_1; + return this[_getPropertyModel_1]("notNullEntity", (parent, key) => new FormEntityModel_1(parent, key, false)); } get notBlank(): StringModel_1 { - return this[_getPropertyModel_1]("notBlank", StringModel_1, [false, new NotBlank_1()]) as StringModel_1; + return this[_getPropertyModel_1]("notBlank", (parent, key) => new StringModel_1(parent, key, false, new NotBlank_1())); } get assertTrue(): StringModel_1 { - return this[_getPropertyModel_1]("assertTrue", StringModel_1, [false, new AssertTrue_1()]) as StringModel_1; + return this[_getPropertyModel_1]("assertTrue", (parent, key) => new StringModel_1(parent, key, false, new AssertTrue_1())); } get assertFalse(): StringModel_1 { - return this[_getPropertyModel_1]("assertFalse", StringModel_1, [false, new AssertFalse_1()]) as StringModel_1; + return this[_getPropertyModel_1]("assertFalse", (parent, key) => new StringModel_1(parent, key, false, new AssertFalse_1())); } get min(): NumberModel_1 { - return this[_getPropertyModel_1]("min", NumberModel_1, [false, new Min_1({ value: 1, message: "foo" })]) as NumberModel_1; + return this[_getPropertyModel_1]("min", (parent, key) => new NumberModel_1(parent, key, false, new Min_1({ value: 1, message: "foo" }))); } get max(): NumberModel_1 { - return this[_getPropertyModel_1]("max", NumberModel_1, [false, new Max_1(2)]) as NumberModel_1; + return this[_getPropertyModel_1]("max", (parent, key) => new NumberModel_1(parent, key, false, new Max_1(2))); } get decimalMin(): NumberModel_1 { - return this[_getPropertyModel_1]("decimalMin", NumberModel_1, [false, new DecimalMin_1("0.01")]) as NumberModel_1; + return this[_getPropertyModel_1]("decimalMin", (parent, key) => new NumberModel_1(parent, key, false, new DecimalMin_1("0.01"))); } get decimalMax(): NumberModel_1 { - return this[_getPropertyModel_1]("decimalMax", NumberModel_1, [false, new DecimalMax_1({ value: "0.01", inclusive: false })]) as NumberModel_1; + return this[_getPropertyModel_1]("decimalMax", (parent, key) => new NumberModel_1(parent, key, false, new DecimalMax_1({ value: "0.01", inclusive: false }))); } get negative(): NumberModel_1 { - return this[_getPropertyModel_1]("negative", NumberModel_1, [false, new Negative_1()]) as NumberModel_1; + return this[_getPropertyModel_1]("negative", (parent, key) => new NumberModel_1(parent, key, false, new Negative_1())); } get negativeOrZero(): NumberModel_1 { - return this[_getPropertyModel_1]("negativeOrZero", NumberModel_1, [false, new NegativeOrZero_1()]) as NumberModel_1; + return this[_getPropertyModel_1]("negativeOrZero", (parent, key) => new NumberModel_1(parent, key, false, new NegativeOrZero_1())); } get positive(): NumberModel_1 { - return this[_getPropertyModel_1]("positive", NumberModel_1, [false, new Positive_1()]) as NumberModel_1; + return this[_getPropertyModel_1]("positive", (parent, key) => new NumberModel_1(parent, key, false, new Positive_1())); } get positiveOrZero(): NumberModel_1 { - return this[_getPropertyModel_1]("positiveOrZero", NumberModel_1, [false, new PositiveOrZero_1()]) as NumberModel_1; + return this[_getPropertyModel_1]("positiveOrZero", (parent, key) => new NumberModel_1(parent, key, false, new PositiveOrZero_1())); } get size(): StringModel_1 { - return this[_getPropertyModel_1]("size", StringModel_1, [false, new Size_1()]) as StringModel_1; + return this[_getPropertyModel_1]("size", (parent, key) => new StringModel_1(parent, key, false, new Size_1())); } get size1(): StringModel_1 { - return this[_getPropertyModel_1]("size1", StringModel_1, [false, new Size_1({ min: 1 })]) as StringModel_1; + return this[_getPropertyModel_1]("size1", (parent, key) => new StringModel_1(parent, key, false, new Size_1({ min: 1 }))); } get digits(): StringModel_1 { - return this[_getPropertyModel_1]("digits", StringModel_1, [false, new Digits_1({ integer: 5, fraction: 2 })]) as StringModel_1; + return this[_getPropertyModel_1]("digits", (parent, key) => new StringModel_1(parent, key, false, new Digits_1({ integer: 5, fraction: 2 }))); } get past(): StringModel_1 { - return this[_getPropertyModel_1]("past", StringModel_1, [false, new Past_1()]) as StringModel_1; + return this[_getPropertyModel_1]("past", (parent, key) => new StringModel_1(parent, key, false, new Past_1())); } get future(): StringModel_1 { - return this[_getPropertyModel_1]("future", StringModel_1, [false, new Future_1()]) as StringModel_1; + return this[_getPropertyModel_1]("future", (parent, key) => new StringModel_1(parent, key, false, new Future_1())); } get pattern(): StringModel_1 { - return this[_getPropertyModel_1]("pattern", StringModel_1, [false, new Pattern_1({ regexp: "\\d+\\..+" })]) as StringModel_1; + return this[_getPropertyModel_1]("pattern", (parent, key) => new StringModel_1(parent, key, false, new Pattern_1({ regexp: "\\d+\\..+" }))); } } export default FormValidationConstraintsModel; diff --git a/packages/ts/react-form/src/index.ts b/packages/ts/react-form/src/index.ts index d8e452b6fa..4d1d5a367d 100644 --- a/packages/ts/react-form/src/index.ts +++ b/packages/ts/react-form/src/index.ts @@ -1,21 +1,24 @@ +/* eslint-disable @typescript-eslint/unbound-method */ import { _fromString, _validity, type AbstractModel, type BinderConfiguration, + type BinderNode, BinderRoot, CHANGED, + type DetachedModelConstructor, type FieldStrategy, getBinderNode, getDefaultFieldStrategy, hasFromString, isFieldElement, - type ModelConstructor, type Validator, type ValueError, + type Value, } from '@hilla/form'; -import type { BinderNode } from '@hilla/form/BinderNode.js'; import { useEffect, useMemo, useReducer, useRef } from 'react'; +import type { Writable } from 'type-fest'; import type { VaadinWindow } from './types.js'; declare const __VERSION__: string; @@ -26,7 +29,7 @@ $wnd.Vaadin ??= {}; $wnd.Vaadin.registrations ??= []; $wnd.Vaadin.registrations.push({ is: '@hilla/react-form', - version: /* updated-by-script */ '2.3.0-alpha5', + version: __VERSION__, }); function useUpdate() { @@ -42,40 +45,40 @@ export type FieldDirectiveResult = Readonly<{ ref(element: HTMLElement | null): void; }>; -export type FieldDirective = (model: AbstractModel) => FieldDirectiveResult; +export type FieldDirective = (model: AbstractModel) => FieldDirectiveResult; -export type UseFormPartResult> = Readonly<{ - defaultValue: T; +export type UseFormPartResult = Readonly<{ + defaultValue?: Value; dirty: boolean; - errors: ReadonlyArray>; + errors: readonly ValueError[]; invalid: boolean; model: M; name: string; field: FieldDirective; - ownErrors: ReadonlyArray>; + ownErrors: ReadonlyArray>>; required: boolean; - validators: ReadonlyArray>; - value?: T; + validators: ReadonlyArray>>; + value?: Value; visited: boolean; - addValidator(validator: Validator): void; - setValidators(validators: ReadonlyArray>): void; - setValue(value: T | undefined): void; + addValidator(validator: Validator>): void; + setValidators(validators: ReadonlyArray>>): void; + setValue(value: Value | undefined): void; setVisited(visited: boolean): void; - validate(): Promise>>; + validate(): Promise; }>; -export type UseFormResult> = Omit, 'setValue' | 'value'> & +export type UseFormResult = Omit, 'setValue' | 'value'> & Readonly<{ - value: T; - setDefaultValue(value: T): void; - setValue(value: T): void; - submit(): Promise; + value: Value; + setDefaultValue(value: Value): void; + setValue(value: Value): void; + submit(): Promise | undefined | void>; reset(): void; clear(): void; - read(value: T | null | undefined): void; + read(value: Value | null | undefined): void; }>; -type FieldState = { +type FieldState = { value?: T; required: boolean; invalid: boolean; @@ -87,11 +90,11 @@ type FieldState = { ref(element: HTMLElement | null): void; }; -function convertFieldValue>(model: T, fieldValue: unknown) { +function convertFieldValue(model: T, fieldValue: unknown) { return typeof fieldValue === 'string' && hasFromString(model) ? model[_fromString](fieldValue) : fieldValue; } -function getFormPart>(node: BinderNode): Omit, 'field'> { +function getFormPart(node: BinderNode): Omit, 'field'> { return { addValidator: node.addValidator.bind(node), defaultValue: node.defaultValue, @@ -118,15 +121,15 @@ function getFormPart>(node: BinderNode): Omi }; } -function useFields>(node: BinderNode): FieldDirective { +function useFields(node: BinderNode): FieldDirective { return useMemo(() => { - const registry = new WeakMap, FieldState>(); + const registry = new WeakMap(); - return ((model: AbstractModel) => { + return ((model: AbstractModel) => { const n = getBinderNode(model); n.initializeValue(true); - const fieldState: FieldState = registry.get(model) ?? { + const fieldState: FieldState = registry.get(model) ?? { element: undefined, errorMessage: '', invalid: false, @@ -135,11 +138,8 @@ function useFields>(node: BinderNode): Field }, ref(element: HTMLElement | null) { if (!element) { - // eslint-disable-next-line @typescript-eslint/unbound-method fieldState.element?.removeEventListener('change', fieldState.updateValue); - // eslint-disable-next-line @typescript-eslint/unbound-method fieldState.element?.removeEventListener('input', fieldState.updateValue); - // eslint-disable-next-line @typescript-eslint/unbound-method fieldState.element?.removeEventListener('blur', fieldState.markVisited); fieldState.strategy?.removeEventListeners(); fieldState.element = undefined; @@ -153,11 +153,8 @@ function useFields>(node: BinderNode): Field if (fieldState.element !== element) { fieldState.element = element; - // eslint-disable-next-line @typescript-eslint/unbound-method fieldState.element.addEventListener('change', fieldState.updateValue); - // eslint-disable-next-line @typescript-eslint/unbound-method fieldState.element.addEventListener('input', fieldState.updateValue); - // eslint-disable-next-line @typescript-eslint/unbound-method fieldState.element.addEventListener('blur', fieldState.markVisited); fieldState.strategy = getDefaultFieldStrategy(element, model); } @@ -212,22 +209,17 @@ function useFields>(node: BinderNode): Field return { name: n.name, - // eslint-disable-next-line @typescript-eslint/unbound-method ref: fieldState.ref, }; }) as FieldDirective; }, [node]); } -type MutableBinderConfiguration = { - -readonly [K in keyof BinderConfiguration]: BinderConfiguration[K]; -}; - -export function useForm>( - Model: ModelConstructor, - config?: BinderConfiguration, -): UseFormResult { - const configRef = useRef>({}); +export function useForm( + Model: DetachedModelConstructor, + config?: BinderConfiguration>, +): UseFormResult { + const configRef = useRef>>>({}); configRef.current.onSubmit = config?.onSubmit; configRef.current.onChange = config?.onChange; const update = useUpdate(); @@ -255,7 +247,7 @@ export function useForm>( }; } -export function useFormPart>(model: M): UseFormPartResult, M> { +export function useFormPart(model: M): UseFormPartResult { const binderNode = getBinderNode(model); const field = useFields(binderNode); return { diff --git a/packages/ts/react-form/test/models.ts b/packages/ts/react-form/test/models.ts index 375f3ba2f3..b76cc4fe13 100644 --- a/packages/ts/react-form/test/models.ts +++ b/packages/ts/react-form/test/models.ts @@ -1,4 +1,13 @@ -import { _getPropertyModel, BooleanModel, NumberModel, ObjectModel, Required, Size, StringModel } from '@hilla/form'; +import { + _getPropertyModel, + BooleanModel, + makeObjectEmptyValueCreator, + NumberModel, + ObjectModel, + Required, + Size, + StringModel, +} from '@hilla/form'; export interface User { id: number; @@ -8,22 +17,31 @@ export interface User { } export class UserModel extends ObjectModel { - declare static createEmptyValue: () => User; + static override createEmptyValue = makeObjectEmptyValueCreator(UserModel); get id(): NumberModel { - return this[_getPropertyModel]('id', NumberModel, [false]); + return this[_getPropertyModel]('id', (parent, key) => new NumberModel(parent, key, false)); } get name(): StringModel { - return this[_getPropertyModel]('name', StringModel, [false, new Required(), new Size({ max: 10 })]); + return this[_getPropertyModel]( + 'name', + (parent, key) => new StringModel(parent, key, false, new Required(), new Size({ max: 10 })), + ); } get password(): StringModel { - return this[_getPropertyModel]('password', StringModel, [false, new Required(), new Size({ min: 6 })]); + return this[_getPropertyModel]( + 'password', + (parent, key) => new StringModel(parent, key, false, new Required(), new Size({ min: 6 })), + ); } get passwordHint(): StringModel { - return this[_getPropertyModel]('passwordHint', StringModel, [true /* should be optional */]); + return this[_getPropertyModel]( + 'passwordHint', + (parent, key) => new StringModel(parent, key, true /* should be optional */), + ); } } @@ -33,13 +51,13 @@ export interface Login { } export class LoginModel extends ObjectModel { - declare static createEmptyValue: () => Login; + static override createEmptyValue = makeObjectEmptyValueCreator(LoginModel); get user(): UserModel { - return this[_getPropertyModel]('user', UserModel, [false]); + return this[_getPropertyModel]('user', (parent, key) => new UserModel(parent, key, false)); } get rememberMe(): BooleanModel { - return this[_getPropertyModel]('rememberMe', BooleanModel, [true]); + return this[_getPropertyModel]('rememberMe', (parent, key) => new BooleanModel(parent, key, true)); } } diff --git a/packages/ts/react-form/test/useForm.spec.tsx b/packages/ts/react-form/test/useForm.spec.tsx index 82e3cd9079..4648f880ce 100644 --- a/packages/ts/react-form/test/useForm.spec.tsx +++ b/packages/ts/react-form/test/useForm.spec.tsx @@ -19,9 +19,9 @@ describe('@hilla/react-form', () => { model: UserModel; }>; - function UserForm({ model: m }: UserFormProps) { - const { field, model } = useFormPart(m); - const name = useFormPart(m.name); + function UserForm({ model: user }: UserFormProps) { + const { field, model } = useFormPart(user); + const name = useFormPart(user.name); return (
@@ -35,7 +35,7 @@ describe('@hilla/react-form', () => { } function LoginForm() { - const { field, model, read, submit, value } = useForm(LoginModel, { onChange, onSubmit }); + const { field, model, submit, value } = useForm(LoginModel, { onChange, onSubmit }); return ( <> diff --git a/packages/ts/react-grid/src/autogrid.tsx b/packages/ts/react-grid/src/autogrid.tsx index 296aac9840..abfa6fed84 100644 --- a/packages/ts/react-grid/src/autogrid.tsx +++ b/packages/ts/react-grid/src/autogrid.tsx @@ -1,4 +1,4 @@ -import type { AbstractModel, ModelConstructor } from '@hilla/form'; +import type { AbstractModel, DetachedModelConstructor } from '@hilla/form'; import { Grid, type GridDataProvider, @@ -10,7 +10,8 @@ import { } from '@hilla/react-components/Grid.js'; import { GridColumn } from '@hilla/react-components/GridColumn.js'; import { GridColumnGroup } from '@hilla/react-components/GridColumnGroup.js'; -import { useEffect, useRef, useState, type JSX } from 'react'; +import { GridSorter } from '@hilla/react-components/GridSorter.js'; +import { useCallback, useEffect, useRef, useState, type JSX } from 'react'; import type { CrudService } from './crud'; import { HeaderColumnContext } from './header-column-context'; import { HeaderFilter } from './header-filter'; @@ -25,7 +26,7 @@ import { getProperties, type PropertyInfo } from './utils.js'; export type AutoGridProps = GridProps & Readonly<{ service: CrudService; - model: ModelConstructor>; + model: DetachedModelConstructor>; filter?: Filter; visibleColumns?: string[]; headerFilters?: boolean; @@ -91,7 +92,7 @@ function createDataProvider( } function useColumns( - model: ModelConstructor>, + model: DetachedModelConstructor, setPropertyFilter: (propertyFilter: PropertyStringFilter) => void, options: { visibleColumns?: string[]; headerFilters?: boolean }, ) { @@ -154,7 +155,7 @@ export function AutoGrid({ }; // This cast should go away with #1252 - const children = useColumns(model as ModelConstructor>, setHeaderPropertyFilter, { + const children = useColumns(model, setHeaderPropertyFilter, { visibleColumns, headerFilters, }); diff --git a/packages/ts/react-grid/src/types/dev/hilla/crud/filter/AndFilterModel.ts b/packages/ts/react-grid/src/types/dev/hilla/crud/filter/AndFilterModel.ts index c2eb2209e8..62cb660c45 100644 --- a/packages/ts/react-grid/src/types/dev/hilla/crud/filter/AndFilterModel.ts +++ b/packages/ts/react-grid/src/types/dev/hilla/crud/filter/AndFilterModel.ts @@ -1,11 +1,20 @@ -import { _getPropertyModel as _getPropertyModel_1, ArrayModel as ArrayModel_1, ObjectModel as ObjectModel_1 } from "@hilla/form"; +import { + _getPropertyModel as _getPropertyModel_1, + ArrayModel as ArrayModel_1, + makeObjectEmptyValueCreator, + ObjectModel as ObjectModel_1 +} from "@hilla/form"; import type AndFilter_1 from "./AndFilter.js"; -import type Filter_1 from "./Filter.js"; import FilterModel_1 from "./FilterModel.js"; class AndFilterModel extends ObjectModel_1 { - declare static createEmptyValue: () => AndFilter_1; - get children(): ArrayModel_1 { - return this[_getPropertyModel_1]("children", ArrayModel_1, [false, FilterModel_1, [false]]) as ArrayModel_1; + static override createEmptyValue = makeObjectEmptyValueCreator(AndFilterModel); + + get children(): ArrayModel_1 { + return this[_getPropertyModel_1]("children", (parent, key) => + new ArrayModel_1(parent, key, false, (parent, key) => + new FilterModel_1(parent, key, false) + ) + ); } } export default AndFilterModel; diff --git a/packages/ts/react-grid/src/types/dev/hilla/crud/filter/FilterModel.ts b/packages/ts/react-grid/src/types/dev/hilla/crud/filter/FilterModel.ts index 9bf9142167..d50e7c0914 100644 --- a/packages/ts/react-grid/src/types/dev/hilla/crud/filter/FilterModel.ts +++ b/packages/ts/react-grid/src/types/dev/hilla/crud/filter/FilterModel.ts @@ -1,6 +1,10 @@ -import { _getPropertyModel as _getPropertyModel_1, ObjectModel as ObjectModel_1 } from "@hilla/form"; +import { + _getPropertyModel as _getPropertyModel_1, + makeObjectEmptyValueCreator, + ObjectModel as ObjectModel_1 +} from "@hilla/form"; import type Filter_1 from "./Filter.js"; class FilterModel extends ObjectModel_1 { - declare static createEmptyValue: () => Filter_1; + static override createEmptyValue = makeObjectEmptyValueCreator(FilterModel); } export default FilterModel; diff --git a/packages/ts/react-grid/src/types/dev/hilla/crud/filter/OrFilterModel.ts b/packages/ts/react-grid/src/types/dev/hilla/crud/filter/OrFilterModel.ts index d5200e0689..9fe41c5229 100644 --- a/packages/ts/react-grid/src/types/dev/hilla/crud/filter/OrFilterModel.ts +++ b/packages/ts/react-grid/src/types/dev/hilla/crud/filter/OrFilterModel.ts @@ -1,11 +1,19 @@ -import { _getPropertyModel as _getPropertyModel_1, ArrayModel as ArrayModel_1, ObjectModel as ObjectModel_1 } from "@hilla/form"; -import type Filter_1 from "./Filter.js"; +import { + _getPropertyModel as _getPropertyModel_1, + ArrayModel as ArrayModel_1, + makeObjectEmptyValueCreator, + ObjectModel as ObjectModel_1 +} from "@hilla/form"; import FilterModel_1 from "./FilterModel.js"; import type OrFilter_1 from "./OrFilter.js"; class OrFilterModel extends ObjectModel_1 { - declare static createEmptyValue: () => OrFilter_1; - get children(): ArrayModel_1 { - return this[_getPropertyModel_1]("children", ArrayModel_1, [false, FilterModel_1, [false]]) as ArrayModel_1; + static override createEmptyValue = makeObjectEmptyValueCreator(OrFilterModel); + get children(): ArrayModel_1 { + return this[_getPropertyModel_1]("children", (parent, key) => + new ArrayModel_1(parent, key, false, (parent, key) => + new FilterModel_1(parent, key, false) + ) + ); } } export default OrFilterModel; diff --git a/packages/ts/react-grid/src/types/dev/hilla/crud/filter/PropertyStringFilter/MatcherModel.ts b/packages/ts/react-grid/src/types/dev/hilla/crud/filter/PropertyStringFilter/MatcherModel.ts index 1d6c49cf81..6ab733b5ba 100644 --- a/packages/ts/react-grid/src/types/dev/hilla/crud/filter/PropertyStringFilter/MatcherModel.ts +++ b/packages/ts/react-grid/src/types/dev/hilla/crud/filter/PropertyStringFilter/MatcherModel.ts @@ -1,6 +1,12 @@ -import { _enum as _enum_1, EnumModel as EnumModel_1 } from "@hilla/form"; +import { + _enum as _enum_1, + EnumModel as EnumModel_1, + makeEnumEmptyValueCreator +} from "@hilla/form"; import Matcher_1 from "./Matcher.js"; class MatcherModel extends EnumModel_1 { + static override createEmptyValue = makeEnumEmptyValueCreator(MatcherModel); + readonly [_enum_1] = Matcher_1; } export default MatcherModel; diff --git a/packages/ts/react-grid/src/types/dev/hilla/crud/filter/PropertyStringFilterModel.ts b/packages/ts/react-grid/src/types/dev/hilla/crud/filter/PropertyStringFilterModel.ts index 8353243359..cdb2f8800e 100644 --- a/packages/ts/react-grid/src/types/dev/hilla/crud/filter/PropertyStringFilterModel.ts +++ b/packages/ts/react-grid/src/types/dev/hilla/crud/filter/PropertyStringFilterModel.ts @@ -1,16 +1,27 @@ -import { _getPropertyModel as _getPropertyModel_1, ObjectModel as ObjectModel_1, StringModel as StringModel_1 } from "@hilla/form"; +import { + _getPropertyModel as _getPropertyModel_1, + makeObjectEmptyValueCreator, + ObjectModel as ObjectModel_1, + StringModel as StringModel_1 +} from "@hilla/form"; import type PropertyStringFilter_1 from "./PropertyStringFilter.js"; import MatcherModel_1 from "./PropertyStringFilter/MatcherModel.js"; class PropertyStringFilterModel extends ObjectModel_1 { - declare static createEmptyValue: () => PropertyStringFilter_1; + static override createEmptyValue = makeObjectEmptyValueCreator(PropertyStringFilterModel); get propertyId(): StringModel_1 { - return this[_getPropertyModel_1]("propertyId", StringModel_1, [false]) as StringModel_1; + return this[_getPropertyModel_1]("propertyId", (parent, key) => + new StringModel_1(parent, key, false) + ); } get filterValue(): StringModel_1 { - return this[_getPropertyModel_1]("filterValue", StringModel_1, [false]) as StringModel_1; + return this[_getPropertyModel_1]("filterValue", (parent, key) => + new StringModel_1(parent, key, false) + ); } get matcher(): MatcherModel_1 { - return this[_getPropertyModel_1]("matcher", MatcherModel_1, [false]) as MatcherModel_1; + return this[_getPropertyModel_1]("matcher", (parent, key) => + new MatcherModel_1(parent, key, false) + ); } } export default PropertyStringFilterModel; diff --git a/packages/ts/react-grid/src/types/dev/hilla/mappedtypes/OrderModel.ts b/packages/ts/react-grid/src/types/dev/hilla/mappedtypes/OrderModel.ts index 9183627ff7..f21d046d7d 100644 --- a/packages/ts/react-grid/src/types/dev/hilla/mappedtypes/OrderModel.ts +++ b/packages/ts/react-grid/src/types/dev/hilla/mappedtypes/OrderModel.ts @@ -1,20 +1,35 @@ -import { _getPropertyModel as _getPropertyModel_1, BooleanModel as BooleanModel_1, NotBlank as NotBlank_1, ObjectModel as ObjectModel_1, StringModel as StringModel_1 } from "@hilla/form"; +import { + _getPropertyModel as _getPropertyModel_1, + BooleanModel as BooleanModel_1, + makeObjectEmptyValueCreator, + NotBlank as NotBlank_1, + ObjectModel as ObjectModel_1, + StringModel as StringModel_1 +} from "@hilla/form"; import DirectionModel_1 from "../../../org/springframework/data/domain/Sort/DirectionModel.js"; import NullHandlingModel_1 from "../../../org/springframework/data/domain/Sort/NullHandlingModel.js"; import type Order_1 from "./Order.js"; class OrderModel extends ObjectModel_1 { - declare static createEmptyValue: () => Order_1; + static override createEmptyValue = makeObjectEmptyValueCreator(OrderModel); get direction(): DirectionModel_1 { - return this[_getPropertyModel_1]("direction", DirectionModel_1, [false]) as DirectionModel_1; + return this[_getPropertyModel_1]("direction", (parent, key) => + new DirectionModel_1(parent, key, false) + ); } get property(): StringModel_1 { - return this[_getPropertyModel_1]("property", StringModel_1, [false, new NotBlank_1()]) as StringModel_1; + return this[_getPropertyModel_1]("property", (parent, key) => + new StringModel_1(parent, key, false, new NotBlank_1()) + ); } get ignoreCase(): BooleanModel_1 { - return this[_getPropertyModel_1]("ignoreCase", BooleanModel_1, [false]) as BooleanModel_1; + return this[_getPropertyModel_1]("ignoreCase", (parent, key) => + new BooleanModel_1(parent, key, false) + ); } get nullHandling(): NullHandlingModel_1 { - return this[_getPropertyModel_1]("nullHandling", NullHandlingModel_1, [true]) as NullHandlingModel_1; + return this[_getPropertyModel_1]("nullHandling", (parent, key) => + new NullHandlingModel_1(parent, key, true) + ); } } export default OrderModel; diff --git a/packages/ts/react-grid/src/types/dev/hilla/mappedtypes/PageableModel.ts b/packages/ts/react-grid/src/types/dev/hilla/mappedtypes/PageableModel.ts index 488ccb6c30..74087a9679 100644 --- a/packages/ts/react-grid/src/types/dev/hilla/mappedtypes/PageableModel.ts +++ b/packages/ts/react-grid/src/types/dev/hilla/mappedtypes/PageableModel.ts @@ -1,16 +1,27 @@ -import { _getPropertyModel as _getPropertyModel_1, NumberModel as NumberModel_1, ObjectModel as ObjectModel_1 } from "@hilla/form"; +import { + _getPropertyModel as _getPropertyModel_1, + makeObjectEmptyValueCreator, + NumberModel as NumberModel_1, + ObjectModel as ObjectModel_1 +} from "@hilla/form"; import type Pageable_1 from "./Pageable.js"; import SortModel_1 from "./SortModel.js"; class PageableModel extends ObjectModel_1 { - declare static createEmptyValue: () => Pageable_1; + static override createEmptyValue = makeObjectEmptyValueCreator(PageableModel); get pageNumber(): NumberModel_1 { - return this[_getPropertyModel_1]("pageNumber", NumberModel_1, [false]) as NumberModel_1; + return this[_getPropertyModel_1]("pageNumber", (parent, key) => + new NumberModel_1(parent, key, false) + ); } get pageSize(): NumberModel_1 { - return this[_getPropertyModel_1]("pageSize", NumberModel_1, [false]) as NumberModel_1; + return this[_getPropertyModel_1]("pageSize", (parent, key) => + new NumberModel_1(parent, key, false) + ); } get sort(): SortModel_1 { - return this[_getPropertyModel_1]("sort", SortModel_1, [false]) as SortModel_1; + return this[_getPropertyModel_1]("sort", (parent, key) => + new SortModel_1(parent, key, false) + ); } } export default PageableModel; diff --git a/packages/ts/react-grid/src/types/dev/hilla/mappedtypes/SortModel.ts b/packages/ts/react-grid/src/types/dev/hilla/mappedtypes/SortModel.ts index 3b0206899d..a9939730ab 100644 --- a/packages/ts/react-grid/src/types/dev/hilla/mappedtypes/SortModel.ts +++ b/packages/ts/react-grid/src/types/dev/hilla/mappedtypes/SortModel.ts @@ -1,11 +1,19 @@ -import { _getPropertyModel as _getPropertyModel_1, ArrayModel as ArrayModel_1, ObjectModel as ObjectModel_1 } from "@hilla/form"; -import type Order_1 from "./Order.js"; +import { + _getPropertyModel as _getPropertyModel_1, + ArrayModel as ArrayModel_1, + makeObjectEmptyValueCreator, + ObjectModel as ObjectModel_1 +} from "@hilla/form"; import OrderModel_1 from "./OrderModel.js"; import type Sort_1 from "./Sort.js"; class SortModel extends ObjectModel_1 { - declare static createEmptyValue: () => Sort_1; - get orders(): ArrayModel_1 { - return this[_getPropertyModel_1]("orders", ArrayModel_1, [false, OrderModel_1, [true]]) as ArrayModel_1; + static override createEmptyValue = makeObjectEmptyValueCreator(SortModel); + get orders(): ArrayModel_1 { + return this[_getPropertyModel_1]("orders", (parent, key) => + new ArrayModel_1(parent, key, false, (parent, key) => + new OrderModel_1(parent, key, true) + ) + ); } } export default SortModel; diff --git a/packages/ts/react-grid/src/types/org/springframework/data/domain/Sort/DirectionModel.ts b/packages/ts/react-grid/src/types/org/springframework/data/domain/Sort/DirectionModel.ts index cecf09ddb3..3e1f39abb3 100644 --- a/packages/ts/react-grid/src/types/org/springframework/data/domain/Sort/DirectionModel.ts +++ b/packages/ts/react-grid/src/types/org/springframework/data/domain/Sort/DirectionModel.ts @@ -1,6 +1,11 @@ -import { _enum as _enum_1, EnumModel as EnumModel_1 } from "@hilla/form"; +import { + _enum as _enum_1, + EnumModel as EnumModel_1, + makeEnumEmptyValueCreator, +} from "@hilla/form"; import Direction_1 from "./Direction.js"; class DirectionModel extends EnumModel_1 { + static override createEmptyValue = makeEnumEmptyValueCreator(DirectionModel); readonly [_enum_1] = Direction_1; } export default DirectionModel; diff --git a/packages/ts/react-grid/src/types/org/springframework/data/domain/Sort/NullHandlingModel.ts b/packages/ts/react-grid/src/types/org/springframework/data/domain/Sort/NullHandlingModel.ts index 84e82e2a2d..4aeb0391a0 100644 --- a/packages/ts/react-grid/src/types/org/springframework/data/domain/Sort/NullHandlingModel.ts +++ b/packages/ts/react-grid/src/types/org/springframework/data/domain/Sort/NullHandlingModel.ts @@ -1,6 +1,11 @@ -import { _enum as _enum_1, EnumModel as EnumModel_1 } from "@hilla/form"; +import { + _enum as _enum_1, + EnumModel as EnumModel_1, + makeEnumEmptyValueCreator +} from "@hilla/form"; import NullHandling_1 from "./NullHandling.js"; class NullHandlingModel extends EnumModel_1 { + static override createEmptyValue = makeEnumEmptyValueCreator(NullHandlingModel); readonly [_enum_1] = NullHandling_1; } export default NullHandlingModel; diff --git a/packages/ts/react-grid/src/utils.ts b/packages/ts/react-grid/src/utils.ts index fdcdc90a49..233c377939 100644 --- a/packages/ts/react-grid/src/utils.ts +++ b/packages/ts/react-grid/src/utils.ts @@ -1,4 +1,10 @@ -import { StringModel, type AbstractModel, type ModelConstructor, NumberModel } from '@hilla/form'; +import { + createDetachedModel, + StringModel, + type AbstractModel, + type DetachedModelConstructor, + NumberModel, +} from '@hilla/form'; export interface PropertyInfo { name: string; @@ -16,9 +22,10 @@ export function _generateHeader(path: string): string { .replace(/^./u, (match) => match.toUpperCase()); } -export const getProperties = (model: ModelConstructor>): PropertyInfo[] => { +export const getProperties = (model: DetachedModelConstructor): PropertyInfo[] => { const properties = Object.keys(Object.getOwnPropertyDescriptors(model.prototype)).filter((p) => p !== 'constructor'); - const modelInstance: any = new model({ value: undefined }, '', false); + // eslint-disable-next-line @typescript-eslint/no-unsafe-call + const modelInstance: any = createDetachedModel(model); return properties.map((name) => { // eslint-disable-next-line const propertyModel = modelInstance[name]; diff --git a/packages/ts/react-grid/test/test-models-and-services.ts b/packages/ts/react-grid/test/test-models-and-services.ts index 6c0679d00a..7c187cfa4d 100644 --- a/packages/ts/react-grid/test/test-models-and-services.ts +++ b/packages/ts/react-grid/test/test-models-and-services.ts @@ -1,4 +1,5 @@ import { BooleanModel, NumberModel, ObjectModel, StringModel, _getPropertyModel } from '@hilla/form'; +import { makeObjectEmptyValueCreator } from '@hilla/form'; import type { CrudService } from '../src/crud'; import type Filter from '../src/types/dev/hilla/crud/filter/Filter'; import type PropertyStringFilter from '../src/types/dev/hilla/crud/filter/PropertyStringFilter'; @@ -18,26 +19,26 @@ export interface Person { } export class PersonModel extends ObjectModel { - declare static createEmptyValue: () => Person; + static override createEmptyValue = makeObjectEmptyValueCreator(PersonModel); get firstName(): StringModel { - return this[_getPropertyModel]('firstName', StringModel, [false]); + return this[_getPropertyModel]('firstName', (parent, key) => new StringModel(parent, key, false)); } get lastName(): StringModel { - return this[_getPropertyModel]('firstName', StringModel, [false]); + return this[_getPropertyModel]('firstName', (parent, key) => new StringModel(parent, key, false)); } get email(): StringModel { - return this[_getPropertyModel]('email', StringModel, [false]); + return this[_getPropertyModel]('email', (parent, key) => new StringModel(parent, key, false)); } get someNumber(): NumberModel { - return this[_getPropertyModel]('someNumber', NumberModel, [false]); + return this[_getPropertyModel]('someNumber', (parent, key) => new NumberModel(parent, key, false)); } get vip(): BooleanModel { - return this[_getPropertyModel]('vip', BooleanModel, [false]); + return this[_getPropertyModel]('vip', (parent, key) => new BooleanModel(parent, key, false)); } } @@ -45,11 +46,11 @@ export class CompanyModel extends ObjectModel { declare static createEmptyValue: () => Company; get name(): StringModel { - return this[_getPropertyModel]('name', StringModel, [false]); + return this[_getPropertyModel]('name', (parent, key) => new StringModel(parent, key, false)); } get foundedDate(): StringModel { - return this[_getPropertyModel]('foundedDate', StringModel, [false]); + return this[_getPropertyModel]('foundedDate', (parent, key) => new StringModel(parent, key, false)); } }