diff --git a/.github/workflows/check-projects.yml b/.github/workflows/check-projects.yml index c6fd76da..ead80d69 100644 --- a/.github/workflows/check-projects.yml +++ b/.github/workflows/check-projects.yml @@ -44,6 +44,7 @@ jobs: project: - javascript-vanilla-with-webpack - typescript-angular + - typescript-lit-element - typescript-vanilla-with-parcel - typescript-vanilla-with-rollup - typescript-vanilla-with-vitejs diff --git a/README.md b/README.md index a902c1c5..3985e3be 100644 --- a/README.md +++ b/README.md @@ -155,6 +155,7 @@ Custom BPMN Theme features will be progressively added to `bpmn-visualization`. Show how to integrate `bpmn-visualization` in project, using various kind of frameworks, build tools and bundlers: - [JavaScript + Webpack](projects/javascript-vanilla-with-webpack/README.md) - integration in a vanilla JavaScript Webpack project - [TypeScript + Angular](projects/typescript-angular/README.md) - integration in a TypeScript Angular project +- [TypeScript + Lit Element](projects/typescript-lit-element/README.md) - integration in a TypeScript Lit-Element project - [TypeScript + Parcel](projects/typescript-vanilla-with-parcel/README.md) - integration in a vanilla TypeScript Parcel project - [TypeScript + Rollup](projects/typescript-vanilla-with-rollup/README.md) - integration in a vanilla TypeScript Rollup project - [TypeScript + Vite](projects/typescript-vanilla-with-vitejs/README.md) - integration in a vanilla TypeScript Vite project diff --git a/projects/typescript-lit-element/.gitignore b/projects/typescript-lit-element/.gitignore new file mode 100644 index 00000000..2107e24e --- /dev/null +++ b/projects/typescript-lit-element/.gitignore @@ -0,0 +1,25 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +package-lock.json +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/projects/typescript-lit-element/.npmrc b/projects/typescript-lit-element/.npmrc new file mode 100644 index 00000000..cafe685a --- /dev/null +++ b/projects/typescript-lit-element/.npmrc @@ -0,0 +1 @@ +package-lock=true diff --git a/projects/typescript-lit-element/README.md b/projects/typescript-lit-element/README.md new file mode 100644 index 00000000..48bdc33c --- /dev/null +++ b/projects/typescript-lit-element/README.md @@ -0,0 +1,24 @@ +# Integrate `bpmn-visualization` in a lit-element TypeScript project built with Vite + +To run locally: + +1. `npm install` +2. `npm start` +3. [localhost app](http://localhost:5173) + +You will see the following diagram: + +![BPMN diagram in the home page](docs/home.png) + +The code calling `bpmn-visualization` to render the BPMN diagram is available in [index.ts](src/index.ts). + +If you want to bundle the application, run `npm run build` and then run `npm run preview` to access to a preview of the +bundle application with http://localhost:4173. + +## Specific mxGraph patch to make it work + +To workaround bug [#2738](https://github.com/process-analytics/bpmn-visualization-js/issues/2738) "[BUG] Failed to execute 'getComputedStyle' when using lit", +`mxGraph` is patched using [patch-package](https://www.npmjs.com/package/patch-package) as the root cause of the bug is an issue in the `mxGraph` code. + +The patch has been created by modifying manually `node_modules/mxgraph/javascript/dist/build.js` +and then running: `npx patch-package mxgraph` diff --git a/projects/typescript-lit-element/docs/home.png b/projects/typescript-lit-element/docs/home.png new file mode 100644 index 00000000..09078245 Binary files /dev/null and b/projects/typescript-lit-element/docs/home.png differ diff --git a/projects/typescript-lit-element/favicon.svg b/projects/typescript-lit-element/favicon.svg new file mode 100644 index 00000000..537e9be6 --- /dev/null +++ b/projects/typescript-lit-element/favicon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/projects/typescript-lit-element/index.html b/projects/typescript-lit-element/index.html new file mode 100644 index 00000000..f9286245 --- /dev/null +++ b/projects/typescript-lit-element/index.html @@ -0,0 +1,15 @@ + + + + + + + bpmn-visualization TypeScript Integration with lit-element + + + +

bpmn-visualization TypeScript Integration with lit-element

