From 78ba5c1105009dbce0d14c767e0f04fd2e1bd91f Mon Sep 17 00:00:00 2001 From: AlexIchenskiy Date: Fri, 24 Jul 2026 15:10:09 +0200 Subject: [PATCH 1/3] New: Add docs page --- .eslintignore | 1 + .github/workflows/docs.yml | 82 + docs/site/.gitignore | 3 + docs/site/.vitepress/config.ts | 90 + docs/site/.vitepress/theme/Layout.vue | 15 + .../theme/components/ExampleGallery.vue | 138 + .../.vitepress/theme/components/HeroGraph.vue | 351 +++ .../.vitepress/theme/components/OrbDemo.vue | 72 + docs/site/.vitepress/theme/custom.css | 153 + docs/site/.vitepress/theme/index.ts | 15 + docs/site/concepts/data.md | 166 ++ docs/site/concepts/events.md | 118 + docs/site/concepts/interaction.md | 119 + docs/site/concepts/styling.md | 146 + docs/site/index.md | 36 + docs/site/introduction/getting-started.md | 100 + docs/site/introduction/what-is-orb.md | 38 + docs/site/layouts/force.md | 62 + docs/site/layouts/gpu.md | 37 + docs/site/layouts/overview.md | 58 + docs/site/layouts/static.md | 56 + docs/site/package-lock.json | 2559 +++++++++++++++++ docs/site/package.json | 16 + docs/site/public/demos/data.html | 119 + docs/site/public/demos/events.html | 99 + docs/site/public/demos/gpu.html | 87 + docs/site/public/demos/interaction.html | 106 + docs/site/public/demos/layouts.html | 96 + docs/site/public/demos/map.html | 115 + docs/site/public/demos/metro.html | 218 ++ docs/site/public/demos/playground.html | 226 ++ docs/site/public/demos/styled.html | 213 ++ docs/site/public/demos/styles-showcase.html | 80 + docs/site/public/orb.min.js | 2 + docs/site/public/orb.worker.min.js | 1 + docs/site/public/orb.worker.vendor.min.js | 1 + docs/site/reference/api.md | 194 ++ docs/site/rendering/performance.md | 54 + docs/site/rendering/renderers.md | 56 + docs/site/rendering/svg-export.md | 78 + docs/site/views/default.md | 81 + docs/site/views/map.md | 74 + examples/example-webgl-renderer.html | 4 +- src/index.ts | 22 +- src/renderer/canvas/canvas-renderer.ts | 2 +- src/renderer/webgl/shaders/edge/edge.frag | 9 +- src/renderer/webgl/shaders/edge/edge.vert | 7 + src/renderer/webgl/webgl-renderer.ts | 46 +- src/views/orb-map-view.ts | 52 +- src/views/orb-view.ts | 91 +- src/views/shared.ts | 2 + 51 files changed, 6511 insertions(+), 55 deletions(-) create mode 100644 .github/workflows/docs.yml create mode 100644 docs/site/.gitignore create mode 100644 docs/site/.vitepress/config.ts create mode 100644 docs/site/.vitepress/theme/Layout.vue create mode 100644 docs/site/.vitepress/theme/components/ExampleGallery.vue create mode 100644 docs/site/.vitepress/theme/components/HeroGraph.vue create mode 100644 docs/site/.vitepress/theme/components/OrbDemo.vue create mode 100644 docs/site/.vitepress/theme/custom.css create mode 100644 docs/site/.vitepress/theme/index.ts create mode 100644 docs/site/concepts/data.md create mode 100644 docs/site/concepts/events.md create mode 100644 docs/site/concepts/interaction.md create mode 100644 docs/site/concepts/styling.md create mode 100644 docs/site/index.md create mode 100644 docs/site/introduction/getting-started.md create mode 100644 docs/site/introduction/what-is-orb.md create mode 100644 docs/site/layouts/force.md create mode 100644 docs/site/layouts/gpu.md create mode 100644 docs/site/layouts/overview.md create mode 100644 docs/site/layouts/static.md create mode 100644 docs/site/package-lock.json create mode 100644 docs/site/package.json create mode 100644 docs/site/public/demos/data.html create mode 100644 docs/site/public/demos/events.html create mode 100644 docs/site/public/demos/gpu.html create mode 100644 docs/site/public/demos/interaction.html create mode 100644 docs/site/public/demos/layouts.html create mode 100644 docs/site/public/demos/map.html create mode 100644 docs/site/public/demos/metro.html create mode 100644 docs/site/public/demos/playground.html create mode 100644 docs/site/public/demos/styled.html create mode 100644 docs/site/public/demos/styles-showcase.html create mode 100644 docs/site/public/orb.min.js create mode 100644 docs/site/public/orb.worker.min.js create mode 100644 docs/site/public/orb.worker.vendor.min.js create mode 100644 docs/site/reference/api.md create mode 100644 docs/site/rendering/performance.md create mode 100644 docs/site/rendering/renderers.md create mode 100644 docs/site/rendering/svg-export.md create mode 100644 docs/site/views/default.md create mode 100644 docs/site/views/map.md diff --git a/.eslintignore b/.eslintignore index 457da68..1794051 100644 --- a/.eslintignore +++ b/.eslintignore @@ -2,4 +2,5 @@ coverage/ dist/ node_modules/ examples/ +docs/ webpack.config.js diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..da5ab75 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,82 @@ +name: Deploy docs to GitHub Pages + +on: + push: + # NOTE: `new/add-docs-page` is a TEMPORARY entry so the team can review a live + # deploy from the docs branch. Remove it before/at merge so main deploys only + # from main. + branches: [main, release/1.0.0, new/add-docs-page] + # Validate the bundle + docs build on any PR that touches them, so reviewers + # get a green check without needing Pages enabled or a merge to main. The + # deploy job below is skipped for PRs. + pull_request: + paths: + - "docs/site/**" + - "src/**" + - ".github/workflows/docs.yml" + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +# One deploy at a time, but keep PR builds from cancelling a main deploy (and +# vice versa) by scoping the group per ref. +concurrency: + group: pages-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 20 + + # 1. Build the Orb browser bundle from source so the live demos stay in sync. + - name: Build Orb bundle + run: | + npm ci + npm run build:release + + # 2. Refresh the copies the docs site embeds. + - name: Sync bundle into docs site + run: | + cp dist/browser/orb.min.js docs/site/public/orb.min.js + cp dist/browser/orb.worker.min.js docs/site/public/orb.worker.min.js + # The module worker loads this shared vendor chunk as a sibling; without + # it the worker fails silently and layout simulation never runs. + cp dist/browser/orb.worker.vendor.min.js docs/site/public/orb.worker.vendor.min.js + + # 3. Build the VitePress site. + - name: Build docs + working-directory: docs/site + run: | + npm install + npm run build + + # 4. Package for Pages. Only needed for an actual deploy, so skip on PRs + # (where these steps would also fail until Pages is enabled). + - uses: actions/configure-pages@v5 + if: github.event_name != 'pull_request' + + - uses: actions/upload-pages-artifact@v3 + if: github.event_name != 'pull_request' + with: + path: docs/site/.vitepress/dist + + deploy: + needs: build + # Deploy only from main; PRs run the build job above for validation only. + if: github.event_name != 'pull_request' + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - id: deployment + uses: actions/deploy-pages@v4 diff --git a/docs/site/.gitignore b/docs/site/.gitignore new file mode 100644 index 0000000..2c1fa99 --- /dev/null +++ b/docs/site/.gitignore @@ -0,0 +1,3 @@ +node_modules/ +.vitepress/dist/ +.vitepress/cache/ diff --git a/docs/site/.vitepress/config.ts b/docs/site/.vitepress/config.ts new file mode 100644 index 0000000..b868261 --- /dev/null +++ b/docs/site/.vitepress/config.ts @@ -0,0 +1,90 @@ +import { defineConfig } from 'vitepress'; + +// https://vitepress.dev/reference/site-config +export default defineConfig({ + // Served from https://memgraph.github.io/orb/ on GitHub Pages. + base: '/orb/', + lang: 'en-US', + title: 'Orb', + description: 'A graph visualization library by Memgraph.', + cleanUrls: true, + + // Every page has real content now; fail the build on broken internal links. + ignoreDeadLinks: false, + + head: [ + ['link', { rel: 'preconnect', href: 'https://fonts.googleapis.com' }], + ['link', { rel: 'preconnect', href: 'https://fonts.gstatic.com', crossorigin: '' }], + [ + 'link', + { + rel: 'stylesheet', + href: 'https://fonts.googleapis.com/css2?family=Inter+Tight:wght@400;500;600;700;800&family=Ubuntu+Mono:wght@400;700&display=swap', + }, + ], + ], + + themeConfig: { + nav: [ + { text: 'Guide', link: '/introduction/getting-started', activeMatch: '/(introduction|concepts|layouts|rendering|views)/' }, + { text: 'Reference', link: '/reference/api', activeMatch: '/reference/' }, + { text: 'npm', link: 'https://www.npmjs.com/package/@memgraph/orb' }, + ], + + sidebar: [ + { + text: 'Introduction', + items: [ + { text: 'What is Orb', link: '/introduction/what-is-orb' }, + { text: 'Getting started', link: '/introduction/getting-started' }, + ], + }, + { + text: 'Core concepts', + items: [ + { text: 'Graph data', link: '/concepts/data' }, + { text: 'Styling', link: '/concepts/styling' }, + { text: 'Events', link: '/concepts/events' }, + { text: 'Selection & interaction', link: '/concepts/interaction' }, + ], + }, + { + text: 'Layouts', + items: [ + { text: 'Overview', link: '/layouts/overview' }, + { text: 'Force layout', link: '/layouts/force' }, + { text: 'GPU layout', link: '/layouts/gpu' }, + { text: 'Static layouts', link: '/layouts/static' }, + ], + }, + { + text: 'Rendering', + items: [ + { text: 'Canvas vs WebGL', link: '/rendering/renderers' }, + { text: 'Performance', link: '/rendering/performance' }, + { text: 'SVG export', link: '/rendering/svg-export' }, + ], + }, + { + text: 'Views', + items: [ + { text: 'Default view', link: '/views/default' }, + { text: 'Map view', link: '/views/map' }, + ], + }, + { + text: 'Reference', + items: [{ text: 'API reference', link: '/reference/api' }], + }, + ], + + socialLinks: [{ icon: 'github', link: 'https://github.com/memgraph/orb' }], + + search: { provider: 'local' }, + + footer: { + message: 'Released under the Apache-2.0 License.', + copyright: 'Copyright © 2016-present Memgraph Ltd.', + }, + }, +}); diff --git a/docs/site/.vitepress/theme/Layout.vue b/docs/site/.vitepress/theme/Layout.vue new file mode 100644 index 0000000..336487c --- /dev/null +++ b/docs/site/.vitepress/theme/Layout.vue @@ -0,0 +1,15 @@ + + + diff --git a/docs/site/.vitepress/theme/components/ExampleGallery.vue b/docs/site/.vitepress/theme/components/ExampleGallery.vue new file mode 100644 index 0000000..f1c5577 --- /dev/null +++ b/docs/site/.vitepress/theme/components/ExampleGallery.vue @@ -0,0 +1,138 @@ + + +