Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add a project with maxGraph as a lit Web Component #38

Merged
merged 7 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/check-typescript-projects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ on:
- 'projects/**/*'

jobs:
build_maxgraph_package:
build_maxgraph_dev_package:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
Expand All @@ -43,12 +43,16 @@ jobs:

build_projects:
runs-on: ubuntu-22.04
needs: [build_maxgraph_package]
needs: [build_maxgraph_dev_package]
strategy:
# don't cancel running jobs even if one fails
fail-fast: false
matrix:
project: [parcel-ts, rollup-ts, vitejs-ts]
project:
- lit-ts
- parcel-ts
- rollup-ts
- vitejs-ts
npm-package: ['release', 'development']
defaults:
run:
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Demonstrate how to integrate [maxGraph](https://github.com/maxGraph/maxGraph/) in projects.

⏩ Find the live demo at https://maxgraph.github.io/maxgraph-integration-examples/

## Getting started

### Setup
Expand All @@ -18,13 +20,16 @@ If the Node version is not installed, `nvm` will state how to install the requir

### Available projects

- [TypeScript with Lit](./projects/lit-ts/README.md)
- [TypeScript with Parcel](./projects/parcel-ts/README.md)
- [TypeScript with Rollup](./projects/rollup-ts/README.md)
- [TypeScript with ViteJs](./projects/vitejs-ts/README.md)


### <a id="maxgraph-dev-version"></a> Use the maxGraph development version

**Note**: the `maxGraph` development version is tested in a [GitHub Workflow](./.github/workflows/check-typescript-projects.yml) that uses the procedure explained below.

Build [maxGraph](https://github.com/maxGraph/maxGraph/) locally:
- from the `maxGraph` project root, run: `npm install`
- then, from the `packages/core` folder, run: `npm pack`
Expand Down
18 changes: 18 additions & 0 deletions projects/lit-ts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# lit-ts

Demonstrate how to integrate maxGraph in a Web Component created with [lit](https://lit.dev/).

The application is built with [Vite](https://vitejs.dev/).

## Setup

From the project root, run `npm install`.

If you want to use the maxGraph development version (built locally), see the README about maxGraph integration.

## Running the project

Run `npm run dev` and go to http://localhost:5173/

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.
13 changes: 13 additions & 0 deletions projects/lit-ts/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions projects/lit-ts/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>maxGraph Lit integration example</title>
<link rel="icon" type="image/svg+xml" href="./favicon.svg" />
<script type="module" src="/src/index.ts"></script>
</head>
<body>
<h1>maxGraph TypeScript example</h1>
<p>Display a test graph. Activated behaviours:</p>
<ul>
<li>Panning: use mouse right button</li>
<li>Cells selection with Rubberband: use mouse left button</li>
</ul>
<maxgraph-graph></maxgraph-graph>
</body>
</html>
249 changes: 249 additions & 0 deletions projects/lit-ts/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions projects/lit-ts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "maxgraph-ts-example-integrating-in-lit",
"private": true,
"version": "0.0.0",
"scripts": {
"dev": "vite",
"build": "tsc && vite build --base ./",
"preview": "vite preview"
},
"dependencies": {
"@maxgraph/core": "0.2.1",
"lit": "~2.7.5"
},
"devDependencies": {
"vite": "~4.3.9",
"typescript": "~5.1.6"
}
}
Loading