+ + + + diff --git a/projects/typescript-lit-element/package-lock.json b/projects/typescript-lit-element/package-lock.json new file mode 100644 index 00000000..1b318e38 --- /dev/null +++ b/projects/typescript-lit-element/package-lock.json @@ -0,0 +1,781 @@ +{ + "name": "bpmn-visualization-lit-element-ts-vite", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "bpmn-visualization-lit-element-ts-vite", + "version": "0.0.0", + "license": "Apache-2.0", + "dependencies": { + "bpmn-visualization": "0.36.0", + "lit": "~2.7.5" + }, + "devDependencies": { + "patch-package": "~7.0.0", + "typescript": "~4.1.3", + "vite": "~4.3.9" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.17.19", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@lit-labs/ssr-dom-shim": { + "version": "1.1.1", + "license": "BSD-3-Clause" + }, + "node_modules/@lit/reactive-element": { + "version": "1.6.2", + "license": "BSD-3-Clause", + "dependencies": { + "@lit-labs/ssr-dom-shim": "^1.0.0" + } + }, + "node_modules/@typed-mxgraph/typed-mxgraph": { + "version": "1.0.8", + "license": "MIT" + }, + "node_modules/@types/trusted-types": { + "version": "2.0.3", + "license": "MIT" + }, + "node_modules/@yarnpkg/lockfile": { + "version": "1.1.0", + "dev": true, + "license": "BSD-2-Clause" + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/at-least-node": { + "version": "1.0.0", + "dev": true, + "license": "ISC", + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "dev": true, + "license": "MIT" + }, + "node_modules/bpmn-visualization": { + "version": "0.36.0", + "resolved": "https://registry.npmjs.org/bpmn-visualization/-/bpmn-visualization-0.36.0.tgz", + "integrity": "sha512-e4lBJyJTU64DadGLKCAU8mlOuVh5hed/YIOmvPxNhEIoCstWOOr6mnnQQ5NT+4MrqLtEGrmMoW4FIvNZHqD9tQ==", + "dependencies": { + "@typed-mxgraph/typed-mxgraph": "~1.0.8", + "fast-xml-parser": "4.2.4", + "lodash-es": "~4.17.21", + "mxgraph": "4.2.2", + "strnum": "1.0.5" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/ci-info": { + "version": "3.8.0", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/esbuild": { + "version": "0.17.19", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/android-arm": "0.17.19", + "@esbuild/android-arm64": "0.17.19", + "@esbuild/android-x64": "0.17.19", + "@esbuild/darwin-arm64": "0.17.19", + "@esbuild/darwin-x64": "0.17.19", + "@esbuild/freebsd-arm64": "0.17.19", + "@esbuild/freebsd-x64": "0.17.19", + "@esbuild/linux-arm": "0.17.19", + "@esbuild/linux-arm64": "0.17.19", + "@esbuild/linux-ia32": "0.17.19", + "@esbuild/linux-loong64": "0.17.19", + "@esbuild/linux-mips64el": "0.17.19", + "@esbuild/linux-ppc64": "0.17.19", + "@esbuild/linux-riscv64": "0.17.19", + "@esbuild/linux-s390x": "0.17.19", + "@esbuild/linux-x64": "0.17.19", + "@esbuild/netbsd-x64": "0.17.19", + "@esbuild/openbsd-x64": "0.17.19", + "@esbuild/sunos-x64": "0.17.19", + "@esbuild/win32-arm64": "0.17.19", + "@esbuild/win32-ia32": "0.17.19", + "@esbuild/win32-x64": "0.17.19" + } + }, + "node_modules/fast-xml-parser": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.2.4.tgz", + "integrity": "sha512-fbfMDvgBNIdDJLdLOwacjFAPYt67tr31H9ZhWSm45CDAxvd0I6WTlSOUo7K2P/K5sA5JgMKG64PI3DMcaFdWpQ==", + "funding": [ + { + "type": "paypal", + "url": "https://paypal.me/naturalintelligence" + }, + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "dependencies": { + "strnum": "^1.0.5" + }, + "bin": { + "fxparser": "src/cli/cli.js" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-yarn-workspace-root": { + "version": "2.0.0", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "micromatch": "^4.0.2" + } + }, + "node_modules/fs-extra": { + "version": "9.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/glob": { + "version": "7.2.3", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "dev": true, + "license": "ISC" + }, + "node_modules/has-flag": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "dev": true, + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "dev": true, + "license": "ISC" + }, + "node_modules/is-docker": { + "version": "2.2.1", + "dev": true, + "license": "MIT", + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-wsl": { + "version": "2.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "is-docker": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/jsonfile": { + "version": "6.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/klaw-sync": { + "version": "6.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.1.11" + } + }, + "node_modules/lit": { + "version": "2.7.5", + "license": "BSD-3-Clause", + "dependencies": { + "@lit/reactive-element": "^1.6.0", + "lit-element": "^3.3.0", + "lit-html": "^2.7.0" + } + }, + "node_modules/lit-element": { + "version": "3.3.2", + "license": "BSD-3-Clause", + "dependencies": { + "@lit-labs/ssr-dom-shim": "^1.1.0", + "@lit/reactive-element": "^1.3.0", + "lit-html": "^2.7.0" + } + }, + "node_modules/lit-html": { + "version": "2.7.4", + "license": "BSD-3-Clause", + "dependencies": { + "@types/trusted-types": "^2.0.2" + } + }, + "node_modules/lodash-es": { + "version": "4.17.21", + "license": "MIT" + }, + "node_modules/micromatch": { + "version": "4.0.5", + "dev": true, + "license": "MIT", + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mxgraph": { + "version": "4.2.2", + "license": "Apache-2.0" + }, + "node_modules/nanoid": { + "version": "3.3.6", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/once": { + "version": "1.4.0", + "dev": true, + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/open": { + "version": "7.4.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-docker": "^2.0.0", + "is-wsl": "^2.1.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/os-tmpdir": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/patch-package": { + "version": "7.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@yarnpkg/lockfile": "^1.1.0", + "chalk": "^4.1.2", + "ci-info": "^3.7.0", + "cross-spawn": "^7.0.3", + "find-yarn-workspace-root": "^2.0.0", + "fs-extra": "^9.0.0", + "klaw-sync": "^6.0.0", + "minimist": "^1.2.6", + "open": "^7.4.2", + "rimraf": "^2.6.3", + "semver": "^5.6.0", + "slash": "^2.0.0", + "tmp": "^0.0.33", + "yaml": "^2.2.2" + }, + "bin": { + "patch-package": "index.js" + }, + "engines": { + "node": ">=14", + "npm": ">5" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/picocolors": { + "version": "1.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.4.24", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.6", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/rimraf": { + "version": "2.7.1", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/rollup": { + "version": "3.24.0", + "dev": true, + "license": "MIT", + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=14.18.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/semver": { + "version": "5.7.1", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/slash": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/source-map-js": { + "version": "1.0.2", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strnum": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/strnum/-/strnum-1.0.5.tgz", + "integrity": "sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==" + }, + "node_modules/supports-color": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/tmp": { + "version": "0.0.33", + "dev": true, + "license": "MIT", + "dependencies": { + "os-tmpdir": "~1.0.2" + }, + "engines": { + "node": ">=0.6.0" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/typescript": { + "version": "4.1.6", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/universalify": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/vite": { + "version": "4.3.9", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.17.5", + "postcss": "^8.4.23", + "rollup": "^3.21.0" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + }, + "peerDependencies": { + "@types/node": ">= 14", + "less": "*", + "sass": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } + } + }, + "node_modules/which": { + "version": "2.0.2", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "dev": true, + "license": "ISC" + }, + "node_modules/yaml": { + "version": "2.3.1", + "dev": true, + "license": "ISC", + "engines": { + "node": ">= 14" + } + } + } +} diff --git a/projects/typescript-lit-element/package.json b/projects/typescript-lit-element/package.json new file mode 100644 index 00000000..9a5e536f --- /dev/null +++ b/projects/typescript-lit-element/package.json @@ -0,0 +1,21 @@ +{ + "name": "bpmn-visualization-lit-element-ts-vite", + "version": "0.0.0", + "private": true, + "license": "Apache-2.0", + "scripts": { + "start": "vite", + "build": "tsc && vite build --base ./", + "preview": "vite preview", + "prepare": "patch-package" + }, + "dependencies": { + "lit": "~2.7.5", + "bpmn-visualization": "0.36.0" + }, + "devDependencies": { + "patch-package": "~7.0.0", + "vite": "~4.3.9", + "typescript": "~4.1.3" + } +} diff --git a/projects/typescript-lit-element/patches/mxgraph+4.2.2.patch b/projects/typescript-lit-element/patches/mxgraph+4.2.2.patch new file mode 100644 index 00000000..c479296d --- /dev/null +++ b/projects/typescript-lit-element/patches/mxgraph+4.2.2.patch @@ -0,0 +1,25 @@ +diff --git a/node_modules/mxgraph/javascript/dist/build.js b/node_modules/mxgraph/javascript/dist/build.js +index 5dabbbf..86fb521 100644 +--- a/node_modules/mxgraph/javascript/dist/build.js ++++ b/node_modules/mxgraph/javascript/dist/build.js +@@ -2441,9 +2441,17 @@ var mxUtils = + { + return function(element) + { +- return (element != null) ? +- window.getComputedStyle(element, '') : +- null; ++ // START Fix for https://github.com/process-analytics/bpmn-visualization-js/issues/2738 ++ if (!element || element.toString() === '[object ShadowRoot]') { ++ return null; ++ } else { ++ return window.getComputedStyle(element, ''); ++ } ++ // original code ++ // return (element != null) ? ++ // window.getComputedStyle(element, '') : ++ // null; ++ // END OF Fix + }; + } + }(), diff --git a/projects/typescript-lit-element/src/diagram.bpmn b/projects/typescript-lit-element/src/diagram.bpmn new file mode 100644 index 00000000..0b317f61 --- /dev/null +++ b/projects/typescript-lit-element/src/diagram.bpmn @@ -0,0 +1,290 @@ + + + + + Flow_0i9hf3x + + + + Flow_0i9hf3x + Flow_06ca3ya + Flow_169iupn + Flow_1ojqrz1 + + + + + Flow_169iupn + Flow_0hpz0ab + + + + Flow_1ojqrz1 + Flow_1a9zw3d + + + + Flow_1y1kscn + Flow_0j5xinh + Flow_1448s6h + + + Flow_0j5xinh + Flow_0jp4uz8 + Flow_0wd8pwa + + + + Flow_0jp4uz8 + Flow_0pu7ps3 + + + + Flow_0wd8pwa + Flow_0pu7ps3 + Flow_1nxinu7 + + + + + Flow_1nxinu7 + Flow_14tr1q9 + Flow_19cdedl + + + Flow_1448s6h + Flow_14tr1q9 + + + + + + + Flow_19cdedl + Flow_0hpz0ab + Flow_1a9zw3d + Flow_06uo70h + + + + + Flow_06uo70h + Flow_0lrixjg + + + + Flow_0lrixjg + Flow_1r9qd61 + Flow_1lkft1n + + + + Flow_1r9qd61 + Flow_1vzcv72 + + + + Flow_1lkft1n + Flow_1vzcv72 + Flow_1kkicvr + + + + + Flow_1kkicvr + Flow_12q12yb + + + + Flow_12q12yb + + + + Flow_06ca3ya + Flow_1y1kscn + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/typescript-lit-element/src/index.ts b/projects/typescript-lit-element/src/index.ts new file mode 100644 index 00000000..0476a533 --- /dev/null +++ b/projects/typescript-lit-element/src/index.ts @@ -0,0 +1,23 @@ +import { LitElement, html } from "lit"; +import { customElement } from "lit/decorators.js"; +import { BpmnVisualization, FitType } from "bpmn-visualization"; +// The BPMN diagram, loaded as string. The '?.raw' extension support is provided by Vite. +// for other load methods, see https://github.com/process-analytics/bpmn-visualization-examples +import diagram from './diagram.bpmn?raw'; +import "./style.css"; + +@customElement("bpmn-diag") +export class BPMN extends LitElement { + firstUpdated(): void { + const bpmnVisualization = new BpmnVisualization({ + container: this.renderRoot.querySelector("#bpmn-container"), + }); + bpmnVisualization.load(diagram, { + fit: { type: FitType.Center, margin: 10 }, + }); + } + + render() { + return html`
`; + } +} diff --git a/projects/typescript-lit-element/src/style.css b/projects/typescript-lit-element/src/style.css new file mode 100644 index 00000000..04653b75 --- /dev/null +++ b/projects/typescript-lit-element/src/style.css @@ -0,0 +1,26 @@ +body { + font-family: Avenir, Helvetica, Arial, sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + color: #2c3e50; +} +footer { + position: absolute; + bottom: 1rem; + right: 1rem; + z-index: 1; +} + +.title { + text-align: center; + margin-top: 3rem; +} + +.bpmn-highlight.bpmn-task > rect { + fill: pink; + fill-opacity: 30%; + stroke: coral; +} +.bpmn-highlight.bpmn-task > rect:hover { + fill-opacity: 70%; +} diff --git a/projects/typescript-lit-element/src/vite-env.d.ts b/projects/typescript-lit-element/src/vite-env.d.ts new file mode 100644 index 00000000..11f02fe2 --- /dev/null +++ b/projects/typescript-lit-element/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/projects/typescript-lit-element/tsconfig.json b/projects/typescript-lit-element/tsconfig.json new file mode 100644 index 00000000..d17e916d --- /dev/null +++ b/projects/typescript-lit-element/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "module": "esnext", + "lib": ["es2017", "dom", "dom.iterable"], + "declaration": true, + "emitDeclarationOnly": true, + "outDir": "./types", + "rootDir": "./src", + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "moduleResolution": "node", + "allowSyntheticDefaultImports": true, + "experimentalDecorators": true, + "forceConsistentCasingInFileNames": true + }, + "include": ["src/**/*.ts"], + "exclude": [] +}