File tree 3 files changed +39
-9
lines changed
src/routes/about-the-test-set
3 files changed +39
-9
lines changed Original file line number Diff line number Diff line change 28
28
"hastscript" : " ^7.1.0" ,
29
29
"highlight.js" : " ^11.7.0" ,
30
30
"mdsvex" : " ^0.10.6" ,
31
- "periodic-tables" : " ^0.1.4" ,
32
31
"prettier" : " ^2.8.1" ,
33
32
"prettier-plugin-svelte" : " ^2.9.0" ,
34
33
"rehype-autolink-headings" : " ^6.1.1" ,
39
38
"svelte-preprocess" : " ^5.0.0" ,
40
39
"svelte-toc" : " ^0.5.1" ,
41
40
"svelte2tsx" : " ^0.6.0" ,
41
+ "sveriodic-table" : " ^0.1.1" ,
42
42
"tslib" : " ^2.4.1" ,
43
43
"typescript" : " ^4.9.4" ,
44
- "vite" : " ^4.0.3 "
44
+ "vite" : " ^4.0.4 "
45
45
},
46
46
"prettier" : {
47
47
"semi" : false ,
Original file line number Diff line number Diff line change 1
1
<script lang =" ts" >
2
2
import FormEnergyHist from ' $root/data/wbm/2022-12-07-hist-e-form-per-atom.svelte'
3
3
import DataReadme from ' $root/data/wbm/readme.md'
4
- // import { PeriodicTable, Toggle } from 'periodic-tables '
5
- import PeriodicTable from ' periodic-tables '
6
- import Toggle from ' periodic-tables/Toggle.svelte '
4
+ import type { ChemicalElement } from ' sveriodic-table '
5
+ import { PeriodicTable , TableInset , Toggle } from ' sveriodic-table '
6
+ import { pretty_num } from ' sveriodic-table/labels '
7
7
import elem_counts from ' ./2022-12-30-wbm-element-counts.json'
8
8
9
+ let log_color_scale = false
9
10
const heatmap_values = Object .values (elem_counts )
10
11
const color_map = {
11
12
200 : ` blue ` ,
12
13
35_000 : ` green ` ,
13
14
80_000 : ` yellow ` ,
14
15
150_000 : ` red ` ,
15
16
}
16
-
17
- let log = true
17
+ let active_element: ChemicalElement
18
18
</script >
19
19
20
20
<DataReadme >
24
24
{/if }
25
25
</svelte:fragment >
26
26
<svelte:fragment slot =" wbm-elements-log" >
27
- <span >Log color scale? <Toggle bind:checked ={log } /></span >
28
- <PeriodicTable {heatmap_values } {color_map } {log } />
27
+ <span >Log color scale <Toggle bind:checked ={log_color_scale } /></span >
28
+ <PeriodicTable {heatmap_values } {color_map } log ={log_color_scale } bind:active _element>
29
+ <TableInset slot =" inset" grid _row=" 3" >
30
+ {#if active_element ?.name }
31
+ <strong >
32
+ {active_element ?.name }: {pretty_num (elem_counts [active_element ?.symbol ])}
33
+ </strong >
34
+ {/if }
35
+ </TableInset >
36
+ </PeriodicTable >
29
37
</svelte:fragment >
30
38
</DataReadme >
31
39
38
46
transform : translateX (-50% );
39
47
z-index : 1 ;
40
48
}
49
+ strong {
50
+ text-align : center ;
51
+ }
41
52
</style >
Original file line number Diff line number Diff line change 1
1
import yaml from '@rollup/plugin-yaml'
2
2
import { sveltekit } from '@sveltejs/kit/vite'
3
+ import { exec } from 'child_process'
3
4
import { resolve } from 'path'
4
5
import type { UserConfig } from 'vite'
5
6
@@ -25,3 +26,21 @@ const vite_config: UserConfig = {
25
26
}
26
27
27
28
export default vite_config
29
+
30
+ if ( process . env . PROD ) {
31
+ // update generated API docs on production builds
32
+ const src_url = `https://github.com/janosh/matbench-discovery/blob/main`
33
+ const route = `src/routes/api`
34
+ await exec ( `rm -f ${ route } /*.md` )
35
+ await exec (
36
+ `cd .. && lazydocs matbench_discovery --output-path site/${ route } --no-watermark --src-base-url ${ src_url } `
37
+ )
38
+
39
+ // remove <b> tags from generated markdown
40
+ await exec ( `sed -i 's/<b>//g' ${ route } /*.md` )
41
+ await exec ( `sed -i 's/<\\/b>//g' ${ route } /*.md` )
42
+ // tweak look of badges linking to source code
43
+ const old_src = `src="https://img.shields.io/badge/-source-cccccc?style=flat-square"`
44
+ const new_src = `src="https://img.shields.io/badge/source-blue?style=flat" alt="source link"`
45
+ await exec ( `sed -i 's/${ old_src } /${ new_src } /g' ${ route } /*.md` )
46
+ }
You can’t perform that action at this time.
0 commit comments