diff --git a/DISCLAIMER b/DISCLAIMER index 08aef0bfcf4..e445695a323 100644 --- a/DISCLAIMER +++ b/DISCLAIMER @@ -11,10 +11,6 @@ policy. For example, releases may have incomplete or un-reviewed licensing conditions. What follows is a list of known issues the project is currently aware of (note that this list, by definition, is likely to be incomplete): -* Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 -* Some files, particularly test files, and those not supporting comments, may be missing the ASF Licensing Header -* - * Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 * Some files, particularly test files, and those not supporting comments, may diff --git a/examples/base64png-editor-chrome-extension/README.md b/examples/base64png-editor-chrome-extension/README.md index c9662c6b32e..7eeceec694a 100644 --- a/examples/base64png-editor-chrome-extension/README.md +++ b/examples/base64png-editor-chrome-extension/README.md @@ -56,10 +56,6 @@ policy. For example, releases may have incomplete or un-reviewed licensing conditions. What follows is a list of known issues the project is currently aware of (note that this list, by definition, is likely to be incomplete): -- Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 -- Some files, particularly test files, and those not supporting comments, may be missing the ASF Licensing Header -- - - Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 - Some files, particularly test files, and those not supporting comments, may diff --git a/examples/base64png-editor-chrome-extension/package.json b/examples/base64png-editor-chrome-extension/package.json index 53026d9cf04..eeab5bc3347 100644 --- a/examples/base64png-editor-chrome-extension/package.json +++ b/examples/base64png-editor-chrome-extension/package.json @@ -32,7 +32,7 @@ "@types/chrome": "^0.0.193", "copy-webpack-plugin": "^11.0.0", "rimraf": "^3.0.2", - "typescript": "^4.6.2", + "typescript": "^5.5.3", "webpack": "^5.88.2", "webpack-cli": "^4.10.0", "webpack-dev-server": "^4.15.1", diff --git a/examples/base64png-editor-chrome-extension/tsconfig.json b/examples/base64png-editor-chrome-extension/tsconfig.json index 0f98f743b4d..dbb00d207b5 100644 --- a/examples/base64png-editor-chrome-extension/tsconfig.json +++ b/examples/base64png-editor-chrome-extension/tsconfig.json @@ -1,8 +1,7 @@ { - "extends": "@kie-tools/tsconfig/tsconfig.json", + "extends": "@kie-tools/tsconfig/tsconfig.esm.json", "compilerOptions": { "declaration": false, "declarationMap": false - }, - "include": ["src"] + } } diff --git a/examples/base64png-editor-vscode-extension/README.md b/examples/base64png-editor-vscode-extension/README.md index ef8dd0ce8ab..74fc222be5f 100644 --- a/examples/base64png-editor-vscode-extension/README.md +++ b/examples/base64png-editor-vscode-extension/README.md @@ -61,10 +61,6 @@ policy. For example, releases may have incomplete or un-reviewed licensing conditions. What follows is a list of known issues the project is currently aware of (note that this list, by definition, is likely to be incomplete): -- Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 -- Some files, particularly test files, and those not supporting comments, may be missing the ASF Licensing Header -- - - Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 - Some files, particularly test files, and those not supporting comments, may diff --git a/examples/base64png-editor-vscode-extension/package.json b/examples/base64png-editor-vscode-extension/package.json index 5a340c4523a..4beb32b86f7 100644 --- a/examples/base64png-editor-vscode-extension/package.json +++ b/examples/base64png-editor-vscode-extension/package.json @@ -37,7 +37,7 @@ "@types/vscode": "1.67.0", "@vscode/vsce": "^2.22.0", "rimraf": "^3.0.2", - "typescript": "^4.6.2", + "typescript": "^5.5.3", "webpack": "^5.88.2", "webpack-cli": "^4.10.0", "webpack-dev-server": "^4.15.1", diff --git a/examples/base64png-editor-vscode-extension/tsconfig.json b/examples/base64png-editor-vscode-extension/tsconfig.json index 0f98f743b4d..dbb00d207b5 100644 --- a/examples/base64png-editor-vscode-extension/tsconfig.json +++ b/examples/base64png-editor-vscode-extension/tsconfig.json @@ -1,8 +1,7 @@ { - "extends": "@kie-tools/tsconfig/tsconfig.json", + "extends": "@kie-tools/tsconfig/tsconfig.esm.json", "compilerOptions": { "declaration": false, "declarationMap": false - }, - "include": ["src"] + } } diff --git a/examples/base64png-editor/README.md b/examples/base64png-editor/README.md index 62b44924c7c..8e0e6fb6397 100644 --- a/examples/base64png-editor/README.md +++ b/examples/base64png-editor/README.md @@ -38,10 +38,6 @@ policy. For example, releases may have incomplete or un-reviewed licensing conditions. What follows is a list of known issues the project is currently aware of (note that this list, by definition, is likely to be incomplete): -- Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 -- Some files, particularly test files, and those not supporting comments, may be missing the ASF Licensing Header -- - - Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 - Some files, particularly test files, and those not supporting comments, may diff --git a/examples/base64png-editor/package.json b/examples/base64png-editor/package.json index 9aed87698f3..4c9ee64631e 100644 --- a/examples/base64png-editor/package.json +++ b/examples/base64png-editor/package.json @@ -39,6 +39,6 @@ "@types/react-dom": "^17.0.5", "copyfiles": "^2.4.1", "rimraf": "^3.0.2", - "typescript": "^4.6.2" + "typescript": "^5.5.3" } } diff --git a/examples/base64png-editor/tsconfig.json b/examples/base64png-editor/tsconfig.json index 3855f0f523c..9154a249aa5 100644 --- a/examples/base64png-editor/tsconfig.json +++ b/examples/base64png-editor/tsconfig.json @@ -1,7 +1,6 @@ { - "extends": "@kie-tools/tsconfig/tsconfig.json", + "extends": "@kie-tools/tsconfig/tsconfig.esm.json", "compilerOptions": { - "outDir": "dist" - }, - "include": ["src"] + "jsx": "react-jsx" + } } diff --git a/examples/commit-message-validation-service/README.md b/examples/commit-message-validation-service/README.md index 8f074021ab4..0be24ec337a 100644 --- a/examples/commit-message-validation-service/README.md +++ b/examples/commit-message-validation-service/README.md @@ -62,10 +62,6 @@ policy. For example, releases may have incomplete or un-reviewed licensing conditions. What follows is a list of known issues the project is currently aware of (note that this list, by definition, is likely to be incomplete): -- Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 -- Some files, particularly test files, and those not supporting comments, may be missing the ASF Licensing Header -- - - Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 - Some files, particularly test files, and those not supporting comments, may diff --git a/examples/drools-process-usertasks-quarkus-example/README.md b/examples/drools-process-usertasks-quarkus-example/README.md index f7e844ad2ba..738062acc7f 100644 --- a/examples/drools-process-usertasks-quarkus-example/README.md +++ b/examples/drools-process-usertasks-quarkus-example/README.md @@ -246,10 +246,6 @@ policy. For example, releases may have incomplete or un-reviewed licensing conditions. What follows is a list of known issues the project is currently aware of (note that this list, by definition, is likely to be incomplete): -- Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 -- Some files, particularly test files, and those not supporting comments, may be missing the ASF Licensing Header -- - - Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 - Some files, particularly test files, and those not supporting comments, may diff --git a/examples/ping-pong-view-angular/README.md b/examples/ping-pong-view-angular/README.md index eaed70e262d..2c6cb73d7dc 100644 --- a/examples/ping-pong-view-angular/README.md +++ b/examples/ping-pong-view-angular/README.md @@ -42,10 +42,6 @@ policy. For example, releases may have incomplete or un-reviewed licensing conditions. What follows is a list of known issues the project is currently aware of (note that this list, by definition, is likely to be incomplete): -- Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 -- Some files, particularly test files, and those not supporting comments, may be missing the ASF Licensing Header -- - - Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 - Some files, particularly test files, and those not supporting comments, may diff --git a/examples/ping-pong-view-angular/angular.json b/examples/ping-pong-view-angular/angular.json index 645c05ad385..82d10bcf0a8 100644 --- a/examples/ping-pong-view-angular/angular.json +++ b/examples/ping-pong-view-angular/angular.json @@ -3,7 +3,8 @@ "version": 1, "newProjectRoot": "projects", "cli": { - "packageManager": "pnpm" + "packageManager": "pnpm", + "analytics": false }, "projects": { "ping-pong-view-angular": { @@ -65,21 +66,10 @@ }, "serve": { "builder": "@angular-devkit/build-angular:dev-server", - "configurations": { - "production": { - "browserTarget": "ping-pong-view-angular:build:production" - }, - "development": { - "browserTarget": "ping-pong-view-angular:build:development" - } - }, "defaultConfiguration": "development" }, "extract-i18n": { - "builder": "@angular-devkit/build-angular:extract-i18n", - "options": { - "browserTarget": "ping-pong-view-angular:build" - } + "builder": "@angular-devkit/build-angular:extract-i18n" }, "test": { "builder": "@angular-devkit/build-angular:karma", @@ -145,6 +135,5 @@ } } } - }, - "defaultProject": "ping-pong-view-angular" + } } diff --git a/examples/ping-pong-view-angular/package.json b/examples/ping-pong-view-angular/package.json index e5b364c5d07..2a40e5e30a2 100644 --- a/examples/ping-pong-view-angular/package.json +++ b/examples/ping-pong-view-angular/package.json @@ -27,28 +27,25 @@ "build:wc-lib": "tsc --project tsconfig.lib.json" }, "dependencies": { - "@angular/animations": "^14.2.0", - "@angular/common": "^14.2.0", - "@angular/compiler": "^14.2.0", - "@angular/core": "^14.2.0", - "@angular/elements": "^14.2.0", - "@angular/forms": "^14.2.0", - "@angular/platform-browser": "^14.2.0", - "@angular/platform-browser-dynamic": "^14.2.0", - "@angular/router": "^14.2.0", + "@angular/common": "^18.1.2", + "@angular/compiler": "^18.1.2", + "@angular/core": "^18.1.2", + "@angular/elements": "^18.1.2", + "@angular/platform-browser": "^18.1.2", + "@angular/platform-browser-dynamic": "^18.1.2", "@kie-tools-core/envelope": "workspace:*", "@kie-tools-core/envelope-bus": "workspace:*", "@kie-tools-examples/ping-pong-view": "workspace:*", "rxjs": "^7.4.0", - "zone.js": "^0.11.4" + "zone.js": "^0.14.8" }, "devDependencies": { - "@angular-devkit/build-angular": "^14.2.0", - "@angular/cli": "^14.2.0", - "@angular/compiler-cli": "^14.2.0", + "@angular-devkit/build-angular": "^18.1.2", + "@angular/cli": "^18.1.2", + "@angular/compiler-cli": "^18.1.2", "@kie-tools/root-env": "workspace:*", "@kie-tools/tsconfig": "workspace:*", "rimraf": "^3.0.2", - "typescript": "^4.6.2" + "typescript": "^5.5.3" } } diff --git a/examples/ping-pong-view-angular/src/app/app.module.ts b/examples/ping-pong-view-angular/src/app/app.module.ts index 30958453afe..adaf4b2e130 100644 --- a/examples/ping-pong-view-angular/src/app/app.module.ts +++ b/examples/ping-pong-view-angular/src/app/app.module.ts @@ -18,14 +18,14 @@ */ import { NgModule } from "@angular/core"; -import { BrowserModule } from "@angular/platform-browser"; import { AppComponent } from "./app.component"; -import { PingPongModule } from "./ping-pong/ping-pong.module"; +import { PingPongComponent } from "./ping-pong/ping-pong.component"; +import { BrowserModule } from "@angular/platform-browser"; @NgModule({ declarations: [AppComponent], - imports: [BrowserModule, PingPongModule], + imports: [BrowserModule, PingPongComponent], providers: [], bootstrap: [AppComponent], }) diff --git a/examples/ping-pong-view-angular/src/app/ping-pong/ping-pong-api.service.ts b/examples/ping-pong-view-angular/src/app/ping-pong/ping-pong-api.service.ts index 6bd34454107..16a10b8c2cb 100644 --- a/examples/ping-pong-view-angular/src/app/ping-pong/ping-pong-api.service.ts +++ b/examples/ping-pong-view-angular/src/app/ping-pong/ping-pong-api.service.ts @@ -41,8 +41,8 @@ function getCurrentTime() { @Injectable() export class PingPongApiService implements PingPongFactory { - channelApi: MessageBusClientApi; - initArgs: PingPongInitArgs; + channelApi?: MessageBusClientApi; + initArgs?: PingPongInitArgs; log = new ReplaySubject(10); logCleared = new Subject(); lastPingTimestamp = new BehaviorSubject(0); @@ -64,7 +64,7 @@ export class PingPongApiService implements PingPongFactory { // Subscribe to ping notifications. this.pingSubscription = this.channelApi.notifications.pingPongView__ping.subscribe((pingSource) => { // If this instance sent the PING, we ignore it. - if (pingSource === this.initArgs.name) { + if (pingSource === initArgs.name) { return; } @@ -72,14 +72,14 @@ export class PingPongApiService implements PingPongFactory { this.log.next({ line: `PING from '${pingSource}'.`, time: getCurrentTime() }); // Acknowledges the PING message by sending back a PONG message. - this.channelApi.notifications.pingPongView__pong.send(this.initArgs.name, pingSource); + channelApi.notifications.pingPongView__pong.send(initArgs.name, pingSource); }); // Subscribe to pong notifications. this.pongSubscription = this.channelApi.notifications.pingPongView__pong.subscribe( (pongSource: string, replyingTo: string) => { // If this instance sent the PONG, or if this PONG was not meant to this instance, we ignore it. - if (pongSource === this.initArgs.name || replyingTo !== this.initArgs.name) { + if (pongSource === initArgs.name || replyingTo !== initArgs.name) { return; } @@ -109,13 +109,17 @@ export class PingPongApiService implements PingPongFactory { // Send a ping to the channel. ping() { - this.channelApi.notifications.pingPongView__ping.send(this.initArgs.name); - this.lastPingTimestamp.next(getCurrentTime()); + if (this.initArgs && this.channelApi) { + this.channelApi.notifications.pingPongView__ping.send(this.initArgs.name); + this.lastPingTimestamp.next(getCurrentTime()); + } } clearSubscriptions() { - this.pingSubscription && this.channelApi.notifications.pingPongView__ping.unsubscribe(this.pingSubscription); - this.pongSubscription && this.channelApi.notifications.pingPongView__pong.unsubscribe(this.pongSubscription); + if (this.channelApi) { + this.pingSubscription && this.channelApi.notifications.pingPongView__ping.unsubscribe(this.pingSubscription); + this.pongSubscription && this.channelApi.notifications.pingPongView__pong.unsubscribe(this.pongSubscription); + } } clearInterval() { diff --git a/examples/ping-pong-view-angular/src/app/ping-pong/ping-pong.component.ts b/examples/ping-pong-view-angular/src/app/ping-pong/ping-pong.component.ts index 5caf488c6a0..e3e871e7313 100644 --- a/examples/ping-pong-view-angular/src/app/ping-pong/ping-pong.component.ts +++ b/examples/ping-pong-view-angular/src/app/ping-pong/ping-pong.component.ts @@ -22,12 +22,15 @@ import { Component, Input, OnInit } from "@angular/core"; import * as PingPongViewEnvelope from "@kie-tools-examples/ping-pong-view/dist/envelope"; import { ContainerType } from "@kie-tools-core/envelope/dist/api"; import { Observable, scan } from "rxjs"; +import { CommonModule } from "@angular/common"; @Component({ + standalone: true, selector: "app-ping-pong", templateUrl: "./ping-pong.component.html", styleUrls: ["./ping-pong.component.css"], providers: [PingPongApiService], + imports: [CommonModule], }) export class PingPongComponent implements OnInit { @Input() containerType: ContainerType; @@ -50,10 +53,10 @@ export class PingPongComponent implements OnInit { config: { containerType: this.containerType, envelopeId: this.envelopeId! }, bus: { postMessage: (message, _targetOrigin, transfer) => window.parent.postMessage(message, "*", transfer) }, pingPongViewFactory: this.pingPongApiService, + }).then(() => { + // Create an observable variable with the 10 latest values of the log. + this.subscribeToLogUpdates(); + this.pingPongApiService.logCleared.subscribe(() => this.subscribeToLogUpdates()); }); - - // Create an observable variable with the 10 latest values of the log. - this.subscribeToLogUpdates(); - this.pingPongApiService.logCleared.subscribe(() => this.subscribeToLogUpdates()); } } diff --git a/examples/ping-pong-view-angular/src/app/web-component/web-component.component.ts b/examples/ping-pong-view-angular/src/app/web-component/web-component.component.ts index d2a0f217e84..4167067fbfd 100644 --- a/examples/ping-pong-view-angular/src/app/web-component/web-component.component.ts +++ b/examples/ping-pong-view-angular/src/app/web-component/web-component.component.ts @@ -19,10 +19,15 @@ import { Component, Input } from "@angular/core"; import { ContainerType } from "@kie-tools-core/envelope/dist/api"; +import { PingPongComponent } from "../ping-pong/ping-pong.component"; +import { PingPongApiService } from "../ping-pong/ping-pong-api.service"; @Component({ + standalone: true, selector: "ping-pong-wc", template: ``, + providers: [PingPongApiService], + imports: [PingPongComponent], }) export class PingPongWcComponent { @Input("containertype") containerType: ContainerType; diff --git a/examples/ping-pong-view-angular/src/app/web-component/web-component.main.ts b/examples/ping-pong-view-angular/src/app/web-component/web-component.main.ts index 07d93f61e9f..ebd2f722a5a 100644 --- a/examples/ping-pong-view-angular/src/app/web-component/web-component.main.ts +++ b/examples/ping-pong-view-angular/src/app/web-component/web-component.main.ts @@ -17,8 +17,16 @@ * under the License. */ -import { WebComponentModule } from "./web-component.module"; -import { platformBrowserDynamic } from "@angular/platform-browser-dynamic"; +import { createApplication } from "@angular/platform-browser"; +import { ApplicationRef } from "@angular/core"; +import { createCustomElement } from "@angular/elements"; +import { PingPongWcComponent } from "./web-component.component"; +import { PingPongApiService } from "../ping-pong/ping-pong-api.service"; -const bootstrap = () => platformBrowserDynamic().bootstrapModule(WebComponentModule); -bootstrap().catch((err) => console.error(err)); +(async () => { + const app: ApplicationRef = await createApplication({ providers: [PingPongApiService] }); + + // Define Web Components + const pingPongWcComponent = createCustomElement(PingPongWcComponent, { injector: app.injector }); + customElements.define("ping-pong-angular", pingPongWcComponent); +})(); diff --git a/examples/ping-pong-view-angular/src/polyfills.ts b/examples/ping-pong-view-angular/src/polyfills.ts index 37e0a2e85a4..4d5100a4a46 100644 --- a/examples/ping-pong-view-angular/src/polyfills.ts +++ b/examples/ping-pong-view-angular/src/polyfills.ts @@ -66,6 +66,11 @@ */ import "zone.js"; // Included with Angular CLI. +// Zone JS messes a different class for promises called __zone_symbol__Promise, +// making `instanceof Promise` conditions fail. +// This makes it so that __zone_symbol__Promise has the same prototype as the native Promise. +Object.setPrototypeOf((window as any).__zone_symbol__Promise.prototype, Promise.prototype); + /*************************************************************************************************** * APPLICATION IMPORTS */ diff --git a/examples/ping-pong-view-angular/tsconfig.json b/examples/ping-pong-view-angular/tsconfig.json index 493f6c76ed8..f5ec373b6cd 100644 --- a/examples/ping-pong-view-angular/tsconfig.json +++ b/examples/ping-pong-view-angular/tsconfig.json @@ -1,9 +1,5 @@ { - "extends": "@kie-tools/tsconfig/tsconfig.json", - "compilerOptions": { - "outDir": "dist", - "moduleResolution": "node" - }, + "extends": "@kie-tools/tsconfig/tsconfig.esm.json", "angularCompilerOptions": { "enableI18nLegacyMessageIdFormat": false, "strictInjectionParameters": true, diff --git a/examples/ping-pong-view-angular/tsconfig.lib.json b/examples/ping-pong-view-angular/tsconfig.lib.json index 71c0fc3fd4b..9961e2184db 100644 --- a/examples/ping-pong-view-angular/tsconfig.lib.json +++ b/examples/ping-pong-view-angular/tsconfig.lib.json @@ -1,7 +1,7 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "outDir": "./dist/wc/lib", + "outDir": "./dist/wc", "types": [] }, "files": ["lib/index.ts"] diff --git a/examples/ping-pong-view-react/README.md b/examples/ping-pong-view-react/README.md index 8dee412811b..92a9cc34192 100644 --- a/examples/ping-pong-view-react/README.md +++ b/examples/ping-pong-view-react/README.md @@ -38,10 +38,6 @@ policy. For example, releases may have incomplete or un-reviewed licensing conditions. What follows is a list of known issues the project is currently aware of (note that this list, by definition, is likely to be incomplete): -- Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 -- Some files, particularly test files, and those not supporting comments, may be missing the ASF Licensing Header -- - - Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 - Some files, particularly test files, and those not supporting comments, may diff --git a/examples/ping-pong-view-react/package.json b/examples/ping-pong-view-react/package.json index cfa87c92e96..9c947ed618b 100644 --- a/examples/ping-pong-view-react/package.json +++ b/examples/ping-pong-view-react/package.json @@ -36,6 +36,6 @@ "@types/react-dom": "^17.0.5", "copyfiles": "^2.4.1", "rimraf": "^3.0.2", - "typescript": "^4.6.2" + "typescript": "^5.5.3" } } diff --git a/examples/ping-pong-view-react/tsconfig.json b/examples/ping-pong-view-react/tsconfig.json index 3855f0f523c..9154a249aa5 100644 --- a/examples/ping-pong-view-react/tsconfig.json +++ b/examples/ping-pong-view-react/tsconfig.json @@ -1,7 +1,6 @@ { - "extends": "@kie-tools/tsconfig/tsconfig.json", + "extends": "@kie-tools/tsconfig/tsconfig.esm.json", "compilerOptions": { - "outDir": "dist" - }, - "include": ["src"] + "jsx": "react-jsx" + } } diff --git a/examples/ping-pong-view/README.md b/examples/ping-pong-view/README.md index beaa755ff48..cd13dbc988b 100644 --- a/examples/ping-pong-view/README.md +++ b/examples/ping-pong-view/README.md @@ -96,10 +96,6 @@ policy. For example, releases may have incomplete or un-reviewed licensing conditions. What follows is a list of known issues the project is currently aware of (note that this list, by definition, is likely to be incomplete): -- Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 -- Some files, particularly test files, and those not supporting comments, may be missing the ASF Licensing Header -- - - Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 - Some files, particularly test files, and those not supporting comments, may diff --git a/examples/ping-pong-view/package.json b/examples/ping-pong-view/package.json index 61994cc04e4..6135eff2325 100644 --- a/examples/ping-pong-view/package.json +++ b/examples/ping-pong-view/package.json @@ -31,6 +31,6 @@ "@types/react": "^17.0.6", "@types/react-dom": "^17.0.5", "rimraf": "^3.0.2", - "typescript": "^4.6.2" + "typescript": "^5.5.3" } } diff --git a/examples/ping-pong-view/tsconfig.json b/examples/ping-pong-view/tsconfig.json index 3855f0f523c..9154a249aa5 100644 --- a/examples/ping-pong-view/tsconfig.json +++ b/examples/ping-pong-view/tsconfig.json @@ -1,7 +1,6 @@ { - "extends": "@kie-tools/tsconfig/tsconfig.json", + "extends": "@kie-tools/tsconfig/tsconfig.esm.json", "compilerOptions": { - "outDir": "dist" - }, - "include": ["src"] + "jsx": "react-jsx" + } } diff --git a/examples/sonataflow-greeting-quarkus-example/README.md b/examples/sonataflow-greeting-quarkus-example/README.md index f6ad33cc050..0355e2a45bd 100644 --- a/examples/sonataflow-greeting-quarkus-example/README.md +++ b/examples/sonataflow-greeting-quarkus-example/README.md @@ -183,10 +183,6 @@ policy. For example, releases may have incomplete or un-reviewed licensing conditions. What follows is a list of known issues the project is currently aware of (note that this list, by definition, is likely to be incomplete): -- Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 -- Some files, particularly test files, and those not supporting comments, may be missing the ASF Licensing Header -- - - Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 - Some files, particularly test files, and those not supporting comments, may diff --git a/examples/todo-list-view-vscode-extension/README.md b/examples/todo-list-view-vscode-extension/README.md index 61b35e68e5f..3bdb42224c2 100644 --- a/examples/todo-list-view-vscode-extension/README.md +++ b/examples/todo-list-view-vscode-extension/README.md @@ -53,10 +53,6 @@ policy. For example, releases may have incomplete or un-reviewed licensing conditions. What follows is a list of known issues the project is currently aware of (note that this list, by definition, is likely to be incomplete): -- Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 -- Some files, particularly test files, and those not supporting comments, may be missing the ASF Licensing Header -- - - Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 - Some files, particularly test files, and those not supporting comments, may diff --git a/examples/todo-list-view-vscode-extension/package.json b/examples/todo-list-view-vscode-extension/package.json index d9a61686ef8..a18638a0fba 100644 --- a/examples/todo-list-view-vscode-extension/package.json +++ b/examples/todo-list-view-vscode-extension/package.json @@ -35,7 +35,7 @@ "@types/vscode": "1.67.0", "@vscode/vsce": "^2.22.0", "rimraf": "^3.0.2", - "typescript": "^4.6.2", + "typescript": "^5.5.3", "webpack": "^5.88.2", "webpack-cli": "^4.10.0", "webpack-dev-server": "^4.15.1", diff --git a/examples/todo-list-view-vscode-extension/tsconfig.json b/examples/todo-list-view-vscode-extension/tsconfig.json index 0f98f743b4d..dbb00d207b5 100644 --- a/examples/todo-list-view-vscode-extension/tsconfig.json +++ b/examples/todo-list-view-vscode-extension/tsconfig.json @@ -1,8 +1,7 @@ { - "extends": "@kie-tools/tsconfig/tsconfig.json", + "extends": "@kie-tools/tsconfig/tsconfig.esm.json", "compilerOptions": { "declaration": false, "declarationMap": false - }, - "include": ["src"] + } } diff --git a/examples/todo-list-view/README.md b/examples/todo-list-view/README.md index 1784914df28..551cb698426 100644 --- a/examples/todo-list-view/README.md +++ b/examples/todo-list-view/README.md @@ -47,10 +47,6 @@ policy. For example, releases may have incomplete or un-reviewed licensing conditions. What follows is a list of known issues the project is currently aware of (note that this list, by definition, is likely to be incomplete): -- Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 -- Some files, particularly test files, and those not supporting comments, may be missing the ASF Licensing Header -- - - Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 - Some files, particularly test files, and those not supporting comments, may diff --git a/examples/todo-list-view/package.json b/examples/todo-list-view/package.json index 39f37962fed..e9e79bfb8f7 100644 --- a/examples/todo-list-view/package.json +++ b/examples/todo-list-view/package.json @@ -34,6 +34,6 @@ "@types/vscode": "1.67.0", "copyfiles": "^2.4.1", "rimraf": "^3.0.2", - "typescript": "^4.6.2" + "typescript": "^5.5.3" } } diff --git a/examples/todo-list-view/tsconfig.json b/examples/todo-list-view/tsconfig.json index 3855f0f523c..9154a249aa5 100644 --- a/examples/todo-list-view/tsconfig.json +++ b/examples/todo-list-view/tsconfig.json @@ -1,7 +1,6 @@ { - "extends": "@kie-tools/tsconfig/tsconfig.json", + "extends": "@kie-tools/tsconfig/tsconfig.esm.json", "compilerOptions": { - "outDir": "dist" - }, - "include": ["src"] + "jsx": "react-jsx" + } } diff --git a/examples/uniforms-patternfly/README.md b/examples/uniforms-patternfly/README.md index e134e8a5b71..738e4f751b4 100644 --- a/examples/uniforms-patternfly/README.md +++ b/examples/uniforms-patternfly/README.md @@ -32,10 +32,6 @@ policy. For example, releases may have incomplete or un-reviewed licensing conditions. What follows is a list of known issues the project is currently aware of (note that this list, by definition, is likely to be incomplete): -- Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 -- Some files, particularly test files, and those not supporting comments, may be missing the ASF Licensing Header -- - - Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 - Some files, particularly test files, and those not supporting comments, may diff --git a/examples/uniforms-patternfly/package.json b/examples/uniforms-patternfly/package.json index 4eb0c0bbcf1..68b1c45581f 100644 --- a/examples/uniforms-patternfly/package.json +++ b/examples/uniforms-patternfly/package.json @@ -35,7 +35,7 @@ "copy-webpack-plugin": "^11.0.0", "react-router-dom": "^5.3.4", "rimraf": "^3.0.2", - "typescript": "^4.6.2", + "typescript": "^5.5.3", "webpack": "^5.88.2", "webpack-cli": "^4.10.0", "webpack-dev-server": "^4.15.1", diff --git a/examples/uniforms-patternfly/tsconfig.json b/examples/uniforms-patternfly/tsconfig.json index 12548a6f436..1b3b39a27fd 100644 --- a/examples/uniforms-patternfly/tsconfig.json +++ b/examples/uniforms-patternfly/tsconfig.json @@ -1,9 +1,8 @@ { - "extends": "@kie-tools/tsconfig/tsconfig.json", + "extends": "@kie-tools/tsconfig/tsconfig.esm.json", "compilerOptions": { "declaration": false, "declarationMap": false, - "moduleResolution": "node", - "target": "es6" + "jsx": "react-jsx" } } diff --git a/examples/webapp/README.md b/examples/webapp/README.md index 5c9f54cf72a..8f76c0719d9 100644 --- a/examples/webapp/README.md +++ b/examples/webapp/README.md @@ -76,10 +76,6 @@ policy. For example, releases may have incomplete or un-reviewed licensing conditions. What follows is a list of known issues the project is currently aware of (note that this list, by definition, is likely to be incomplete): -- Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 -- Some files, particularly test files, and those not supporting comments, may be missing the ASF Licensing Header -- - - Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 - Some files, particularly test files, and those not supporting comments, may diff --git a/examples/webapp/envelope/bpmn-editor.html b/examples/webapp/envelope/bpmn-editor.html new file mode 100644 index 00000000000..1f0536e4180 --- /dev/null +++ b/examples/webapp/envelope/bpmn-editor.html @@ -0,0 +1,45 @@ + + + + + + + + + + + + + +
+ + + diff --git a/examples/webapp/envelope/new-dmn-editor.html b/examples/webapp/envelope/new-dmn-editor.html new file mode 100644 index 00000000000..8fb767f3a41 --- /dev/null +++ b/examples/webapp/envelope/new-dmn-editor.html @@ -0,0 +1,45 @@ + + + + + + + + + + + + + +
+ + + diff --git a/examples/webapp/package.json b/examples/webapp/package.json index 1ab0cb5f76b..0a7d0f55ce0 100644 --- a/examples/webapp/package.json +++ b/examples/webapp/package.json @@ -14,11 +14,15 @@ "@kie-tools-core/envelope-bus": "workspace:*", "@kie-tools-core/monaco-editor": "workspace:*", "@kie-tools-core/patternfly-base": "workspace:*", + "@kie-tools-core/react-hooks": "workspace:*", "@kie-tools-examples/base64png-editor": "workspace:*", "@kie-tools-examples/ping-pong-view": "workspace:*", "@kie-tools-examples/ping-pong-view-angular": "workspace:*", "@kie-tools-examples/ping-pong-view-react": "workspace:*", "@kie-tools-examples/todo-list-view": "workspace:*", + "@kie-tools/dmn-editor": "workspace:*", + "@kie-tools/dmn-editor-envelope": "workspace:*", + "@kie-tools/dmn-editor-standalone": "workspace:*", "@kie-tools/kie-bc-editors": "workspace:*", "@kie-tools/kie-editors-standalone": "workspace:*", "@kie-tools/serverless-workflow-standalone-editor": "workspace:*", @@ -38,9 +42,10 @@ "@types/react-router": "^5.1.20", "@types/react-router-dom": "^5.3.3", "copy-webpack-plugin": "^11.0.0", + "process": "^0.11.10", "react-router-dom": "^5.3.4", "rimraf": "^3.0.2", - "typescript": "^4.6.2", + "typescript": "^5.5.3", "webpack": "^5.88.2", "webpack-cli": "^4.10.0", "webpack-dev-server": "^4.15.1", diff --git a/examples/webapp/src/App.tsx b/examples/webapp/src/App.tsx index c53c9f3adc5..6b652416ede 100644 --- a/examples/webapp/src/App.tsx +++ b/examples/webapp/src/App.tsx @@ -33,16 +33,19 @@ import { PingPongReactDivViewsPage } from "./Pages/PingPong/React/PingPongReactD import { Home } from "./Home"; import "../static/resources/styles.css"; import { DmnStandaloneEditorPage } from "./Pages/StandaloneEditors/DmnStandaloneEditorPage"; +import { NewDmnStandaloneEditorPage } from "./Pages/StandaloneEditors/NewDmnStandaloneEditorPage"; import { SwfStandaloneEditorPage } from "./Pages/StandaloneEditors/SwfStandaloneEditorPage"; import { PingPongAngularIFrameViewsPage } from "./Pages/PingPong/Angular/PingPongAngularIFrameViewsPage"; import { PingPongMixedViewsPage } from "./Pages/PingPong/Mixed/PingPongMixedViewsPage"; import { PingPongAngularDivViewsPage } from "./Pages/PingPong/Angular/PingPongAngularDivViewsPage"; import { SwfStandaloneDiagramOnlyEditorPage } from "./Pages/StandaloneEditors/SwfStandaloneDiagramOnlyEditorPage"; import { SwfStandaloneTextOnlyEditorPage } from "./Pages/StandaloneEditors/SwfStandaloneTextOnlyEditorPage"; +import { NewDmnPage } from "./Pages/KogitoEditors/NewDmnPage"; enum Location { BPMN = "/editor/bpmn", DMN = "/editor/dmn", + NEW_DMN = "/editor/new-dmn", BASE46PNG = "/editor/base64png", TODO_LIST = "/page/todo-list", PING_PONG_REACT_IFRAME_PAGES = "/page/ping-pong-react/iframe-pages", @@ -51,6 +54,7 @@ enum Location { PING_PONG_ANGULAR_DIV_PAGES = "/page/ping-pong-angular/div-pages", PING_PONG_MIXED_PAGES = "/page/ping-pong-mixed", DMN_STANDALONE_EDITOR = "/page/dmn-standalone-editor", + NEW_DMN_STANDALONE_EDITOR = "/page/new-dmn-standalone-editor", SWF_STANDALONE_EDITOR = "/page/swf-standalone-editor", SWF_STANDALONE_EDITOR_DIAGRAM_ONLY = "/page/swf-standalone-editor-diagram-only", SWF_STANDALONE_EDITOR_TEXT_ONLY = "/page/swf-standalone-editor-text-only", @@ -91,6 +95,9 @@ export function App() { DMN Editor + + New DMN Editor + 'To do' list View @@ -130,6 +137,12 @@ export function App() { > DMN Standalone Editor + + New DMN Standalone Editor + + + + @@ -188,6 +204,9 @@ export function App() { + + + diff --git a/examples/webapp/src/Pages/KogitoEditors/BpmnPage.tsx b/examples/webapp/src/Pages/KogitoEditors/BpmnPage.tsx index 0c4e88f41b9..2c1fe48431c 100644 --- a/examples/webapp/src/Pages/KogitoEditors/BpmnPage.tsx +++ b/examples/webapp/src/Pages/KogitoEditors/BpmnPage.tsx @@ -26,9 +26,6 @@ import { EmbeddedEditor, useEditorRef } from "@kie-tools-core/editor/dist/embedd import { EmbeddedEditorFile } from "@kie-tools-core/editor/dist/channel"; import { Sidebar } from "./Sidebar"; -/** - * @constructor - */ export function BpmnPage() { /** * The reference of the Editor. It allows us to access/modify the Editor properties imperatively. @@ -56,11 +53,8 @@ export function BpmnPage() { new EnvelopeMapping({ type: "bpmn", filePathGlob: "**/*.bpmn?(2)", - resourcesPathPrefix: "https://apache.github.io/incubator-kie-kogito-online/editors/latest/bpmn", - envelopeContent: { - type: EnvelopeContentType.PATH, - path: "https://apache.github.io/incubator-kie-kogito-online/bpmn-envelope.html", - }, + resourcesPathPrefix: "../bpmn-editor/bpmn/", + envelopeContent: { type: EnvelopeContentType.PATH, path: "envelope/bpmn-editor.html" }, }), ]); }, []); diff --git a/examples/webapp/src/Pages/KogitoEditors/NewDmnPage.tsx b/examples/webapp/src/Pages/KogitoEditors/NewDmnPage.tsx new file mode 100644 index 00000000000..110ce017ed4 --- /dev/null +++ b/examples/webapp/src/Pages/KogitoEditors/NewDmnPage.tsx @@ -0,0 +1,83 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { ChannelType, EnvelopeContentType } from "@kie-tools-core/editor/dist/api"; +import * as React from "react"; +import { EditorEnvelopeLocator, EnvelopeMapping } from "@kie-tools-core/editor/dist/api"; +import { useMemo, useState } from "react"; +import { Page } from "@patternfly/react-core/dist/js/components/Page"; +import { EmbeddedEditor, useEditorRef } from "@kie-tools-core/editor/dist/embedded"; +import { EmbeddedEditorFile } from "@kie-tools-core/editor/dist/channel"; +import { Sidebar } from "./Sidebar"; + +export function NewDmnPage() { + /** + * The reference of the Editor. It allows us to access/modify the Editor properties imperatively. + */ + const { editor, editorRef } = useEditorRef(); + + /** + * State that handles the file. It's important to type with the File type of the @kie-tools/dist/embedded. + * It's initialized with an empty file with the dmn extension. The file is used by the EmbeddedEditor to set the content on the Editor. Updating the file will trigger a re-render on the Editor because the EmbeddedEditor will set updated content on the Editor. + */ + const [file, setFile] = useState({ + fileName: "new-file", + fileExtension: "dmn", + getFileContents: () => Promise.resolve(""), + isReadOnly: false, + normalizedPosixPathRelativeToTheWorkspaceRoot: "new-file.dmn", + }); + + /** + * The Editor envelope locator informs the EmbeddedEditor what file extension the Editor can open, and it maps to the respective envelope path and the Editor resources (like CSS, icons, etc). + * On this example, we're using a local envelope. To do this, it's necessary to copy the files from the @kie-tools/kie-bc-editors-unpacked on the webpack.config + */ + const editorEnvelopeLocator: EditorEnvelopeLocator = useMemo(() => { + return new EditorEnvelopeLocator(window.location.origin, [ + new EnvelopeMapping({ + type: "dmn", + filePathGlob: "**/*.dmn", + resourcesPathPrefix: "../new-dmn-editor/dmn/", + envelopeContent: { type: EnvelopeContentType.PATH, path: "envelope/new-dmn-editor.html" }, + }), + ]); + }, []); + + return ( + +
+ + +
+
+ ); +} diff --git a/examples/webapp/src/Pages/StandaloneEditors/NewDmnStandaloneEditorPage.tsx b/examples/webapp/src/Pages/StandaloneEditors/NewDmnStandaloneEditorPage.tsx new file mode 100644 index 00000000000..37ef2b81f12 --- /dev/null +++ b/examples/webapp/src/Pages/StandaloneEditors/NewDmnStandaloneEditorPage.tsx @@ -0,0 +1,100 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import * as React from "react"; +import { useCallback, useRef } from "react"; +import { Page } from "@patternfly/react-core/dist/js/components/Page"; +import { useCancelableEffect } from "@kie-tools-core/react-hooks/dist/useCancelableEffect"; +import * as NewDmnEditor from "@kie-tools/dmn-editor-standalone/dist"; + +export function NewDmnStandaloneEditorPage() { + const dmnEditorContainer = useRef(null); + const unsavedChanges = useRef(null); + const undo = useRef(null); + const redo = useRef(null); + const download = useRef(null); + const downloadSvg = useRef(null); + + useCancelableEffect( + useCallback(({ canceled }) => { + if (canceled.get()) { + return; + } + const editor = NewDmnEditor.open({ + container: dmnEditorContainer.current!, + initialContent: Promise.resolve(""), + readOnly: false, + }); + + undo.current?.addEventListener("click", () => { + editor.undo(); + }); + + redo.current?.addEventListener("click", () => { + editor.redo(); + }); + + download.current?.addEventListener("click", () => { + editor.getContent().then((content) => { + const elem = window.document.createElement("a"); + elem.href = "data:text/plain;charset=utf-8," + encodeURIComponent(content); + elem.download = "model.dmn"; + document.body.appendChild(elem); + elem.click(); + document.body.removeChild(elem); + editor.markAsSaved(); + }); + }); + + downloadSvg.current?.addEventListener("click", () => { + editor.getPreview().then((svgContent) => { + const elem = window.document.createElement("a"); + elem.href = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(svgContent!); + elem.download = "model.svg"; + document.body.appendChild(elem); + elem.click(); + document.body.removeChild(elem); + }); + }); + + editor.subscribeToContentChanges((isDirty) => { + if (isDirty) { + unsavedChanges.current!.style.display = ""; + } else { + unsavedChanges.current!.style.display = "none"; + } + }); + }, []) + ); + + return ( + +
+ + + + + + File contains unsaved changes. + +
+
+ + ); +} diff --git a/examples/webapp/src/Pages/StandaloneEditors/SwfEditorEmptyState.tsx b/examples/webapp/src/Pages/StandaloneEditors/SwfEditorEmptyState.tsx index bf8d2c3f09c..185956d222b 100644 --- a/examples/webapp/src/Pages/StandaloneEditors/SwfEditorEmptyState.tsx +++ b/examples/webapp/src/Pages/StandaloneEditors/SwfEditorEmptyState.tsx @@ -17,6 +17,7 @@ * under the License. */ +import * as React from "react"; import { Button } from "@patternfly/react-core/dist/js/components/Button"; import { EmptyState, diff --git a/examples/webapp/src/Pages/StandaloneEditors/SwfStandaloneEditorPage.tsx b/examples/webapp/src/Pages/StandaloneEditors/SwfStandaloneEditorPage.tsx index a1b14cbc74f..b4e265bf316 100644 --- a/examples/webapp/src/Pages/StandaloneEditors/SwfStandaloneEditorPage.tsx +++ b/examples/webapp/src/Pages/StandaloneEditors/SwfStandaloneEditorPage.tsx @@ -20,7 +20,6 @@ import * as React from "react"; import { useEffect, useRef, useState, useCallback } from "react"; import { Page, PageSection } from "@patternfly/react-core/dist/js/components/Page"; -import * as SwfEditor from "@kie-tools/serverless-workflow-standalone-editor/dist/swf"; import { ServerlessWorkflowEmptyState } from "./SwfEditorEmptyState"; import { StandaloneEditorApi, @@ -41,26 +40,30 @@ export const SwfStandaloneEditorPage = () => { const match = /\.sw\.(json|yaml|yml)$/.exec(normalizedPosixPathRelativeToTheWorkspaceRoot.toLowerCase()); const extension = match ? match[1] : extname(normalizedPosixPathRelativeToTheWorkspaceRoot); - const editorApi = SwfEditor.open({ - container: swfEditorContainer.current!, - initialContent: Promise.resolve(content), - readOnly: false, - languageType: extension as ServerlessWorkflowType, + import("@kie-tools/serverless-workflow-standalone-editor/dist/swf").then((swfEditor) => { + const editorApi = swfEditor.open({ + container: swfEditorContainer.current!, + initialContent: Promise.resolve(content), + readOnly: false, + languageType: extension as ServerlessWorkflowType, + }); + setWorkflowType(extension as ServerlessWorkflowType); + setEditor(editorApi); }); - setWorkflowType(extension as ServerlessWorkflowType); - setEditor(editorApi); }, []); const onNewContent = useCallback((serverlessWorkflowType: ServerlessWorkflowType) => { - const editorApi = SwfEditor.open({ - container: swfEditorContainer.current!, - initialContent: Promise.resolve(""), - readOnly: false, - languageType: serverlessWorkflowType, - swfPreviewOptions: { editorMode: "full", defaultWidth: "50%" }, + import("@kie-tools/serverless-workflow-standalone-editor/dist/swf").then((swfEditor) => { + const editorApi = swfEditor.open({ + container: swfEditorContainer.current!, + initialContent: Promise.resolve(""), + readOnly: false, + languageType: serverlessWorkflowType, + swfPreviewOptions: { editorMode: "full", defaultWidth: "50%" }, + }); + setWorkflowType(serverlessWorkflowType as ServerlessWorkflowType); + setEditor(editorApi); }); - setWorkflowType(serverlessWorkflowType as ServerlessWorkflowType); - setEditor(editorApi); }, []); useEffect(() => { diff --git a/examples/webapp/src/Pages/StandaloneEditors/SwfStandaloneTextOnlyEditorPage.tsx b/examples/webapp/src/Pages/StandaloneEditors/SwfStandaloneTextOnlyEditorPage.tsx index 4eded31ef37..763d7d7ff58 100644 --- a/examples/webapp/src/Pages/StandaloneEditors/SwfStandaloneTextOnlyEditorPage.tsx +++ b/examples/webapp/src/Pages/StandaloneEditors/SwfStandaloneTextOnlyEditorPage.tsx @@ -20,7 +20,6 @@ import * as React from "react"; import { useEffect, useRef, useState, useCallback } from "react"; import { Page, PageSection } from "@patternfly/react-core/dist/js/components/Page"; -import * as SwfEditor from "@kie-tools/serverless-workflow-standalone-editor/dist/swf"; import { ServerlessWorkflowEmptyState } from "./SwfEditorEmptyState"; import { StandaloneEditorApi, @@ -41,26 +40,30 @@ export const SwfStandaloneTextOnlyEditorPage = () => { const match = /\.sw\.(json|yaml|yml)$/.exec(normalizedPosixPathRelativeToTheWorkspaceRoot.toLowerCase()); const extension = match ? match[1] : extname(normalizedPosixPathRelativeToTheWorkspaceRoot); - const editorApi = SwfEditor.open({ - container: swfEditorContainer.current!, - initialContent: Promise.resolve(content), - readOnly: false, - languageType: extension as ServerlessWorkflowType, - swfPreviewOptions: { editorMode: "text", defaultWidth: "100%" }, + import("@kie-tools/serverless-workflow-standalone-editor/dist/swf").then((swfEditor) => { + const editorApi = swfEditor.open({ + container: swfEditorContainer.current!, + initialContent: Promise.resolve(content), + readOnly: false, + languageType: extension as ServerlessWorkflowType, + swfPreviewOptions: { editorMode: "text", defaultWidth: "100%" }, + }); + setWorkflowType(extension as ServerlessWorkflowType); + setEditor(editorApi); }); - setWorkflowType(extension as ServerlessWorkflowType); - setEditor(editorApi); }, []); const onNewContent = useCallback((serverlessWorkflowType: ServerlessWorkflowType) => { - const editorApi = SwfEditor.open({ - container: swfEditorContainer.current!, - initialContent: Promise.resolve(""), - readOnly: false, - languageType: serverlessWorkflowType, + import("@kie-tools/serverless-workflow-standalone-editor/dist/swf").then((swfEditor) => { + const editorApi = swfEditor.open({ + container: swfEditorContainer.current!, + initialContent: Promise.resolve(""), + readOnly: false, + languageType: serverlessWorkflowType, + }); + setWorkflowType(serverlessWorkflowType as ServerlessWorkflowType); + setEditor(editorApi); }); - setWorkflowType(serverlessWorkflowType as ServerlessWorkflowType); - setEditor(editorApi); }, []); useEffect(() => { diff --git a/examples/webapp/src/envelope/bpmn-editor.ts b/examples/webapp/src/envelope/bpmn-editor.ts new file mode 100644 index 00000000000..0d9d18727fa --- /dev/null +++ b/examples/webapp/src/envelope/bpmn-editor.ts @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { BpmnEditorChannelApi, BpmnEditorEnvelopeApi } from "@kie-tools/kie-bc-editors/dist/bpmn/api"; +import { BpmnEditor, BpmnEditorEnvelopeApiImpl } from "@kie-tools/kie-bc-editors/dist/bpmn/envelope"; +import * as EditorEnvelope from "@kie-tools-core/editor/dist/envelope"; + +EditorEnvelope.initCustom({ + container: document.getElementById("envelope-app")!, + bus: { postMessage: (message, targetOrigin, _) => window.parent.postMessage(message, "*", _) }, + apiImplFactory: { create: (args) => new BpmnEditorEnvelopeApiImpl(args, { shouldLoadResourcesDynamically: true }) }, +}); diff --git a/packages/sonataflow-operator/bddframework/pkg/api/runtimetype.go b/examples/webapp/src/envelope/new-dmn-editor.ts similarity index 63% rename from packages/sonataflow-operator/bddframework/pkg/api/runtimetype.go rename to examples/webapp/src/envelope/new-dmn-editor.ts index b47223ad053..916bf119dca 100644 --- a/packages/sonataflow-operator/bddframework/pkg/api/runtimetype.go +++ b/examples/webapp/src/envelope/new-dmn-editor.ts @@ -7,7 +7,7 @@ * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an @@ -17,14 +17,11 @@ * under the License. */ -package api +import * as EditorEnvelope from "@kie-tools-core/editor/dist/envelope"; +import { DmnEditorFactory } from "@kie-tools/dmn-editor-envelope/dist/DmnEditorFactory"; -// RuntimeType - type of condition. -type RuntimeType string - -const ( - // QuarkusRuntimeType Runtime for quarkus application - QuarkusRuntimeType RuntimeType = "quarkus" - // SpringBootRuntimeType Runtime for springboot application - SpringBootRuntimeType RuntimeType = "springboot" -) +EditorEnvelope.init({ + container: document.getElementById("envelope-app")!, + bus: { postMessage: (message, targetOrigin, transfer) => window.parent.postMessage(message, "*", transfer) }, + editorFactory: new DmnEditorFactory(), +}); diff --git a/examples/webapp/tsconfig.json b/examples/webapp/tsconfig.json index 8d096db6c54..1b3b39a27fd 100644 --- a/examples/webapp/tsconfig.json +++ b/examples/webapp/tsconfig.json @@ -1,7 +1,8 @@ { - "extends": "@kie-tools/tsconfig/tsconfig.json", + "extends": "@kie-tools/tsconfig/tsconfig.esm.json", "compilerOptions": { "declaration": false, - "declarationMap": false + "declarationMap": false, + "jsx": "react-jsx" } } diff --git a/examples/webapp/webpack.config.js b/examples/webapp/webpack.config.js index 90d3b0cfaea..0d146655c2b 100644 --- a/examples/webapp/webpack.config.js +++ b/examples/webapp/webpack.config.js @@ -18,6 +18,7 @@ */ const path = require("path"); +const { ProvidePlugin } = require("webpack"); const CopyPlugin = require("copy-webpack-plugin"); const patternflyBase = require("@kie-tools-core/patternfly-base"); const common = require("@kie-tools-core/webpack-base/webpack.common.config"); @@ -32,6 +33,8 @@ module.exports = (env) => [ index: "./src/index.tsx", "envelope/base64-editor": "./src/envelope/base64-editor.ts", "envelope/dmn-editor": "./src/envelope/dmn-editor.ts", + "envelope/bpmn-editor": "./src/envelope/bpmn-editor.ts", + "envelope/new-dmn-editor": "./src/envelope/new-dmn-editor.ts", "envelope/ping-pong-view-react-impl": "./src/envelope/ping-pong-view-react-impl.ts", "envelope/todo-list-view": "./src/envelope/todo-list-view.ts", }, @@ -48,8 +51,22 @@ module.exports = (env) => [ { from: "./static", to: "." }, { from: "../ping-pong-view-angular/dist/app", to: "./envelope/angular" }, { from: stunnerEditors.dmnEditorPath(), to: "./dmn-editor/dmn", globOptions: { ignore: ["WEB-INF/**/*"] } }, + { + from: stunnerEditors.bpmnEditorPath(), + to: "./bpmn-editor/bpmn", + globOptions: { ignore: ["WEB-INF/**/*"] }, + }, + { + from: `${path.dirname(require.resolve("@kie-tools/dmn-editor/package.json"))}/dist`, + to: "./new-dmn-editor/dmn", + globOptions: { ignore: ["WEB-INF/**/*"] }, + }, ], }), + new ProvidePlugin({ + process: require.resolve("process/browser.js"), + Buffer: ["buffer", "Buffer"], + }), ], devServer: { historyApiFallback: false, diff --git a/packages/backend/README.md b/packages/backend/README.md index f40e7e8f5fd..0a65c0e8f01 100644 --- a/packages/backend/README.md +++ b/packages/backend/README.md @@ -32,10 +32,6 @@ policy. For example, releases may have incomplete or un-reviewed licensing conditions. What follows is a list of known issues the project is currently aware of (note that this list, by definition, is likely to be incomplete): -- Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 -- Some files, particularly test files, and those not supporting comments, may be missing the ASF Licensing Header -- - - Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 - Some files, particularly test files, and those not supporting comments, may diff --git a/packages/backend/jest.config.js b/packages/backend/jest.config.js index 060be79621a..e26a965fbbf 100644 --- a/packages/backend/jest.config.js +++ b/packages/backend/jest.config.js @@ -17,10 +17,13 @@ * under the License. */ -const { config } = require("@kie-tools/jest-base/jest.config"); +const { config, typescriptTransform } = require("@kie-tools/jest-base/jest.config"); /** @type {import('ts-jest').JestConfigWithTsJest} */ module.exports = { ...config, testEnvironment: "node", + transform: { + ...typescriptTransform, + }, }; diff --git a/packages/backend/package.json b/packages/backend/package.json index 2345f45f31a..6ea0e377b44 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -27,7 +27,7 @@ "@kie-tools-core/notifications": "workspace:*", "@kie-tools-core/workspace": "workspace:*", "axios": "^1.6.8", - "fast-xml-parser": "^4.3.1", + "fast-xml-parser": "^4.4.1", "portfinder": "^1.0.32", "semver": "^7.5.4", "sinon": "^11.1.1" @@ -51,6 +51,6 @@ "rimraf": "^3.0.2", "stream": "^0.0.2", "ts-jest": "^29.1.5", - "typescript": "^4.6.2" + "typescript": "^5.5.3" } } diff --git a/packages/backend/tsconfig.json b/packages/backend/tsconfig.json index 3855f0f523c..a0f97e68c47 100644 --- a/packages/backend/tsconfig.json +++ b/packages/backend/tsconfig.json @@ -1,7 +1,3 @@ { - "extends": "@kie-tools/tsconfig/tsconfig.json", - "compilerOptions": { - "outDir": "dist" - }, - "include": ["src"] + "extends": "@kie-tools/tsconfig/tsconfig.cjs.json" } diff --git a/packages/backend/tsconfig.tests.json b/packages/backend/tsconfig.tests.json new file mode 100644 index 00000000000..fc8520e7376 --- /dev/null +++ b/packages/backend/tsconfig.tests.json @@ -0,0 +1,3 @@ +{ + "extends": "./tsconfig.json" +} diff --git a/packages/boxed-expression-component/README.md b/packages/boxed-expression-component/README.md index ee770a0e224..a9dc432b9c5 100644 --- a/packages/boxed-expression-component/README.md +++ b/packages/boxed-expression-component/README.md @@ -91,10 +91,6 @@ policy. For example, releases may have incomplete or un-reviewed licensing conditions. What follows is a list of known issues the project is currently aware of (note that this list, by definition, is likely to be incomplete): -- Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 -- Some files, particularly test files, and those not supporting comments, may be missing the ASF Licensing Header -- - - Hibernate, an LGPL project, is being used. Hibernate is in the process of relicensing to ASL v2 - Some files, particularly test files, and those not supporting comments, may diff --git a/packages/boxed-expression-component/jest.config.js b/packages/boxed-expression-component/jest.config.js index db324efb649..64452acceb4 100644 --- a/packages/boxed-expression-component/jest.config.js +++ b/packages/boxed-expression-component/jest.config.js @@ -17,7 +17,13 @@ * under the License. */ -const { config, styleMock, monacoMock, babelTransform } = require("@kie-tools/jest-base/jest.config"); +const { + config, + styleMock, + monacoMock, + babelTransform, + typescriptTransform, +} = require("@kie-tools/jest-base/jest.config"); /** @type {import('ts-jest').JestConfigWithTsJest} */ module.exports = { @@ -29,5 +35,6 @@ module.exports = { }, transform: { ...babelTransform, + ...typescriptTransform, }, }; diff --git a/packages/boxed-expression-component/package.json b/packages/boxed-expression-component/package.json index db8419cd3d0..d17ad505396 100644 --- a/packages/boxed-expression-component/package.json +++ b/packages/boxed-expression-component/package.json @@ -79,7 +79,7 @@ "run-script-os": "^1.1.6", "storybook": "^7.3.2", "ts-jest": "^29.1.5", - "typescript": "^4.6.2", + "typescript": "^5.5.3", "webpack": "^5.88.2", "webpack-cli": "^4.10.0", "webpack-dev-server": "^4.15.1", diff --git a/packages/boxed-expression-component/src/BoxedExpressionEditor.tsx b/packages/boxed-expression-component/src/BoxedExpressionEditor.tsx index 29c524e421c..24034cc378b 100644 --- a/packages/boxed-expression-component/src/BoxedExpressionEditor.tsx +++ b/packages/boxed-expression-component/src/BoxedExpressionEditor.tsx @@ -20,7 +20,7 @@ import "@patternfly/react-styles/css/components/Drawer/drawer.css"; import { I18nDictionariesProvider } from "@kie-tools-core/i18n/dist/react-components"; import * as React from "react"; -import { BeeGwtService, BoxedExpression, DmnDataType, PmmlDocument } from "./api"; +import { BeeGwtService, BoxedExpression, DmnDataType, Normalized, PmmlDocument } from "./api"; import { boxedExpressionEditorDictionaries, BoxedExpressionEditorI18nContext, @@ -44,9 +44,9 @@ export interface BoxedExpressionEditorProps { /** TypeRef of the Decision or BKM containing `expression` */ expressionHolderTypeRef: string | undefined; /** The boxed expression itself */ - expression: BoxedExpression | undefined; + expression: Normalized | undefined; /** Called every time something changes on the expression */ - onExpressionChange: React.Dispatch>; + onExpressionChange: React.Dispatch | undefined>>; /** KIE Extension to represent IDs of individual columns or expressions */ widthsById: Map; /** Called every time a width changes on the expression */ diff --git a/packages/boxed-expression-component/src/BoxedExpressionEditorContext.tsx b/packages/boxed-expression-component/src/BoxedExpressionEditorContext.tsx index f7ad8ac3ead..3260a7ae14c 100644 --- a/packages/boxed-expression-component/src/BoxedExpressionEditorContext.tsx +++ b/packages/boxed-expression-component/src/BoxedExpressionEditorContext.tsx @@ -18,9 +18,8 @@ */ import * as React from "react"; -import { useContext, useMemo } from "react"; -import { BeeGwtService, DmnDataType, BoxedExpression, PmmlDocument } from "./api"; -import { useRef, useState } from "react"; +import { useContext, useMemo, useRef, useState } from "react"; +import { BeeGwtService, BoxedExpression, DmnDataType, Normalized, PmmlDocument } from "./api"; import { BoxedExpressionEditorProps, OnRequestFeelVariables } from "./BoxedExpressionEditor"; import "./BoxedExpressionEditorContext.css"; @@ -45,7 +44,7 @@ export interface BoxedExpressionEditorContextType { } export interface BoxedExpressionEditorDispatchContextType { - setExpression: React.Dispatch>; + setExpression: React.Dispatch>>; setWidthsById: (mutation: ({ newMap }: { newMap: Map }) => void) => void; } @@ -131,7 +130,7 @@ export function BoxedExpressionEditorContextProvider({ } export type OnSetExpression = (args: { - getNewExpression: (prev: BoxedExpression | undefined) => BoxedExpression | undefined; + getNewExpression: (prev: Normalized | undefined) => Normalized | undefined; }) => void; export function NestedExpressionDispatchContextProvider({ @@ -143,8 +142,8 @@ export function NestedExpressionDispatchContextProvider({ const { setWidthsById } = useBoxedExpressionEditorDispatch(); const nestedExpressionDispatch = useMemo(() => { return { - setExpression: (newExpressionAction: React.SetStateAction) => { - function getNewExpression(prev: BoxedExpression) { + setExpression: (newExpressionAction: React.SetStateAction>) => { + function getNewExpression(prev: Normalized) { return typeof newExpressionAction === "function" ? newExpressionAction(prev) : newExpressionAction; } diff --git a/packages/boxed-expression-component/src/api/BeeGwtService.ts b/packages/boxed-expression-component/src/api/BeeGwtService.ts index 8a6b6b18762..1f295ccbcb5 100644 --- a/packages/boxed-expression-component/src/api/BeeGwtService.ts +++ b/packages/boxed-expression-component/src/api/BeeGwtService.ts @@ -17,7 +17,7 @@ * under the License. */ -import { BoxedExpression } from "./BoxedExpression"; +import { BoxedExpression, Normalized } from "./BoxedExpression"; /** * This interface defines all the API methods which BoxedExpressionEditor component can use to dialog with GWT Layer @@ -27,7 +27,7 @@ export interface BeeGwtService { logicType: BoxedExpression["__$$element"] | undefined, typeRef: string | undefined, isRoot?: boolean - ): { expression: BoxedExpression; widthsById: Map }; + ): { expression: Normalized; widthsById: Map }; openDataTypePage: () => void; // Just open the data types tab diff --git a/packages/boxed-expression-component/src/api/BoxedExpression.ts b/packages/boxed-expression-component/src/api/BoxedExpression.ts index f9e0239d4c6..1cb0e8aa9e1 100644 --- a/packages/boxed-expression-component/src/api/BoxedExpression.ts +++ b/packages/boxed-expression-component/src/api/BoxedExpression.ts @@ -51,6 +51,16 @@ export enum BoxedFunctionKind { Pmml = "PMML", } +export type Normalized = WithRequiredDeep; + +type WithRequiredDeep = T extends undefined + ? T + : T extends Array + ? Array> + : { [P in keyof T]: WithRequiredDeep } & (K extends keyof T + ? { [P in K]-?: NonNullable> } + : T); + export type BoxedIterator = BoxedFor | BoxedEvery | BoxedSome; export type BoxedExpression = diff --git a/packages/boxed-expression-component/src/clipboard/clipboard.ts b/packages/boxed-expression-component/src/clipboard/clipboard.ts index 64ce03bf0bf..9dae07ebdc9 100644 --- a/packages/boxed-expression-component/src/clipboard/clipboard.ts +++ b/packages/boxed-expression-component/src/clipboard/clipboard.ts @@ -17,7 +17,7 @@ * under the License. */ -import { BoxedExpression } from "../api"; +import { BoxedExpression, Normalized } from "../api"; import { findAllIdsDeep } from "../ids/ids"; export const DMN_BOXED_EXPRESSION_CLIPBOARD_MIME_TYPE = @@ -25,12 +25,12 @@ export const DMN_BOXED_EXPRESSION_CLIPBOARD_MIME_TYPE = export type BoxedExpressionClipboard = { mimeType: typeof DMN_BOXED_EXPRESSION_CLIPBOARD_MIME_TYPE; - expression: BoxedExpression; + expression: Normalized; widthsById: Record; }; export function buildClipboardFromExpression( - expression: BoxedExpression, + expression: Normalized, widthsById: Map ): BoxedExpressionClipboard { const originalIds = findAllIdsDeep(expression); diff --git a/packages/boxed-expression-component/src/expressionVariable/DataTypeSelector.tsx b/packages/boxed-expression-component/src/expressionVariable/DataTypeSelector.tsx index 4c33f5b02c1..a8d5910b2af 100644 --- a/packages/boxed-expression-component/src/expressionVariable/DataTypeSelector.tsx +++ b/packages/boxed-expression-component/src/expressionVariable/DataTypeSelector.tsx @@ -150,7 +150,7 @@ export const DataTypeSelector: React.FunctionComponent = return DEFAULT_SELECT_DATA_TYPE_MENU_HEIGHT; }, [boundingClientRect]); return ( -
+