matterviz 0.1.12 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ContextMenu.svelte +1 -1
- package/dist/ContextMenu.svelte.d.ts +3 -3
- package/dist/DraggablePane.svelte +10 -5
- package/dist/DraggablePane.svelte.d.ts +3 -3
- package/dist/FilePicker.svelte.d.ts +3 -3
- package/dist/Icon.svelte.d.ts +3 -3
- package/dist/Nav.svelte +76 -31
- package/dist/SettingsSection.svelte.d.ts +3 -3
- package/dist/Spinner.svelte +18 -29
- package/dist/Spinner.svelte.d.ts +3 -3
- package/dist/app.css +4 -0
- package/dist/bands/Bands.svelte +216 -0
- package/dist/bands/Bands.svelte.d.ts +16 -0
- package/dist/bands/BandsAndDos.svelte +26 -0
- package/dist/bands/BandsAndDos.svelte.d.ts +16 -0
- package/dist/bands/Dos.svelte +124 -0
- package/dist/bands/Dos.svelte.d.ts +18 -0
- package/dist/bands/helpers.d.ts +11 -0
- package/dist/bands/helpers.js +195 -0
- package/dist/bands/index.d.ts +5 -0
- package/dist/bands/index.js +6 -0
- package/dist/bands/types.d.ts +54 -0
- package/dist/bands/types.js +2 -0
- package/dist/brillouin/BrillouinZone.svelte +373 -0
- package/dist/brillouin/BrillouinZone.svelte.d.ts +57 -0
- package/dist/brillouin/BrillouinZoneControls.svelte +88 -0
- package/dist/brillouin/BrillouinZoneControls.svelte.d.ts +14 -0
- package/dist/brillouin/BrillouinZoneExportPane.svelte +129 -0
- package/dist/brillouin/BrillouinZoneExportPane.svelte.d.ts +15 -0
- package/dist/brillouin/BrillouinZoneInfoPane.svelte +115 -0
- package/dist/brillouin/BrillouinZoneInfoPane.svelte.d.ts +13 -0
- package/dist/brillouin/BrillouinZoneScene.svelte +180 -0
- package/dist/brillouin/BrillouinZoneScene.svelte.d.ts +34 -0
- package/dist/brillouin/compute.d.ts +7 -0
- package/dist/brillouin/compute.js +215 -0
- package/dist/brillouin/index.d.ts +7 -0
- package/dist/brillouin/index.js +7 -0
- package/dist/brillouin/types.d.ts +23 -0
- package/dist/brillouin/types.js +1 -0
- package/dist/composition/BarChart.svelte.d.ts +3 -3
- package/dist/composition/BubbleChart.svelte +7 -6
- package/dist/composition/BubbleChart.svelte.d.ts +3 -3
- package/dist/composition/Composition.svelte.d.ts +3 -3
- package/dist/composition/PieChart.svelte +1 -1
- package/dist/composition/PieChart.svelte.d.ts +3 -3
- package/dist/composition/parse.d.ts +3 -3
- package/dist/coordination/CoordinationBarPlot.svelte +241 -0
- package/dist/coordination/CoordinationBarPlot.svelte.d.ts +29 -0
- package/dist/coordination/calc-coordination.d.ts +15 -0
- package/dist/coordination/calc-coordination.js +66 -0
- package/dist/coordination/index.d.ts +8 -0
- package/dist/coordination/index.js +7 -0
- package/dist/element/BohrAtom.svelte.d.ts +3 -3
- package/dist/element/ElementHeading.svelte.d.ts +3 -3
- package/dist/element/ElementPhoto.svelte.d.ts +3 -3
- package/dist/element/ElementStats.svelte.d.ts +3 -3
- package/dist/element/ElementTile.svelte +1 -1
- package/dist/element/ElementTile.svelte.d.ts +4 -4
- package/dist/element/Nucleus.svelte.d.ts +3 -3
- package/dist/icons.d.ts +4 -0
- package/dist/icons.js +4 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +5 -1
- package/dist/io/export.d.ts +1 -6
- package/dist/io/export.js +12 -12
- package/dist/labels.d.ts +19 -0
- package/dist/labels.js +59 -0
- package/dist/math.d.ts +7 -2
- package/dist/math.js +24 -12
- package/dist/periodic-table/PeriodicTable.svelte.d.ts +3 -3
- package/dist/periodic-table/PeriodicTableControls.svelte.d.ts +3 -3
- package/dist/periodic-table/PropertySelect.svelte +1 -1
- package/dist/periodic-table/PropertySelect.svelte.d.ts +5 -4
- package/dist/periodic-table/TableInset.svelte.d.ts +3 -3
- package/dist/phase-diagram/PhaseDiagram2D.svelte +44 -107
- package/dist/phase-diagram/PhaseDiagram2D.svelte.d.ts +7 -27
- package/dist/phase-diagram/PhaseDiagram3D.svelte +67 -170
- package/dist/phase-diagram/PhaseDiagram3D.svelte.d.ts +7 -31
- package/dist/phase-diagram/PhaseDiagram4D.svelte +87 -145
- package/dist/phase-diagram/PhaseDiagram4D.svelte.d.ts +5 -28
- package/dist/phase-diagram/PhaseDiagramControls.svelte +9 -9
- package/dist/phase-diagram/PhaseDiagramControls.svelte.d.ts +6 -6
- package/dist/phase-diagram/PhaseDiagramInfoPane.svelte +4 -4
- package/dist/phase-diagram/PhaseDiagramInfoPane.svelte.d.ts +5 -5
- package/dist/phase-diagram/PhaseDiagramStats.svelte +9 -16
- package/dist/phase-diagram/PhaseDiagramStats.svelte.d.ts +3 -3
- package/dist/phase-diagram/StructurePopup.svelte.d.ts +3 -3
- package/dist/phase-diagram/barycentric-coords.js +13 -24
- package/dist/phase-diagram/helpers.d.ts +12 -14
- package/dist/phase-diagram/helpers.js +70 -23
- package/dist/phase-diagram/index.d.ts +58 -0
- package/dist/phase-diagram/index.js +44 -0
- package/dist/phase-diagram/thermodynamics.js +2 -3
- package/dist/phase-diagram/types.d.ts +3 -8
- package/dist/plot/BarPlot.svelte +474 -240
- package/dist/plot/BarPlot.svelte.d.ts +16 -37
- package/dist/plot/BarPlotControls.svelte +33 -201
- package/dist/plot/BarPlotControls.svelte.d.ts +11 -22
- package/dist/plot/ColorBar.svelte.d.ts +3 -3
- package/dist/plot/ColorScaleSelect.svelte +1 -1
- package/dist/plot/ColorScaleSelect.svelte.d.ts +3 -3
- package/dist/plot/ElementScatter.svelte +5 -5
- package/dist/plot/ElementScatter.svelte.d.ts +8 -8
- package/dist/plot/Histogram.svelte +318 -170
- package/dist/plot/Histogram.svelte.d.ts +21 -41
- package/dist/plot/HistogramControls.svelte +115 -347
- package/dist/plot/HistogramControls.svelte.d.ts +13 -28
- package/dist/plot/Line.svelte +1 -1
- package/dist/plot/Line.svelte.d.ts +4 -4
- package/dist/plot/PlotControls.svelte +280 -0
- package/dist/plot/PlotControls.svelte.d.ts +4 -0
- package/dist/plot/PlotLegend.svelte +9 -24
- package/dist/plot/PlotLegend.svelte.d.ts +3 -3
- package/dist/plot/ScatterPlot.svelte +536 -571
- package/dist/plot/ScatterPlot.svelte.d.ts +18 -90
- package/dist/plot/ScatterPlotControls.svelte +108 -316
- package/dist/plot/ScatterPlotControls.svelte.d.ts +11 -38
- package/dist/plot/ScatterPoint.svelte +1 -1
- package/dist/plot/ScatterPoint.svelte.d.ts +5 -5
- package/dist/plot/SpacegroupBarPlot.svelte +235 -0
- package/dist/plot/SpacegroupBarPlot.svelte.d.ts +9 -0
- package/dist/plot/data-transform.d.ts +2 -2
- package/dist/plot/data-transform.js +1 -5
- package/dist/plot/index.d.ts +12 -200
- package/dist/plot/index.js +14 -6
- package/dist/plot/layout.d.ts +10 -16
- package/dist/plot/layout.js +40 -25
- package/dist/plot/scales.d.ts +7 -8
- package/dist/plot/scales.js +22 -7
- package/dist/plot/types.d.ts +303 -0
- package/dist/plot/types.js +1 -0
- package/dist/rdf/RdfPlot.svelte +156 -0
- package/dist/rdf/RdfPlot.svelte.d.ts +20 -0
- package/dist/rdf/calc-rdf.d.ts +4 -0
- package/dist/rdf/calc-rdf.js +107 -0
- package/dist/rdf/index.d.ts +22 -0
- package/dist/rdf/index.js +2 -0
- package/dist/settings.d.ts +86 -75
- package/dist/settings.js +257 -155
- package/dist/structure/Bond.svelte +126 -110
- package/dist/structure/Bond.svelte.d.ts +7 -20
- package/dist/structure/CanvasTooltip.svelte.d.ts +4 -4
- package/dist/structure/Cylinder.svelte +29 -0
- package/dist/structure/Cylinder.svelte.d.ts +10 -0
- package/dist/structure/Lattice.svelte +1 -2
- package/dist/structure/Lattice.svelte.d.ts +3 -3
- package/dist/structure/Structure.svelte +23 -8
- package/dist/structure/Structure.svelte.d.ts +10 -7
- package/dist/structure/StructureControls.svelte +25 -134
- package/dist/structure/StructureControls.svelte.d.ts +4 -9
- package/dist/structure/StructureExportPane.svelte +188 -0
- package/dist/structure/StructureExportPane.svelte.d.ts +17 -0
- package/dist/structure/StructureInfoPane.svelte.d.ts +3 -3
- package/dist/structure/StructureLegend.svelte +91 -27
- package/dist/structure/StructureLegend.svelte.d.ts +5 -4
- package/dist/structure/StructureScene.svelte +93 -100
- package/dist/structure/StructureScene.svelte.d.ts +15 -12
- package/dist/structure/Vector.svelte +19 -25
- package/dist/structure/Vector.svelte.d.ts +3 -3
- package/dist/structure/bonding.d.ts +16 -14
- package/dist/structure/bonding.js +207 -216
- package/dist/structure/export.d.ts +3 -0
- package/dist/structure/export.js +120 -0
- package/dist/structure/index.d.ts +15 -1
- package/dist/structure/index.js +2 -0
- package/dist/symmetry/WyckoffTable.svelte.d.ts +3 -3
- package/dist/symmetry/index.d.ts +1 -0
- package/dist/symmetry/index.js +1 -0
- package/dist/symmetry/spacegroups.d.ts +9 -0
- package/dist/symmetry/spacegroups.js +397 -0
- package/dist/theme/ThemeControl.svelte.d.ts +3 -3
- package/dist/theme/themes.js +2 -16
- package/dist/trajectory/Trajectory.svelte +52 -78
- package/dist/trajectory/Trajectory.svelte.d.ts +5 -5
- package/dist/trajectory/TrajectoryError.svelte.d.ts +3 -3
- package/dist/trajectory/TrajectoryExportPane.svelte +1 -1
- package/dist/trajectory/TrajectoryExportPane.svelte.d.ts +5 -5
- package/dist/trajectory/TrajectoryInfoPane.svelte +1 -1
- package/dist/trajectory/TrajectoryInfoPane.svelte.d.ts +3 -3
- package/dist/trajectory/extract.js +2 -1
- package/dist/trajectory/index.d.ts +1 -1
- package/dist/trajectory/index.js +1 -1
- package/dist/trajectory/parse.js +21 -14
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +17 -0
- package/dist/xrd/XrdPlot.svelte +14 -11
- package/dist/xrd/XrdPlot.svelte.d.ts +6 -5
- package/package.json +20 -12
- package/readme.md +1 -1
- package/dist/material/MaterialCard.svelte +0 -123
- package/dist/material/MaterialCard.svelte.d.ts +0 -9
- package/dist/material/index.d.ts +0 -1
- package/dist/material/index.js +0 -1
- package/dist/plot/formatting.d.ts +0 -7
- package/dist/plot/formatting.js +0 -53
|
@@ -1,39 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
import type { TicksOption } from './scales';
|
|
4
|
-
import type { ComponentProps, Snippet } from 'svelte';
|
|
1
|
+
import type { AxisConfig, BarMode, BarSeries, BarStyle, BarTooltipProps, BasePlotProps, DisplayConfig, LegendConfig, LineStyle, Orientation, UserContentProps } from './';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
5
3
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
6
|
-
|
|
4
|
+
type $$ComponentProps = HTMLAttributes<HTMLDivElement> & BasePlotProps & {
|
|
7
5
|
series?: BarSeries[];
|
|
6
|
+
x_axis?: AxisConfig;
|
|
7
|
+
y_axis?: AxisConfig;
|
|
8
|
+
y2_axis?: AxisConfig;
|
|
9
|
+
display?: DisplayConfig;
|
|
10
|
+
hovered?: boolean;
|
|
11
|
+
show_controls?: boolean;
|
|
12
|
+
controls_open?: boolean;
|
|
8
13
|
orientation?: Orientation;
|
|
9
14
|
mode?: BarMode;
|
|
10
|
-
x_lim?: [number | null, number | null];
|
|
11
|
-
y_lim?: [number | null, number | null];
|
|
12
|
-
x_range?: [number | null, number | null];
|
|
13
|
-
y_range?: [number | null, number | null];
|
|
14
|
-
range_padding?: number;
|
|
15
|
-
x_label?: string;
|
|
16
|
-
x_label_shift?: {
|
|
17
|
-
x?: number;
|
|
18
|
-
y?: number;
|
|
19
|
-
};
|
|
20
|
-
y_label?: string;
|
|
21
|
-
y_label_shift?: {
|
|
22
|
-
x?: number;
|
|
23
|
-
y?: number;
|
|
24
|
-
};
|
|
25
|
-
x_format?: string;
|
|
26
|
-
y_format?: string;
|
|
27
|
-
x_ticks?: TicksOption;
|
|
28
|
-
y_ticks?: TicksOption;
|
|
29
|
-
x_grid?: boolean | Record<string, unknown>;
|
|
30
|
-
y_grid?: boolean | Record<string, unknown>;
|
|
31
|
-
show_zero_lines?: boolean;
|
|
32
15
|
legend?: LegendConfig | null;
|
|
33
|
-
|
|
34
|
-
|
|
16
|
+
show_legend?: boolean;
|
|
17
|
+
bar?: BarStyle;
|
|
18
|
+
line?: LineStyle;
|
|
35
19
|
tooltip?: Snippet<[BarTooltipProps]>;
|
|
36
|
-
|
|
20
|
+
user_content?: Snippet<[UserContentProps]>;
|
|
37
21
|
change?: (data: BarTooltipProps | null) => void;
|
|
38
22
|
on_bar_click?: (data: BarTooltipProps & {
|
|
39
23
|
event: MouseEvent | KeyboardEvent;
|
|
@@ -41,12 +25,7 @@ interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
|
41
25
|
on_bar_hover?: (data: BarTooltipProps & {
|
|
42
26
|
event: MouseEvent;
|
|
43
27
|
} | null) => void;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
plot_controls?: Snippet<[]>;
|
|
47
|
-
controls_toggle_props?: ComponentProps<typeof DraggablePane>[`toggle_props`];
|
|
48
|
-
children?: Snippet<[]>;
|
|
49
|
-
}
|
|
50
|
-
declare const BarPlot: import("svelte").Component<Props, {}, "orientation" | "mode" | "show_controls" | "show_zero_lines" | "x_grid" | "y_grid" | "x_format" | "y_format" | "x_ticks" | "y_ticks" | "controls_open" | "hovered" | "series" | "x_label" | "y_label" | "x_label_shift" | "y_label_shift">;
|
|
28
|
+
};
|
|
29
|
+
declare const BarPlot: import("svelte").Component<$$ComponentProps, {}, "display" | "line" | "orientation" | "mode" | "bar" | "show_controls" | "y_axis" | "y2_axis" | "series" | "x_axis" | "hovered" | "controls_open">;
|
|
51
30
|
type BarPlot = ReturnType<typeof BarPlot>;
|
|
52
31
|
export default BarPlot;
|
|
@@ -1,204 +1,36 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
2
|
-
import {
|
|
3
|
-
let {
|
|
4
|
-
function set_auto_ranges() {
|
|
5
|
-
x_range = [...auto_x_range];
|
|
6
|
-
y_range = [...auto_y_range];
|
|
7
|
-
}
|
|
8
|
-
// Handlers similar to Histogram/Scatter controls
|
|
9
|
-
const ticks_input_handler = (axis) => (event) => {
|
|
10
|
-
const input = event.target;
|
|
11
|
-
const value = parseInt(input.value, 10);
|
|
12
|
-
if (!Number.isNaN(value) && value > 0) {
|
|
13
|
-
if (axis === `x`)
|
|
14
|
-
x_ticks = value;
|
|
15
|
-
else
|
|
16
|
-
y_ticks = value;
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
// Element refs for per-instance range inputs
|
|
20
|
-
const range_inputs = $state({
|
|
21
|
-
x: { min: null, max: null },
|
|
22
|
-
y: { min: null, max: null },
|
|
23
|
-
});
|
|
24
|
-
// Applies the min/max inputs for the given axis after blur/Enter.
|
|
25
|
-
// - Validates the pair (min < max)
|
|
26
|
-
// - When both inputs are empty, clears the bound range to fall back to auto
|
|
27
|
-
// - If one side is empty, substitutes the corresponding auto bound
|
|
28
|
-
const range_complete = (axis) => {
|
|
29
|
-
const min_el = range_inputs[axis].min;
|
|
30
|
-
const max_el = range_inputs[axis].max;
|
|
31
|
-
if (!min_el || !max_el)
|
|
32
|
-
return;
|
|
33
|
-
[min_el, max_el].forEach((el) => el.classList.remove(`invalid`));
|
|
34
|
-
const parse = (el) => (el.value === `` ? null : Number(el.value));
|
|
35
|
-
const min_val = parse(min_el);
|
|
36
|
-
const max_val = parse(max_el);
|
|
37
|
-
if (min_val !== null && max_val !== null && min_val >= max_val) {
|
|
38
|
-
min_el.classList.add(`invalid`);
|
|
39
|
-
max_el.classList.add(`invalid`);
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const final_range = min_val === null && max_val === null
|
|
43
|
-
? undefined
|
|
44
|
-
: [min_val, max_val];
|
|
45
|
-
if (axis === `x`)
|
|
46
|
-
x_range = final_range;
|
|
47
|
-
else
|
|
48
|
-
y_range = final_range;
|
|
49
|
-
};
|
|
50
|
-
const input_props = (axis, bound, range) => ({
|
|
51
|
-
type: `number`,
|
|
52
|
-
value: range?.[bound === `min` ? 0 : 1] ?? ``,
|
|
53
|
-
placeholder: `auto`,
|
|
54
|
-
class: `range-input`,
|
|
55
|
-
onblur: () => range_complete(axis),
|
|
56
|
-
onkeydown: (e) => e.key === `Enter` && e.target.blur(),
|
|
57
|
-
});
|
|
1
|
+
<script lang="ts">import { SettingsSection } from '..';
|
|
2
|
+
import { PlotControls } from './';
|
|
3
|
+
let { orientation = $bindable(`vertical`), mode = $bindable(`overlay`), x_axis = $bindable({}), y_axis = $bindable({}), y2_axis = $bindable({}), display = $bindable({}), show_controls = $bindable(false), controls_open = $bindable(false), ...rest } = $props();
|
|
58
4
|
</script>
|
|
59
5
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
pane_props={{
|
|
74
|
-
...pane_props,
|
|
75
|
-
class: `bar-controls-pane ${pane_props?.class ?? ``}`,
|
|
76
|
-
style: `--pane-padding: 4px; --pane-gap: 4px; ${pane_props?.style ?? ``}`,
|
|
77
|
-
}}
|
|
6
|
+
<PlotControls
|
|
7
|
+
bind:show_controls
|
|
8
|
+
bind:controls_open
|
|
9
|
+
bind:x_axis
|
|
10
|
+
bind:y_axis
|
|
11
|
+
bind:y2_axis
|
|
12
|
+
bind:display
|
|
13
|
+
{...rest}
|
|
14
|
+
>
|
|
15
|
+
<SettingsSection
|
|
16
|
+
title="Layout"
|
|
17
|
+
current_values={{ orientation, mode }}
|
|
18
|
+
style="display: flex; gap: 2ex"
|
|
78
19
|
>
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
<
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
</SettingsSection>
|
|
97
|
-
|
|
98
|
-
<SettingsSection
|
|
99
|
-
title="Layout"
|
|
100
|
-
current_values={{ orientation, mode }}
|
|
101
|
-
>
|
|
102
|
-
<label>Orientation:
|
|
103
|
-
<select bind:value={orientation} id="orientation-select">
|
|
104
|
-
<option value="vertical">Vertical</option>
|
|
105
|
-
<option value="horizontal">Horizontal</option>
|
|
106
|
-
</select>
|
|
107
|
-
</label>
|
|
108
|
-
<label>Mode:
|
|
109
|
-
<select bind:value={mode} id="mode-select">
|
|
110
|
-
<option value="overlay">Overlay</option>
|
|
111
|
-
<option value="stacked">Stacked</option>
|
|
112
|
-
<option value="grouped">Grouped (Side-by-Side)</option>
|
|
113
|
-
</select>
|
|
114
|
-
</label>
|
|
115
|
-
</SettingsSection>
|
|
116
|
-
|
|
117
|
-
<SettingsSection
|
|
118
|
-
title="Axis Range"
|
|
119
|
-
current_values={{ x_range, y_range }}
|
|
120
|
-
on_reset={() => {
|
|
121
|
-
x_range = undefined
|
|
122
|
-
y_range = undefined
|
|
123
|
-
}}
|
|
124
|
-
>
|
|
125
|
-
<label>X-axis:
|
|
126
|
-
<input
|
|
127
|
-
{...input_props(`x`, `min`, x_range)}
|
|
128
|
-
bind:this={range_inputs.x.min}
|
|
129
|
-
/>
|
|
130
|
-
to
|
|
131
|
-
<input
|
|
132
|
-
{...input_props(`x`, `max`, x_range)}
|
|
133
|
-
bind:this={range_inputs.x.max}
|
|
134
|
-
/>
|
|
135
|
-
</label>
|
|
136
|
-
<label>Y-axis:
|
|
137
|
-
<input
|
|
138
|
-
{...input_props(`y`, `min`, y_range)}
|
|
139
|
-
bind:this={range_inputs.y.min}
|
|
140
|
-
/>
|
|
141
|
-
to
|
|
142
|
-
<input
|
|
143
|
-
{...input_props(`y`, `max`, y_range)}
|
|
144
|
-
bind:this={range_inputs.y.max}
|
|
145
|
-
/>
|
|
146
|
-
</label>
|
|
147
|
-
<button onclick={set_auto_ranges} style="margin-left: 8px">auto</button>
|
|
148
|
-
</SettingsSection>
|
|
149
|
-
|
|
150
|
-
<SettingsSection
|
|
151
|
-
title="Ticks"
|
|
152
|
-
current_values={{ x_ticks, y_ticks }}
|
|
153
|
-
on_reset={() => {
|
|
154
|
-
x_ticks = DEFAULTS.plot.x_ticks
|
|
155
|
-
y_ticks = DEFAULTS.plot.y_ticks
|
|
156
|
-
}}
|
|
157
|
-
>
|
|
158
|
-
<label>X-axis:
|
|
159
|
-
<input
|
|
160
|
-
type="number"
|
|
161
|
-
min="2"
|
|
162
|
-
max="20"
|
|
163
|
-
step="1"
|
|
164
|
-
value={typeof x_ticks === `number` ? x_ticks : 8}
|
|
165
|
-
oninput={ticks_input_handler(`x`)}
|
|
166
|
-
/>
|
|
167
|
-
</label>
|
|
168
|
-
<label>Y-axis:
|
|
169
|
-
<input
|
|
170
|
-
type="number"
|
|
171
|
-
min="2"
|
|
172
|
-
max="20"
|
|
173
|
-
step="1"
|
|
174
|
-
value={typeof y_ticks === `number` ? y_ticks : 6}
|
|
175
|
-
oninput={ticks_input_handler(`y`)}
|
|
176
|
-
/>
|
|
177
|
-
</label>
|
|
178
|
-
</SettingsSection>
|
|
179
|
-
|
|
180
|
-
<SettingsSection
|
|
181
|
-
title="Tick Format"
|
|
182
|
-
current_values={{ x_format, y_format }}
|
|
183
|
-
on_reset={() => {
|
|
184
|
-
x_format = DEFAULTS.plot.x_format
|
|
185
|
-
y_format = DEFAULTS.plot.y_format
|
|
186
|
-
}}
|
|
187
|
-
>
|
|
188
|
-
<label>X-axis:
|
|
189
|
-
<input type="text" bind:value={x_format} placeholder=".2~s / .0%" />
|
|
190
|
-
</label>
|
|
191
|
-
<label>Y-axis:
|
|
192
|
-
<input type="text" bind:value={y_format} placeholder="d / .1e" />
|
|
193
|
-
</label>
|
|
194
|
-
</SettingsSection>
|
|
195
|
-
{/if}
|
|
196
|
-
</DraggablePane>
|
|
197
|
-
{/if}
|
|
198
|
-
|
|
199
|
-
<style>
|
|
200
|
-
label {
|
|
201
|
-
display: inline-flex !important;
|
|
202
|
-
margin: 0 0 0 5pt;
|
|
203
|
-
}
|
|
204
|
-
</style>
|
|
20
|
+
<label style="flex: 1">
|
|
21
|
+
Orientation:
|
|
22
|
+
<select bind:value={orientation} id="orientation-select">
|
|
23
|
+
<option value="vertical">Vertical</option>
|
|
24
|
+
<option value="horizontal">Horizontal</option>
|
|
25
|
+
</select>
|
|
26
|
+
</label>
|
|
27
|
+
<label style="flex: 1">
|
|
28
|
+
Mode:
|
|
29
|
+
<select bind:value={mode} id="mode-select">
|
|
30
|
+
<option value="overlay">Overlay</option>
|
|
31
|
+
<option value="stacked">Stacked</option>
|
|
32
|
+
<option value="grouped">Grouped (Side-by-Side)</option>
|
|
33
|
+
</select>
|
|
34
|
+
</label>
|
|
35
|
+
</SettingsSection>
|
|
36
|
+
</PlotControls>
|
|
@@ -1,26 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
import type { ComponentProps, Snippet } from 'svelte';
|
|
5
|
-
interface Props {
|
|
6
|
-
show_controls?: boolean;
|
|
7
|
-
controls_open?: boolean;
|
|
1
|
+
import type { AxisConfig, BarMode, DisplayConfig } from './';
|
|
2
|
+
import type { Orientation, PlotControlsProps } from './types';
|
|
3
|
+
type $$ComponentProps = Omit<PlotControlsProps, `children` | `post_children`> & {
|
|
8
4
|
orientation?: Orientation;
|
|
9
5
|
mode?: BarMode;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
auto_x_range?: [number, number];
|
|
19
|
-
auto_y_range?: [number, number];
|
|
20
|
-
plot_controls?: Snippet<[]> | undefined;
|
|
21
|
-
toggle_props?: ComponentProps<typeof DraggablePane>[`toggle_props`];
|
|
22
|
-
pane_props?: ComponentProps<typeof DraggablePane>[`pane_props`];
|
|
23
|
-
}
|
|
24
|
-
declare const BarPlotControls: import("svelte").Component<Props, {}, "orientation" | "mode" | "show_controls" | "x_grid" | "y_grid" | "x_format" | "y_format" | "x_ticks" | "y_ticks" | "controls_open" | "x_range" | "y_range">;
|
|
6
|
+
x_axis?: AxisConfig;
|
|
7
|
+
y_axis?: AxisConfig;
|
|
8
|
+
y2_axis?: AxisConfig;
|
|
9
|
+
display?: DisplayConfig;
|
|
10
|
+
show_controls?: boolean;
|
|
11
|
+
controls_open?: boolean;
|
|
12
|
+
};
|
|
13
|
+
declare const BarPlotControls: import("svelte").Component<$$ComponentProps, {}, "display" | "orientation" | "mode" | "show_controls" | "y_axis" | "y2_axis" | "x_axis" | "controls_open">;
|
|
25
14
|
type BarPlotControls = ReturnType<typeof BarPlotControls>;
|
|
26
15
|
export default BarPlotControls;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Orientation } from '..';
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
-
|
|
3
|
+
type $$ComponentProps = HTMLAttributes<HTMLDivElement> & {
|
|
4
4
|
title?: string;
|
|
5
5
|
color_scale?: ((x: number) => string) | string | null;
|
|
6
6
|
title_side?: `left` | `right` | `top` | `bottom`;
|
|
@@ -18,7 +18,7 @@ interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
|
18
18
|
scale_type?: `linear` | `log`;
|
|
19
19
|
color_scale_fn?: (value: number) => string;
|
|
20
20
|
color_scale_domain?: [number, number];
|
|
21
|
-
}
|
|
22
|
-
declare const ColorBar: import("svelte").Component
|
|
21
|
+
};
|
|
22
|
+
declare const ColorBar: import("svelte").Component<$$ComponentProps, {}, "color_scale" | "tick_labels" | "nice_range">;
|
|
23
23
|
type ColorBar = ReturnType<typeof ColorBar>;
|
|
24
24
|
export default ColorBar;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">import { ColorBar } from '..';
|
|
2
2
|
import * as d3_sc from 'd3-scale-chromatic';
|
|
3
3
|
import Select from 'svelte-multiselect';
|
|
4
|
-
let { options = Object.keys(d3_sc).filter((key) => key.startsWith(`interpolate`)), value = $bindable(options[0]), selected = $bindable([]), minSelect =
|
|
4
|
+
let { options = Object.keys(d3_sc).filter((key) => key.startsWith(`interpolate`)), value = $bindable(options[0]), selected = $bindable([]), minSelect = 1, placeholder = `Select a color scale`, colorbar = {}, ...rest } = $props();
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
7
|
<Select
|
|
@@ -2,14 +2,14 @@ import { ColorBar } from '..';
|
|
|
2
2
|
import type { ComponentProps } from 'svelte';
|
|
3
3
|
import Select from 'svelte-multiselect';
|
|
4
4
|
import type { D3InterpolateName } from '../colors';
|
|
5
|
-
|
|
5
|
+
type $$ComponentProps = Omit<ComponentProps<typeof Select>, `options`> & {
|
|
6
6
|
options?: D3InterpolateName[];
|
|
7
7
|
value?: D3InterpolateName;
|
|
8
8
|
selected?: D3InterpolateName[];
|
|
9
9
|
minSelect?: number;
|
|
10
10
|
placeholder?: string;
|
|
11
11
|
colorbar?: ComponentProps<typeof ColorBar>;
|
|
12
|
-
}
|
|
13
|
-
declare const ColorScaleSelect: import("svelte").Component
|
|
12
|
+
};
|
|
13
|
+
declare const ColorScaleSelect: import("svelte").Component<$$ComponentProps, {}, "value" | "selected">;
|
|
14
14
|
type ColorScaleSelect = ReturnType<typeof ColorScaleSelect>;
|
|
15
15
|
export default ColorScaleSelect;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">import { element_data, format_num, ScatterPlot } from '..';
|
|
2
2
|
import { selected } from '../state.svelte';
|
|
3
|
-
let { y,
|
|
3
|
+
let { y, x_axis = $bindable({ label: `Atomic Number` }), y_axis = $bindable({ label: ``, format: `~s` }), y_unit = ``, tooltip_point = $bindable(null), hovered = $bindable(false), ...rest } = $props();
|
|
4
4
|
// update tooltip on hover element tile
|
|
5
5
|
$effect.pre(() => {
|
|
6
6
|
if (selected.element?.number && !hovered) {
|
|
@@ -25,14 +25,14 @@ $effect.pre(() => {
|
|
|
25
25
|
]}
|
|
26
26
|
bind:tooltip_point
|
|
27
27
|
bind:hovered
|
|
28
|
-
{
|
|
29
|
-
{
|
|
30
|
-
{y_format}
|
|
28
|
+
{x_axis}
|
|
29
|
+
{y_axis}
|
|
31
30
|
color_bar={null}
|
|
31
|
+
padding={{ l: 45, r: 10, t: 0, b: 40 }}
|
|
32
32
|
{...rest}
|
|
33
33
|
>
|
|
34
34
|
{#snippet tooltip({ x, y })}
|
|
35
35
|
<strong>{x} - {element_data[x - 1]?.name}</strong><br />
|
|
36
|
-
{
|
|
36
|
+
{y_axis.label} = {format_num(y, y_axis.format ?? `~s`)}{y_unit ?? ``}
|
|
37
37
|
{/snippet}
|
|
38
38
|
</ScatterPlot>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AxisConfig, InternalPoint } from '..';
|
|
2
|
+
import { ScatterPlot } from '..';
|
|
2
3
|
import type { ComponentProps } from 'svelte';
|
|
3
|
-
|
|
4
|
+
type $$ComponentProps = ComponentProps<typeof ScatterPlot> & {
|
|
4
5
|
y: number[];
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
y_unit?: string;
|
|
6
|
+
x_axis?: AxisConfig;
|
|
7
|
+
y_axis?: AxisConfig;
|
|
8
|
+
y_unit?: string | null;
|
|
8
9
|
tooltip_point?: InternalPoint | null;
|
|
9
10
|
hovered?: boolean;
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
declare const ElementScatter: import("svelte").Component<Props, {}, "hovered" | "tooltip_point">;
|
|
11
|
+
};
|
|
12
|
+
declare const ElementScatter: import("svelte").Component<$$ComponentProps, {}, "y_axis" | "x_axis" | "hovered" | "tooltip_point">;
|
|
13
13
|
type ElementScatter = ReturnType<typeof ElementScatter>;
|
|
14
14
|
export default ElementScatter;
|