aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2024-04-18 18:40:31 +0200
committerLibravatar Kristóf Marussy <kristof@marussy.com>2024-04-18 19:59:51 +0200
commit419fcdbfd0aed6892ee4fb1fdb0d50eea55dead8 (patch)
tree08a888611ca944597e300fab9f6a9c5de676255c /subprojects
parentdocs: update landing page (diff)
downloadrefinery-419fcdbfd0aed6892ee4fb1fdb0d50eea55dead8.tar.gz
refinery-419fcdbfd0aed6892ee4fb1fdb0d50eea55dead8.tar.zst
refinery-419fcdbfd0aed6892ee4fb1fdb0d50eea55dead8.zip
refactor(docs): update video cover
Also adds responsive-loader support for images.
Diffstat (limited to 'subprojects')
-rw-r--r--subprojects/docs/package.json2
-rw-r--r--subprojects/docs/src/components/Video/cover-background.pngbin0 -> 1979050 bytes
-rw-r--r--subprojects/docs/src/components/Video/cover-background.png.license9
-rw-r--r--subprojects/docs/src/components/Video/cover.svg1
-rw-r--r--subprojects/docs/src/components/Video/cover.svg.license3
-rw-r--r--subprojects/docs/src/components/Video/index.module.css75
-rw-r--r--subprojects/docs/src/components/Video/index.tsx62
-rw-r--r--subprojects/docs/src/pages/index.tsx272
-rw-r--r--subprojects/docs/src/pages/video-cover.webpbin147992 -> 0 bytes
-rw-r--r--subprojects/docs/src/pages/video-cover.webp.license3
-rw-r--r--subprojects/docs/src/plugins/loadersPlugin.ts39
-rw-r--r--subprojects/docs/src/types.d.ts33
12 files changed, 331 insertions, 168 deletions
diff --git a/subprojects/docs/package.json b/subprojects/docs/package.json
index d928c5b1..853e3e46 100644
--- a/subprojects/docs/package.json
+++ b/subprojects/docs/package.json
@@ -49,6 +49,8 @@
49 "react": "^18.2.0", 49 "react": "^18.2.0",
50 "react-dom": "^18.2.0", 50 "react-dom": "^18.2.0",
51 "remark-smartypants": "^2.1.0", 51 "remark-smartypants": "^2.1.0",
52 "responsive-loader": "^3.1.2",
53 "sharp": "^0.33.3",
52 "swc-loader": "^0.2.6", 54 "swc-loader": "^0.2.6",
53 "terser-webpack-plugin": "^5.3.10", 55 "terser-webpack-plugin": "^5.3.10",
54 "unified": "^11.0.4", 56 "unified": "^11.0.4",
diff --git a/subprojects/docs/src/components/Video/cover-background.png b/subprojects/docs/src/components/Video/cover-background.png
new file mode 100644
index 00000000..11369ae3
--- /dev/null
+++ b/subprojects/docs/src/components/Video/cover-background.png
Binary files differ
diff --git a/subprojects/docs/src/components/Video/cover-background.png.license b/subprojects/docs/src/components/Video/cover-background.png.license
new file mode 100644
index 00000000..50ad65f2
--- /dev/null
+++ b/subprojects/docs/src/components/Video/cover-background.png.license
@@ -0,0 +1,9 @@
1SPDX-FileCopyrightText: 2024 The Refinery Authors <https://refinery.tools/>
2
3SPDX-License-Identifier: EPL-2.0
4
5Modified image based on "Low Angle Shot of Manufacturing Plant under Blue Sky"
6available under the CC-1.0 license at
7https://www.pexels.com/photo/low-angle-shot-of-manufacturing-plant-under-blue-sky-257700/
8Original image "Bulgaria, Vratsa, Abandoned image. Free for use." by "2427999" also available at
9https://pixabay.com/photos/bulgaria-vratsa-abandoned-industry-1351947/
diff --git a/subprojects/docs/src/components/Video/cover.svg b/subprojects/docs/src/components/Video/cover.svg
new file mode 100644
index 00000000..b263c8b3
--- /dev/null
+++ b/subprojects/docs/src/components/Video/cover.svg
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1280" height="720" viewBox="0 0 1280 720"><path fill="#fff" fill-opacity=".4" d="M0 95h1280v530H0z"/><path class="videocolor" fill-opacity=".702" d="M0 171h1205v378H0z"/><path fill="#CA1243" d="M1261 95h19v530h-19z"/><path class="videocolor" d="M0 171h19v378H0z"/><g class="videotitle"><path fill-rule="evenodd" d="M1143 387.09v26.293c-69.4 3.985-192.57 26.695-256 95.615v-31.074c64.343-63.744 180.16-88.046 256-90.834M887 211c55.152 64.14 162.7 91.63 256 98.004V335.3c-93.3 6.374-200.85 33.866-256 98.003v-30.676c22.983-34.262 96.979-66.532 153.51-80.476-56.535-13.944-130.53-46.214-153.51-80.475z"/><text font-size="72" font-weight="800" transform="translate(31 439)">Video</text><text font-size="72" font-weight="800" transform="translate(31 525)">introduction</text></g><path class="videoplay" fill-rule="evenodd" d="M593.12 284.23v151.53l131.07-75.765zm46.879-85.227c88.918 0 161 72.082 161 161s-72.082 161-161 161-161-72.082-161-161 72.082-161 161-161"/></svg>
diff --git a/subprojects/docs/src/components/Video/cover.svg.license b/subprojects/docs/src/components/Video/cover.svg.license
new file mode 100644
index 00000000..b80566a0
--- /dev/null
+++ b/subprojects/docs/src/components/Video/cover.svg.license
@@ -0,0 +1,3 @@
1SPDX-FileCopyrightText: 2024 The Refinery Authors <https://refinery.tools/>
2
3SPDX-License-Identifier: EPL-2.0
diff --git a/subprojects/docs/src/components/Video/index.module.css b/subprojects/docs/src/components/Video/index.module.css
new file mode 100644
index 00000000..209c5d64
--- /dev/null
+++ b/subprojects/docs/src/components/Video/index.module.css
@@ -0,0 +1,75 @@
1/*
2 * SPDX-FileCopyrightText: 2024 The Refinery Authors
3 *
4 * SPDX-License-Identifier: EPL-2.0
5 */
6
7:global(.videocolor) {
8 fill: var(--ifm-color-primary);
9}
10
11[data-theme='dark'] :global(.videocolor) {
12 fill: var(--ifm-color-primary-darker);
13}
14
15.video__container {
16 position: relative;
17 width: 100%;
18 height: auto;
19 aspect-ratio: 560/315;
20 box-shadow: var(--ifm-global-shadow-lw);
21 transition: box-shadow var(--ifm-button-transition-duration) var(--ifm-transition-timing-default);
22}
23
24.video__container:hover,
25.video__container:focus-within {
26 box-shadow: var(--ifm-global-shadow-md);
27}
28
29.video,
30.video__button,
31.video__image,
32.video__svg,
33.video__svg > svg {
34 position: absolute;
35 top: 0;
36 left: 0;
37 width: 100%;
38 height: 100%;
39}
40
41.video__svg text {
42 font-family: var(--ifm-font-family-base);
43}
44
45.video__button {
46 margin: 0;
47 padding: 0;
48 border: none;
49 cursor: pointer;
50 background-size: cover;
51}
52
53.video__cover {
54 z-index: 1;
55}
56
57:global(.videoplay) {
58 fill: rgb(255 255 255 / 40%);
59 transition: fill var(--ifm-button-transition-duration) var(--ifm-transition-timing-default);
60}
61
62.video__container:hover :global(.videoplay),
63.video__container:focus-within :global(.videoplay) {
64 fill: rgb(255 255 255 / 70%);
65}
66
67:global(.videotitle) * {
68 fill: #303846;
69 transition: fill var(--ifm-button-transition-duration) var(--ifm-transition-timing-default);
70}
71
72.video__container:hover :global(.videotitle) *,
73.video__container:focus-within :global(.videotitle) * {
74 fill: #21252b;
75}
diff --git a/subprojects/docs/src/components/Video/index.tsx b/subprojects/docs/src/components/Video/index.tsx
new file mode 100644
index 00000000..bd36eaa4
--- /dev/null
+++ b/subprojects/docs/src/components/Video/index.tsx
@@ -0,0 +1,62 @@
1/*
2 * SPDX-FileCopyrightText: 2024 The Refinery Authors
3 *
4 * SPDX-License-Identifier: EPL-2.0
5 */
6
7import { useState } from 'react';
8
9import coverBackground from './cover-background.png?sizes[]=1920&sizes[]=1288&sizes[]=1108&&sizes[]=644&sizes[]=322&placeholder=true&rl';
10import Cover from './cover.svg';
11import styles from './index.module.css';
12
13export default function Video() {
14 const [started, setStarted] = useState(false);
15 return (
16 <>
17 <h2 className="sr-only">Check out the intro video</h2>
18 <div className="container">
19 <div className={styles['video__container']}>
20 {started ? (
21 <iframe
22 width="560"
23 height="315"
24 src="https://www.youtube-nocookie.com/embed/Qy_3udNsWsM?autoplay=1"
25 title="YouTube video player"
26 frameBorder="0"
27 allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
28 referrerPolicy="strict-origin-when-cross-origin"
29 allowFullScreen
30 className={styles['video']}
31 />
32 ) : (
33 <button
34 type="button"
35 aria-label="Video introduction"
36 title="Play video (requires acceping cookies from YouTube)"
37 onClick={() => setStarted(true)}
38 className={styles['video__button']}
39 style={{
40 backgroundImage: `url("${coverBackground.placeholder}")`,
41 }}
42 >
43 <img
44 alt=""
45 src={coverBackground.src}
46 srcSet={coverBackground.srcSet}
47 width={coverBackground.width}
48 height={coverBackground.height}
49 sizes="(min-width: 1440px) 1288px, (min-width: 1140px) 1108px, calc(100vw - 32px)"
50 loading="lazy"
51 className={styles['video__image']}
52 />
53 <div className={styles['video__svg']}>
54 <Cover />
55 </div>
56 </button>
57 )}
58 </div>
59 </div>
60 </>
61 );
62}
diff --git a/subprojects/docs/src/pages/index.tsx b/subprojects/docs/src/pages/index.tsx
index 7caf5727..6b65c32b 100644
--- a/subprojects/docs/src/pages/index.tsx
+++ b/subprojects/docs/src/pages/index.tsx
@@ -7,12 +7,11 @@
7import Link from '@docusaurus/Link'; 7import Link from '@docusaurus/Link';
8import Layout from '@theme/Layout'; 8import Layout from '@theme/Layout';
9import clsx from 'clsx'; 9import clsx from 'clsx';
10import { useState } from 'react';
11 10
12import styles from './index.module.css'; 11import styles from './index.module.css';
13import videoCover from './video-cover.webp?url';
14 12
15import Features from '@site/src/components/Features'; 13import Features from '@site/src/components/Features';
14import Video from '@site/src/components/Video';
16 15
17function Hero() { 16function Hero() {
18 return ( 17 return (
@@ -62,52 +61,6 @@ function Hero() {
62 ); 61 );
63} 62}
64 63
65function Video() {
66 const [started, setStarted] = useState(false);
67 return (
68 <section className={clsx(styles['section'], styles['section--video'])}>
69 <h2 className="sr-only">Check out the intro video</h2>
70 <div className="container">
71 <div className={styles['video__container']}>
72 {started ? (
73 <iframe
74 width="560"
75 height="315"
76 src="https://www.youtube-nocookie.com/embed/Qy_3udNsWsM?autoplay=1"
77 title="YouTube video player"
78 frameBorder="0"
79 allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
80 referrerPolicy="strict-origin-when-cross-origin"
81 allowFullScreen
82 className={styles['video']}
83 />
84 ) : (
85 <button
86 type="button"
87 title="Play video (requires acceping cookies from YouTube)"
88 onClick={() => setStarted(true)}
89 className={styles['video__button']}
90 >
91 <h2>Modeling with Graphs</h2>
92 <p>
93 Graph based models are widely used in software engineering for
94 systems models, the analysis of data structures, databases, and
95 AI test environments.
96 </p>
97 <p>
98 Testing, benchmarking or design-space exploration scnearios rely
99 on the automated generation of consistent models!
100 </p>
101 <img src={videoCover} alt="" className={styles['video__cover']} />
102 <div className={styles['video__play']} />
103 </button>
104 )}
105 </div>
106 </div>
107 </section>
108 );
109}
110
111function Publication({ 64function Publication({
112 doi, 65 doi,
113 pdf, 66 pdf,
@@ -153,113 +106,110 @@ Publication.defaultProps = {
153 106
154function Publications() { 107function Publications() {
155 return ( 108 return (
156 <div className={styles['section']}> 109 <div className="container">
157 <div className="container"> 110 <h2 className={styles['section__title']}>Related publications</h2>
158 <h2 className={styles['section__title']}>Related publications</h2> 111 <div className="row">
159 <div className="row"> 112 <div className="col col--6">
160 <div className="col col--6"> 113 <h3>Tool demonstration</h3>
161 <h3>Tool demonstration</h3> 114 <ul>
162 <ul> 115 <Publication
163 <Publication 116 doi="10.1145/3639478.3640045"
164 doi="10.1145/3639478.3640045" 117 pdf="pathname:///papers/icse24-demo.pdf"
165 pdf="pathname:///papers/icse24-demo.pdf" 118 video="https://youtu.be/Qy_3udNsWsM"
166 video="https://youtu.be/Qy_3udNsWsM" 119 >
167 > 120 K. Marussy, A. Ficsor, O. Semeráth, D. Varró: &ldquo;Refinery:
168 K. Marussy, A. Ficsor, O. Semeráth, D. Varró: &ldquo;Refinery: 121 Graph Solver as a Service&rdquo; <em>ICSE 2024 Demonstrations</em>
169 Graph Solver as a Service&rdquo;{' '} 122 </Publication>
170 <em>ICSE 2024 Demonstrations</em> 123 </ul>
171 </Publication> 124 <h3>Partial model specification language</h3>
172 </ul> 125 <ul>
173 <h3>Partial model specification language</h3> 126 <Publication
174 <ul> 127 doi="10.5381/jot.2020.19.3.a12"
175 <Publication 128 pdf="https://www.jot.fm/issues/issue_2020_03/article12.pdf"
176 doi="10.5381/jot.2020.19.3.a12" 129 video="https://www.youtube.com/watch?v=ggTbv_s5t2A"
177 pdf="https://www.jot.fm/issues/issue_2020_03/article12.pdf" 130 >
178 video="https://www.youtube.com/watch?v=ggTbv_s5t2A" 131 K. Marussy, O. Semeráth, A. Babikian, D. Varró:{' '}
179 > 132 <em>
180 K. Marussy, O. Semeráth, A. Babikian, D. Varró:{' '} 133 A Specification Language for Consistent Model Generation based
181 <em> 134 on Partial Models.
182 A Specification Language for Consistent Model Generation based 135 </em>{' '}
183 on Partial Models. 136 J. Object Technol. <b>19</b>(3): 3:1-22 (2020)
184 </em>{' '} 137 </Publication>
185 J. Object Technol. <b>19</b>(3): 3:1-22 (2020) 138 </ul>
186 </Publication> 139 <h3>Diverse and realistic graph generation</h3>
187 </ul> 140 <ul>
188 <h3>Diverse and realistic graph generation</h3> 141 <Publication
189 <ul> 142 doi="10.1007/s10009-019-00530-6"
190 <Publication 143 pdf="https://link.springer.com/content/pdf/10.1007/s10009-019-00530-6.pdf?pdf=button"
191 doi="10.1007/s10009-019-00530-6" 144 >
192 pdf="https://link.springer.com/content/pdf/10.1007/s10009-019-00530-6.pdf?pdf=button" 145 O. Semeráth, R. Farkas, G. Bergmann, D. Varró:{' '}
193 > 146 <em>
194 O. Semeráth, R. Farkas, G. Bergmann, D. Varró:{' '} 147 Diversity of graph models and graph generators in mutation
195 <em> 148 testing.
196 Diversity of graph models and graph generators in mutation 149 </em>{' '}
197 testing. 150 Int. J. Softw. Tools Technol. Transf. <b>22</b>(1): 57-78 (2020)
198 </em>{' '} 151 </Publication>
199 Int. J. Softw. Tools Technol. Transf. <b>22</b>(1): 57-78 (2020) 152 <Publication
200 </Publication> 153 doi="10.1007/s10270-021-00884-z"
201 <Publication 154 pdf="https://link.springer.com/content/pdf/10.1007/s10270-021-00884-z.pdf?pdf=button"
202 doi="10.1007/s10270-021-00884-z" 155 >
203 pdf="https://link.springer.com/content/pdf/10.1007/s10270-021-00884-z.pdf?pdf=button" 156 O. Semeráth, A. Babikian, B. Chen, C. Li, K. Marussy, G. Szárnyas,
204 > 157 D. Varró:{' '}
205 O. Semeráth, A. Babikian, B. Chen, C. Li, K. Marussy, G. 158 <em>
206 Szárnyas, D. Varró:{' '} 159 Automated generation of consistent, diverse and structurally
207 <em> 160 realistic graph models.
208 Automated generation of consistent, diverse and structurally 161 </em>{' '}
209 realistic graph models. 162 Softw. Syst. Model. <b>20</b>(5): 1713-1734 (2021)
210 </em>{' '} 163 </Publication>
211 Softw. Syst. Model. <b>20</b>(5): 1713-1734 (2021) 164 </ul>
212 </Publication> 165 </div>
213 </ul> 166 <div className="col col--6">
214 </div> 167 <h3>Consistent graph generation techniques</h3>
215 <div className="col col--6"> 168 <ul>
216 <h3>Consistent graph generation techniques</h3> 169 <Publication
217 <ul> 170 doi="10.1145/3180155.3180186"
218 <Publication 171 pdf="https://dl.acm.org/doi/pdf/10.1145/3180155.3180186"
219 doi="10.1145/3180155.3180186" 172 >
220 pdf="https://dl.acm.org/doi/pdf/10.1145/3180155.3180186" 173 O. Semeráth, A. Nagy, D. Varró: &ldquo;A graph solver for the
221 > 174 automated generation of consistent domain-specific models.&rdquo;{' '}
222 O. Semeráth, A. Nagy, D. Varró: &ldquo;A graph solver for the 175 <em>ICSE 2018:</em> 969-980
223 automated generation of consistent domain-specific 176 </Publication>
224 models.&rdquo; <em>ICSE 2018:</em> 969-980 177 <Publication
225 </Publication> 178 doi="10.1109/TSE.2020.3025732"
226 <Publication 179 pdf="https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=9201551"
227 doi="10.1109/TSE.2020.3025732" 180 >
228 pdf="https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=9201551" 181 K. Marussy, O. Semeráth, D. Varró:{' '}
229 > 182 <em>
230 K. Marussy, O. Semeráth, D. Varró:{' '} 183 Automated Generation of Consistent Graph Models With
231 <em> 184 Multiplicity Reasoning.
232 Automated Generation of Consistent Graph Models With 185 </em>{' '}
233 Multiplicity Reasoning. 186 IEEE Trans. Softw. Eng. <b>48</b>(5): 1610-1629 (2022)
234 </em>{' '} 187 </Publication>
235 IEEE Trans. Softw. Eng. <b>48</b>(5): 1610-1629 (2022) 188 <Publication
236 </Publication> 189 doi="10.1007/s10270-021-00918-6"
237 <Publication 190 pdf="https://link.springer.com/content/pdf/10.1007/s10270-021-00918-6.pdf?pdf=button"
238 doi="10.1007/s10270-021-00918-6" 191 >
239 pdf="https://link.springer.com/content/pdf/10.1007/s10270-021-00918-6.pdf?pdf=button" 192 A. Babikian, O. Semeráth, A. Li, K. Marussy, D. Varró:{' '}
240 > 193 <em>
241 A. Babikian, O. Semeráth, A. Li, K. Marussy, D. Varró:{' '} 194 Automated generation of consistent models using qualitative
242 <em> 195 abstractions and exploration strategies.
243 Automated generation of consistent models using qualitative 196 </em>{' '}
244 abstractions and exploration strategies. 197 Softw. Syst. Model. <b>21</b>(5): 1763-1787 (2022)
245 </em>{' '} 198 </Publication>
246 Softw. Syst. Model. <b>21</b>(5): 1763-1787 (2022) 199 </ul>
247 </Publication> 200 <h3>Correctness proofs</h3>
248 </ul> 201 <ul>
249 <h3>Correctness proofs</h3> 202 <Publication
250 <ul> 203 doi="10.1007/978-3-319-75396-6_16"
251 <Publication 204 pdf="https://inf.mit.bme.hu/sites/default/files/publications/fmhe-model-generation.pdf"
252 doi="10.1007/978-3-319-75396-6_16" 205 >
253 pdf="https://inf.mit.bme.hu/sites/default/files/publications/fmhe-model-generation.pdf" 206 D. Varró, O. Semeráth, G. Szárnyas, Á. Horváth: &ldquo;Towards the
254 > 207 Automated Generation of Consistent, Diverse, Scalable and
255 D. Varró, O. Semeráth, G. Szárnyas, Á. Horváth: &ldquo;Towards 208 Realistic Graph Models.&rdquo;{' '}
256 the Automated Generation of Consistent, Diverse, Scalable and 209 <em>Graph Transformation, Specifications, and Nets</em> 2018:
257 Realistic Graph Models.&rdquo;{' '} 210 285-312
258 <em>Graph Transformation, Specifications, and Nets</em> 2018: 211 </Publication>
259 285-312 212 </ul>
260 </Publication>
261 </ul>
262 </div>
263 </div> 213 </div>
264 </div> 214 </div>
265 </div> 215 </div>
@@ -270,11 +220,15 @@ export default function Home() {
270 return ( 220 return (
271 <Layout> 221 <Layout>
272 <Hero /> 222 <Hero />
273 <div className={styles['section']}> 223 <section className={styles['section']}>
274 <Features /> 224 <Features />
275 </div> 225 </section>
276 <Video /> 226 <section className={clsx(styles['section'], styles['section--video'])}>
277 <Publications /> 227 <Video />
228 </section>
229 <section className={styles['section']}>
230 <Publications />
231 </section>
278 </Layout> 232 </Layout>
279 ); 233 );
280} 234}
diff --git a/subprojects/docs/src/pages/video-cover.webp b/subprojects/docs/src/pages/video-cover.webp
deleted file mode 100644
index 50ebe1ab..00000000
--- a/subprojects/docs/src/pages/video-cover.webp
+++ /dev/null
Binary files differ
diff --git a/subprojects/docs/src/pages/video-cover.webp.license b/subprojects/docs/src/pages/video-cover.webp.license
deleted file mode 100644
index ff75bc7c..00000000
--- a/subprojects/docs/src/pages/video-cover.webp.license
+++ /dev/null
@@ -1,3 +0,0 @@
1SPDX-FileCopyrightText: 2023 The Refinery Authors <https://refinery.tools/>
2
3SPDX-License-Identifier: EPL-2.0
diff --git a/subprojects/docs/src/plugins/loadersPlugin.ts b/subprojects/docs/src/plugins/loadersPlugin.ts
index 325d7f67..8b52667c 100644
--- a/subprojects/docs/src/plugins/loadersPlugin.ts
+++ b/subprojects/docs/src/plugins/loadersPlugin.ts
@@ -1,15 +1,19 @@
1/* 1/*
2 * SPDX-FileCopyrightText: 2024 The Refinery Authors 2 * Copyright (c) 2016, Jeremy Stucki
3 * Copyright (c) Facebook, Inc. and its affiliates.
4 * Copyright (c) 2024 The Refinery Authors
3 * 5 *
4 * SPDX-License-Identifier: EPL-2.0 6 * SPDX-License-Identifier: BSD-3-Clause AND MIT AND EPL-2.0
5 */ 7 */
6 8
7import type { Plugin } from '@docusaurus/types'; 9import type { Plugin } from '@docusaurus/types';
10// @ts-expect-error No typings available for `responsive-loader`.
11import sharp from 'responsive-loader/sharp';
8 12
9export default function loadersPlugin(): Plugin { 13export default function loadersPlugin(): Plugin {
10 return { 14 return {
11 name: 'refinery-loaders-plugin', 15 name: 'refinery-loaders-plugin',
12 configureWebpack(config) { 16 configureWebpack(config, isServer) {
13 let svgoDisabled = false; 17 let svgoDisabled = false;
14 const rules = [...(config.module?.rules ?? [])]; 18 const rules = [...(config.module?.rules ?? [])];
15 rules.forEach((rule) => { 19 rules.forEach((rule) => {
@@ -38,6 +42,8 @@ export default function loadersPlugin(): Plugin {
38 ) { 42 ) {
39 return; 43 return;
40 } 44 }
45 // Skip SVGR when importing SVG files with ?url.
46 svgLoader.resourceQuery = { not: /[?&]url$/ };
41 const { 47 const {
42 use: [loader], 48 use: [loader],
43 } = svgLoader; 49 } = svgLoader;
@@ -48,6 +54,7 @@ export default function loadersPlugin(): Plugin {
48 ) { 54 ) {
49 return; 55 return;
50 } 56 }
57
51 loader.options = { 58 loader.options = {
52 ...(typeof loader.options === 'object' ? loader.options : {}), 59 ...(typeof loader.options === 'object' ? loader.options : {}),
53 svgo: true, 60 svgo: true,
@@ -78,7 +85,31 @@ export default function loadersPlugin(): Plugin {
78 'module.rules': 'replace', 85 'module.rules': 'replace',
79 }, 86 },
80 module: { 87 module: {
81 rules, 88 rules: [
89 // Configuration based on
90 // https://github.com/dazuaz/responsive-loader/blob/ef2c806fcd36f06f6be8a0b97e09f40c3d86d3ac/README.md
91 {
92 test: /\.(png|jpe?g)$/,
93 resourceQuery: /[?&]rl$/,
94 use: [
95 {
96 loader: 'responsive-loader',
97 options: {
98 /* eslint-disable-next-line @typescript-eslint/no-unsafe-assignment --
99 * No typings available for `responsive-loader`.
100 */
101 adapter: sharp,
102 format: 'webp',
103 // See
104 // https://github.com/facebook/docusaurus/blob/c745021b01a8b88d34e1d772278d7171ad8acdf5/packages/docusaurus-plugin-ideal-image/src/index.ts#L62-L66
105 emitFile: !isServer,
106 name: 'assets/images/[name].[hash:hex:7].[width].[ext]',
107 },
108 },
109 ],
110 },
111 ...rules,
112 ],
82 }, 113 },
83 }; 114 };
84 }, 115 },
diff --git a/subprojects/docs/src/types.d.ts b/subprojects/docs/src/types.d.ts
index 0d1b2226..658763e7 100644
--- a/subprojects/docs/src/types.d.ts
+++ b/subprojects/docs/src/types.d.ts
@@ -1,10 +1,39 @@
1/* 1/*
2 * SPDX-FileCopyrightText: 2024 The Refinery Authors 2 * Copyright (c) 2016, Jeremy Stucki
3 * Copyright (c) 2024 The Refinery Authors
3 * 4 *
4 * SPDX-License-Identifier: EPL-2.0 5 * SPDX-License-Identifier: BSD-3-Clause AND EPL-2.0
6 *
7 * Typings for `ResponsiveImageOutput` copied from
8 * https://github.com/dazuaz/responsive-loader/blob/ef2c806fcd36f06f6be8a0b97e09f40c3d86d3ac/README.md
5 */ 9 */
6 10
7declare module '*?url' { 11declare module '*?url' {
8 const url: string; 12 const url: string;
9 export default url; 13 export default url;
10} 14}
15
16declare module '*&url' {
17 const url: string;
18 export default url;
19}
20
21interface ResponsiveImageOutput {
22 src: string;
23 srcSet: string;
24 placeholder: string | undefined;
25 images: { path: string; width: number; height: number }[];
26 width: number;
27 height: number;
28 toString: () => string;
29}
30
31declare module '*?rl' {
32 const src: ResponsiveImageOutput;
33 export default src;
34}
35
36declare module '*&rl' {
37 const src: ResponsiveImageOutput;
38 export default src;
39}