Skip to content

Commit fff6f73

Browse files
authored
Merge branch 'master' into master
2 parents 2539597 + 8c46ef1 commit fff6f73

File tree

528 files changed

+19688
-15169
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

528 files changed

+19688
-15169
lines changed

.github/workflows/build-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
npx tsc -p tsconfig.esm-check.json
3636
npx tsc -p tsconfig.umd-check.json
3737
- name: Chrome and Firefox tests
38-
run: xvfb-run --auto-servernum npm run test -- --browsers Chrome,Firefox
38+
run: xvfb-run --auto-servernum npm run test -- --browsers ChromeSwiftShader,Firefox
3939
- name: Archive test results
4040
if: github.event_name != 'merge_group' && (success() || failure())
4141
uses: actions/upload-artifact@v4

.github/workflows/pr-checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ jobs:
2424
- name: Tests must not use test.only
2525
run: bash .github/workflows/test-only-check.sh
2626
- name: API docs should generate without error
27-
run: npm run doc:generate-api
27+
run: npm run docs:generate-api

.github/workflows/publish.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
with:
2727
fetch-depth: 0
2828
- name: Setup node
29-
uses: actions/setup-node@v1
29+
uses: actions/setup-node@v4
3030
with:
3131
node-version: 22
3232
- name: Install dependencies
@@ -42,7 +42,7 @@ jobs:
4242
npx tsc -p tsconfig.esm-check.json
4343
npx tsc -p tsconfig.umd-check.json
4444
- name: Chrome and Firefox tests
45-
run: xvfb-run --auto-servernum npm run test -- --browsers Chrome,Firefox
45+
run: xvfb-run --auto-servernum npm run test -- --browsers ChromeSwiftShader,Firefox
4646
- name: Archive test results
4747
if: always()
4848
uses: actions/upload-artifact@v4
@@ -53,7 +53,8 @@ jobs:
5353
- name: Release
5454
env:
5555
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
56+
# No need to set NPM_TOKEN because of OIDC
57+
NPM_CONFIG_PROVENANCE: true
5758
run: |
5859
git config --global user.name "Github Actions"
5960
git config --global user.email "sebastien.jourdain@kitware.com"
@@ -80,13 +81,21 @@ jobs:
8081
run: npm ci
8182
- name: Build
8283
run: npm run build:release
83-
- name: Build API docs
84-
run: npm run doc:generate-api
84+
- name: Generate API docs
85+
run: npm run docs:generate-api
86+
- name: Generate docs examples
87+
run: npm run docs:generate-examples
88+
- name: Generate docs sidebar
89+
run: npm run docs:generate-sidebar
90+
- name: Generate docs gallery
91+
run: npm run docs:generate-gallery
8592
- name: Build docs
86-
run: npm run doc:minified
93+
run: npm run docs:build
94+
- name: Build docs examples
95+
run: npm run docs:build-examples
8796
- name: Upload docs as a Pages artifact
8897
uses: actions/upload-pages-artifact@v3
8998
with:
90-
path: ./Documentation/build-tmp/public/
99+
path: ./Documentation/.vitepress/dist/
91100
- name: Deploy docs
92101
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,8 @@ coverage/
1010
.env
1111
Utilities/TestResults
1212
.idea
13+
Documentation/.vitepress/cache/
14+
Documentation/.vitepress/dist/
15+
Documentation/build-tmp/
16+
Documentation/content/
17+
Documentation/Examples/

CONTRIBUTING.md

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,36 +33,43 @@ Please follow the coding style:
3333
$ git checkout -b new_feature
3434
```
3535

36-
4. Start hacking. Additional information on how to create class/test/example can be found
36+
6. Start hacking. Additional information on how to create class/test/example can be found
3737
[here](https://kitware.github.io/vtk-js/docs/) in the __Development__ section.
3838

3939
```sh
4040
$ edit file1 file2 file3
4141
$ git add file1 file2 file3
4242
```
4343

44-
5. Use Commitizen to create commits
44+
7. Verify you have correctly formatted code, and that all tests pass:
45+
46+
```sh
47+
$ npm run reformat
48+
$ npm run test
49+
```
50+
51+
8. Use Commitizen to create commits
4552

4653
```sh
4754
$ npm run commit
4855
```
4956

50-
6. Push commits in your feature branch to your fork in GitHub:
57+
9. Push commits in your feature branch to your fork in GitHub:
5158

5259
```sh
5360
$ git push origin new_feature
5461
```
5562

56-
7. Visit your fork in Github, browse to the "**Pull Requests**" link on the left, and use the
63+
10. Visit your fork in Github, browse to the "**Pull Requests**" link on the left, and use the
5764
"**New Pull Request**" button in the upper right to create a Pull Request.
5865

59-
For more information see:
66+
For more information see:
6067
[Create a Pull Request](https://help.github.com/articles/creating-a-pull-request/)
6168

6269
If committing changes to `vtk.js@next` or `vtk.js@next-major`, then set your base branch to be `next`
6370
or `next-major`, respectively. For more info see the section on release channels below.
6471

65-
8. vtk.js uses GitHub for code review and Github Actions to validate proposed patches before they are merged.
72+
11. vtk.js uses GitHub for code review and Github Actions to validate proposed patches before they are merged.
6673

6774
## Release Channels
6875

@@ -99,7 +106,7 @@ you are satisfied with the staging branch changes, you can then merge into eithe
99106
## Notice
100107

101108
- Don't modify the version number in `package.json`.
102-
- Your pull request will only get merged when tests passed. Don't forget to run tests before
109+
- Your pull request will only get merged when tests passed. Don't forget to run tests before
103110
submission.
104111

105112
```
@@ -116,18 +123,18 @@ To create and debug a test:
116123

