diff --git a/scripts/upload_data_files_to_figshare.py b/scripts/upload_data_files_to_figshare.py index dbd39c25..c3c13d85 100644 --- a/scripts/upload_data_files_to_figshare.py +++ b/scripts/upload_data_files_to_figshare.py @@ -33,8 +33,10 @@ def main( article will be created. pyproject (dict[str, Any]): Dictionary containing the project metadata. max_file_size (int): Maximum file size in bytes to be uploaded automatically. - files (list[DataFiles] | None): List of DataFiles to upload. + files (list[DataFiles] | None): Which attributes of DataFiles to upload. + Defaults to all. """ + article_is_new = False if article_id is not None: # Check if article exists and is accessible if figshare.article_exists(article_id): @@ -71,10 +73,12 @@ def main( if article_id is None: article_id = figshare.create_article(metadata) + article_is_new = True print( f"\n⚠️ Created new Figshare article with {article_id=}" f"\nUpdate FIGSHARE_ARTICLE_ID in {__file__} with this ID!" ) + article_url = f"{figshare.ARTICLE_URL_PREFIX}/{article_id}" try: # Load existing YAML data if available @@ -158,6 +162,18 @@ def main( print("\nUpdated files:") for idx, (data_file, url) in enumerate(updated_files.items(), start=1): print(f"{idx}. {data_file}: {url}") + + # Publish the article if any new files were added and it's not newly created + if article_is_new: + print( + "\n⚠️ Article was newly created. Please review it at " + f"{article_url} before publishing manually." + ) + else: + print( + f"\nFiles were added or updated. Publishing article {article_url}" + ) + figshare.publish_article(article_id) else: print("\nNo files were added or updated.") diff --git a/scripts/upload_model_preds_to_figshare.py b/scripts/upload_model_preds_to_figshare.py index 6e50d9dc..080e7089 100644 --- a/scripts/upload_model_preds_to_figshare.py +++ b/scripts/upload_model_preds_to_figshare.py @@ -150,6 +150,7 @@ def update_one_modeling_task_article( ) -> None: """Update or create a Figshare article for a modeling task.""" article_id = figshare.ARTICLE_IDS[f"model_preds_{task}"] + article_is_new = False if article_id is not None: # Check if article exists and is accessible @@ -166,6 +167,7 @@ def update_one_modeling_task_article( else: metadata = get_article_metadata(task) article_id = figshare.create_article(metadata) + article_is_new = True print( f"\n⚠️ Created new Figshare article for {task=} with {article_id=}" f"\nUpdate figshare.ARTICLE_IDS with this ID!" @@ -335,10 +337,16 @@ def find_file_keys(data: dict[str, Any], prefix: str = "") -> dict[str, str]: ): print(f"{idx}. {model.name} {filename}: {url}") - # Publish the article if any new files were added and it's not a dry run - if (new_files or updated_files) and not dry_run: - print("\nNew or updated files were added. Publishing the article...") + # Publish the article if any new files were added, it's not a dry run, + # and the article wasn't newly created + if (new_files or updated_files) and not dry_run and not article_is_new: + print(f"\nFiles were added or updated. Publishing article {article_url}") figshare.publish_article(article_id) + elif article_is_new: + print( + "\n⚠️ Article was newly created. Please review it at " + f"{article_url} before publishing manually." + ) else: print("\nNo files were added or updated.") diff --git a/site/package.json b/site/package.json index 1e24b5ab..63eb5c5c 100644 --- a/site/package.json +++ b/site/package.json @@ -19,24 +19,24 @@ }, "devDependencies": { "@rollup/plugin-yaml": "^4.1.2", - "@stylistic/eslint-plugin": "^3.1.0", + "@stylistic/eslint-plugin": "^4.2.0", "@sveltejs/adapter-static": "^3.0.8", - "@sveltejs/kit": "^2.17.2", - "@sveltejs/vite-plugin-svelte": "^4.0.3", + "@sveltejs/kit": "^2.20.2", + "@sveltejs/vite-plugin-svelte": "^5.0.3", "d3-array": "^3.2.4", "d3-scale": "^4.0.2", "d3-scale-chromatic": "^3.1.0", - "elementari": "^0.2.7", - "eslint": "^9.20.1", - "eslint-plugin-svelte": "^2.46.1", - "hastscript": "^9.0.0", + "elementari": "^0.3.0", + "eslint": "^9.23.0", + "eslint-plugin-svelte": "^3.3.3", + "hastscript": "^9.0.1", "iconify-icon": "^2.3.0", "js-yaml": "^4.1.0", "jsdom": "^26.0.0", "json-schema-to-typescript": "^15.0.4", "katex": "^0.16.21", "mdsvex": "^0.12.3", - "prettier": "^3.5.1", + "prettier": "^3.5.3", "prettier-plugin-svelte": "^3.3.3", "rehype-autolink-headings": "^7.1.0", "rehype-katex-svelte": "^1.2.0", @@ -45,19 +45,19 @@ "remark-math": "6.0.0", "remark-parse": "^11.0.0", "remark-rehype": "^11.1.1", - "svelte": "^5.20.1", - "svelte-check": "^4.1.4", + "svelte": "^5.25.3", + "svelte-check": "^4.1.5", "svelte-multiselect": "11.0.0-rc.1", "svelte-preprocess": "^6.0.3", "svelte-toc": "^0.5.9", "svelte-zoo": "^0.4.17", - "svelte2tsx": "^0.7.34", + "svelte2tsx": "^0.7.35", "tslib": "^2.8.1", - "typescript": "5.7.3", - "typescript-eslint": "^8.24.1", + "typescript": "5.8.2", + "typescript-eslint": "^8.28.0", "unified": "^11.0.5", - "vite": "^5.4.11", - "vitest": "^3.0.5" + "vite": "^6.2.3", + "vitest": "^3.0.9" }, "prettier": { "semi": false, diff --git a/site/src/figs/bar-element-counts-mp+wbm-normalized=False.svelte b/site/src/figs/bar-element-counts-mp+wbm-normalized=False.svelte index 917dcc41..4d889017 100644 --- a/site/src/figs/bar-element-counts-mp+wbm-normalized=False.svelte +++ b/site/src/figs/bar-element-counts-mp+wbm-normalized=False.svelte @@ -1 +1 @@ -
+
diff --git a/site/src/lib/MetricScatter.svelte b/site/src/lib/MetricScatter.svelte index 48d809ce..bf5e7247 100644 --- a/site/src/lib/MetricScatter.svelte +++ b/site/src/lib/MetricScatter.svelte @@ -80,8 +80,7 @@ {/each} -

+

Added {model.date_added} @@ -135,7 +135,7 @@ {/each} {/if} -

+
{#if show_details}
@@ -244,7 +244,7 @@ gap: 6pt; place-items: center; } - p { + section.metadata { display: grid; gap: 5pt; grid-template-columns: 1fr 1fr; diff --git a/site/src/lib/Nav.svelte b/site/src/lib/Nav.svelte index 6cc56fc5..ff49745a 100644 --- a/site/src/lib/Nav.svelte +++ b/site/src/lib/Nav.svelte @@ -1,16 +1,16 @@ diff --git a/site/src/lib/PtableHeatmap.svelte b/site/src/lib/PtableHeatmap.svelte index b671b971..d9bb3f6f 100644 --- a/site/src/lib/PtableHeatmap.svelte +++ b/site/src/lib/PtableHeatmap.svelte @@ -6,20 +6,20 @@ import type { Snapshot } from './$types' interface Props { - heatmap_values: Record; - color_scale?: string; - active_element: ChemicalElement; - log?: boolean; // log color scale - color_bar_props?: ComponentProps; + heatmap_values: Record + color_scale?: string + active_element: ChemicalElement | null + log?: boolean // log color scale + color_bar_props?: ComponentProps } let { heatmap_values, color_scale = $bindable(`Viridis`), - active_element = $bindable(), + active_element = $bindable(null), log = $bindable(false), - color_bar_props = {} - }: Props = $props(); + color_bar_props = {}, + }: Props = $props() export const snapshot: Snapshot = { capture: () => ({ color_scale, log }), @@ -35,7 +35,7 @@ show_photo={false} > {#snippet inset()} - + - import { page } from '$app/stores' + import { page } from '$app/state' import { homepage, name } from '$site/package.json' import 'iconify-icon' @@ -7,14 +7,14 @@ - Error {$page.status} • {name} + Error {page.status} • {name}
-

Error {String($page.status).replace(`0`, `😵`)}: {$page.error?.message}

- {#if $page.status >= 500} +

Error {String(page.status).replace(`0`, `😵`)}: {page.error?.message}

+ {#if page.status >= 500}

If page reloading doesn't help, please raise an issue on GitHub. Thanks! 🙏 diff --git a/site/src/routes/+layout.svelte b/site/src/routes/+layout.svelte index efd71486..a5f40f34 100644 --- a/site/src/routes/+layout.svelte +++ b/site/src/routes/+layout.svelte @@ -1,25 +1,24 @@ diff --git a/site/src/routes/data/+page.svelte b/site/src/routes/data/+page.svelte index 849d53c0..dc401a22 100644 --- a/site/src/routes/data/+page.svelte +++ b/site/src/routes/data/+page.svelte @@ -17,10 +17,7 @@ const elem_counts = import.meta.glob( `./*-element-counts-by-{occurrence,composition}*.json`, - { - eager: true, - import: `default`, - }, + { eager: true, import: `default` }, ) let log = $state(false) // log color scale @@ -109,8 +106,10 @@ {#snippet spacegroup_sunbursts()} {#if browser} - - +

+ + +
{/if} {/snippet} diff --git a/site/src/routes/data/mptrj/MPtrjElemCountsPtable.svelte b/site/src/routes/data/mptrj/MPtrjElemCountsPtable.svelte index f659ca1f..0f963c2c 100644 --- a/site/src/routes/data/mptrj/MPtrjElemCountsPtable.svelte +++ b/site/src/routes/data/mptrj/MPtrjElemCountsPtable.svelte @@ -5,17 +5,20 @@ interface Props extends ComponentProps { count_mode?: string } - let { count_mode = `occurrence`, ...rest }: Props = $props() const elem_counts = import.meta.glob(`../mp-trj-element-counts-by-*.json`, { eager: true, import: `default`, - }) + }) as Record> + + let mp_trj_elem_counts = elem_counts[`../mp-trj-element-counts-by-${count_mode}.json`] - let mp_trj_elem_counts = $derived( - elem_counts[`../mp-trj-element-counts-by-${count_mode}.json`], - ) + $effect(() => { + if (!(`mp_trj_json_gz` in data_files)) { + throw `mp_trj_json_gz not found in data-files.yml` + } + })

@@ -25,7 +28,7 @@

diff --git a/site/src/routes/data/tmi/+page.svelte b/site/src/routes/data/tmi/+page.svelte index ad65f272..f036c104 100644 --- a/site/src/routes/data/tmi/+page.svelte +++ b/site/src/routes/data/tmi/+page.svelte @@ -7,10 +7,12 @@ import { ColorScaleSelect, PeriodicTable, TableInset } from 'elementari' import { RadioButtons, Toggle } from 'svelte-zoo' - const elem_counts = $state(import.meta.glob(`../wbm-element-counts-*=*.json`, { - eager: true, - import: `default`, - })) + const elem_counts = $state( + import.meta.glob(`../wbm-element-counts-*=*.json`, { + eager: true, + import: `default`, + }), + ) for (const key of Object.keys(elem_counts)) { const new_key = key?.split(`-`).at(-1)?.split(`.`)[0] as string elem_counts[new_key] = elem_counts[key] @@ -21,7 +23,7 @@ let log = $state(false) // log color scale let filter = $state(arity_keys[0]) let color_scale = $state([`Viridis`]) - let active_element: ChemicalElement = $state() + let active_element: ChemicalElement | null = $state(null) let active_counts = $derived(elem_counts[filter]) let normalized_bar_counts: boolean = $state(false) @@ -49,20 +51,16 @@ composition arity {#snippet option({ option, active })} - - {option?.split(`=`)[1]} - {/snippet} + {option?.split(`=`)[1]} + {/snippet} batch index {#snippet option({ option, active })} - - {option?.split(`=`)[1]} - {/snippet} + {option?.split(`=`)[1]} + {/snippet} @@ -75,7 +73,7 @@ show_photo={false} > {#snippet inset()} - + Log color scale diff --git a/site/src/routes/models/+page.svelte b/site/src/routes/models/+page.svelte index d748b0d1..ec55309c 100644 --- a/site/src/routes/models/+page.svelte +++ b/site/src/routes/models/+page.svelte @@ -102,7 +102,7 @@
    - {#each [{ key: `model_name`, label: `Model Name` }, ...stats] as { key, label, tooltip } (key)} + {#each [{ key: `model_name`, label: `Model Name`, tooltip: undefined }, ...stats] as { key, label, tooltip } (key)}