117124
## Updating Documentation
118125

119-
The vtk.js documentation is part of the code repository and is entirely written in
126+
The vtk.js documentation is part of the code repository and is entirely written in
120127
[markdown](https://daringfireball.net/projects/markdown/).
121128

122129
If you create an example, please list it in the [examples landing page](Documentation/content/examples/index.md).
123130

124-
Images and GIF videos added to the [gallery](Documentation/content/docs/gallery) must be compressed as much as possible (e.g. 432px by 300px with 50% JPEG compression). You may want to use [ezgif.com](https://ezgif.com/).
131+
Images and GIF videos added to the [gallery](Documentation/public/gallery) must be compressed as much as possible (e.g. 432px by 300px with 50% JPEG compression). You may want to use [ezgif.com](https://ezgif.com/).
125132

126133
## Reporting Issues
127134

128135
If you encounter problems using vtk.js you may be able to find the solutions in the
129-
[troubleshooting docs](https://kitware.github.io/vtk-js/docs/misc_troubleshooting.html), in an
130-
existing [GitHub issue](https://github.com/kitware/vtk-js/issues), or via the
136+
[troubleshooting docs](https://kitware.github.io/vtk-js/docs/misc_troubleshooting.html), in an
137+
existing [GitHub issue](https://github.com/kitware/vtk-js/issues), or via the
131138
[mailing list](http://www.vtk.org/VTK/help/mailing.html).
132-
If you can't find the answer, please
139+
If you can't find the answer, please
133140
[report a new issue on GitHub](https://github.com/Kitware/vtk-js/issues/new).

Documentation/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { defineConfig } from 'vitepress';
2+
import llmstxt from 'vitepress-plugin-llms';
3+
import { copyOrDownloadAsMarkdownButtons } from 'vitepress-plugin-llms';
4+
5+
import { sidebar } from './sidebar';
6+
import { BASE_URL, withBase } from './utils';
7+
8+
// https://vitepress.dev/reference/site-config
9+
export default defineConfig({
10+
base: BASE_URL,
11+
lang: 'en-US',
12+
title: 'VTK.js ',
13+
description: 'VTK.js a Visualization Toolkit for the Web',
14+
lastUpdated: true,
15+
ignoreDeadLinks: true,
16+
srcExclude: ['**/scripts/**',],
17+
vite: {
18+
plugins: [
19+
llmstxt({
20+
ignoreFiles: ['examples/*', 'coverage/*', 'scripts/*'],
21+
}),
22+
],
23+
},
24+
themeConfig: {
25+
// https://vitepress.dev/reference/default-theme-config
26+
logo: '/logo-wide.svg',
27+
siteTitle: '',
28+
nav: [
29+
{ text: 'Docs', link: '/docs/' },
30+
{ text: 'API', link: '/api/' },
31+
{ text: 'Examples', link: '/examples/' },
32+
{ text: 'Datasets', link: 'https://kitware.github.io/vtk-js-datasets/' },
33+
],
34+
sidebar: sidebar,
35+
socialLinks: [
36+
{ icon: 'github', link: 'https://github.com/Kitware/vtk-js' },
37+
],
38+
outline: 'deep',
39+
search: {
40+
provider: 'local',
41+
},
42+
footer: {
43+
copyright: ${new Date().getFullYear()} <a href="https://www.kitware.com/" target="_blank">Kitware Inc</a>.`,
44+
},
45+
},
46+
markdown: {
47+
config(md) {
48+
md.use(copyOrDownloadAsMarkdownButtons);
49+
},
50+
},
51+
});

Documentation/.vitepress/sidebar.ts

Whitespace-only changes.
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
<template>
2+
<div class="examples-page">
3+
<h2>Examples Gallery</h2>
4+
<div class="examples-controls">
5+
<input v-model="search" placeholder="Search examples..." />
6+
<div class="category-buttons">
7+
<button :class="{ selected: !selectedCategory }" @click="selectedCategory = ''">All Categories</button>
8+
<button v-for="cat in categories" :key="cat" :class="{ selected: selectedCategory === cat }"
9+
@click="selectedCategory = cat">{{ cat }}</button>
10+
</div>
11+
</div>
12+
<div class="examples-list">
13+
<div v-for="ex in filteredExamples" :key="ex.title" class="example-card">
14+
<a :href="withBase(`/examples/${ex.link}`)" :title="ex.title">
15+
<img :src="withBase(`/${ex.image}`)" :alt="ex.title" />
16+
<h3>{{ ex.title }}</h3>
17+
<p class="category">{{ ex.category }}</p>
18+
</a>
19+
</div>
20+
</div>
21+
</div>
22+
</template>
23+
24+
<script setup>
25+
import { withBase } from 'vitepress'
26+
import { ref, computed } from 'vue'
27+
import examples from '../../../examples/gallery.js'
28+
29+
const search = ref('')
30+
const selectedCategory = ref('')
31+
32+
const categories = computed(() =>
33+
Array.from(new Set(examples.map(e => e.category))).sort()
34+
)
35+
36+
const filteredExamples = computed(() => {
37+
return examples.filter(ex => {
38+
const matchesSearch = ex.title.toLowerCase().includes(search.value.toLowerCase())
39+
const matchesCategory = !selectedCategory.value || ex.category === selectedCategory.value
40+
return matchesSearch && matchesCategory
41+
})
42+
})
43+
</script>
44+
45+
<style scoped>
46+
.examples-page {
47+
display: flex;
48+
justify-content: space-between;
49+
margin: 0 auto;
50+
padding-top: calc(var(--spacing) * 24);
51+
padding-bottom: calc(var(--spacing) * 12);
52+
gap: calc(var(--spacing) * 8);
53+
max-width: calc(var(--vp-layout-max-width) - 64px);
54+
flex-direction: column;
55+
align-items: center;
56+
}
57+
58+
.examples-page h2 {
59+
font-size: 2rem;
60+
margin-bottom: 1.5rem;
61+
}
62+
63+
.examples-controls input {
64+
padding: 0.3em 1.2em;
65+
border: 1px solid var(--vp-c-divider);
66+
border-radius: calc(var(--radius));
67+
font-size: 1em;
68+
width: 400px;
69+
}
70+
71+
.examples-controls input::placeholder {
72+
color: #aaa;
73+
}
74+
75+
.examples-controls {
76+
display: flex;
77+
flex-direction: column;
78+
gap: 1.5rem;
79+
margin-bottom: 1.5rem;
80+
justify-content: center;
81+
align-items: center;
82+
}
83+
84+
.category-buttons {
85+
display: flex;
86+
flex-wrap: wrap;
87+
gap: 0.5rem;
88+
align-content: center;
89+
justify-content: center;
90+
}
91+
92+
.category-buttons button {
93+
padding: 0.2em 1em;
94+
border: 1px solid var(--vp-c-divider);
95+
border-radius: 0.375rem;
96+
cursor: pointer;
97+
font-size: 0.875rem;
98+
font-weight: 500;
99+
transition: all 0.2s;
100+
}
101+
102+
.category-buttons button:hover {
103+
background-color: color-mix(in oklab, var(--primary) 90%, transparent);
104+
color: var(--primary-foreground);
105+
}
106+
107+
.category-buttons button.selected {
108+
background-color: color-mix(in oklab, var(--primary) 90%, transparent);
109+
color: var(--primary-foreground);
110+
}
111+
112+
.examples-list {
113+
display: flex;
114+
flex-wrap: wrap;
115+
gap: 1.5rem;
116+
flex-direction: row;
117+
justify-content: center;
118+
align-items: center;
119+
}
120+
121+
.example-card {
122+
width: 250px;
123+
overflow: hidden;
124+
border: 1px solid var(--vp-c-divider);
125+
border-radius: 0.375rem;
126+
}
127+
128+
.example-card:hover {
129+
border-color: var(--vp-c-brand-1);
130+
}
131+
132+
.example-card img {
133+
width: 100%;
134+
height: 140px;
135+
object-fit: cover;
136+
}
137+
138+
.example-card h3 {
139+
margin: 0.5rem;
140+
font-size: 1.1rem;
141+
text-overflow: ellipsis;
142+
overflow: hidden;
143+
white-space: nowrap;
144+
}
145+
146+
.example-card .category {
147+
margin: 0.5rem;
148+
font-size: 0.9rem;
149+
}
150+
</style>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// https://vitepress.dev/guide/custom-theme
2+
import type { Theme } from 'vitepress'
3+
import DefaultTheme from 'vitepress/theme'
4+
import googleAnalytics from "vitepress-plugin-google-analytics";
5+
import CopyOrDownloadAsMarkdownButtons from 'vitepress-plugin-llms/vitepress-components/CopyOrDownloadAsMarkdownButtons.vue'
6+
7+
import ExamplesGallery from './components/ExamplesGallery.vue'
8+
9+
import './styles/index.css'
10+
11+
export default {
12+
extends: DefaultTheme,
13+
enhanceApp({ app, router, siteData }) {
14+
app.component('ExamplesGallery', ExamplesGallery),
15+
app.component('CopyOrDownloadAsMarkdownButtons', CopyOrDownloadAsMarkdownButtons)
16+
googleAnalytics({
17+
id: "G-5XH2Z0Y9LQ",
18+
});
19+
}
20+
} satisfies Theme

0 commit comments

Comments
 (0)