matterviz 0.1.6 → 0.1.8
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/{DraggablePanel.svelte → DraggablePane.svelte} +119 -122
- package/dist/{DraggablePanel.svelte.d.ts → DraggablePane.svelte.d.ts} +7 -7
- package/dist/FilePicker.svelte +263 -0
- package/dist/FilePicker.svelte.d.ts +15 -0
- package/dist/Icon.svelte +7 -3
- package/dist/SettingsSection.svelte +116 -0
- package/dist/SettingsSection.svelte.d.ts +11 -0
- package/dist/{mp-api.js → api/mp.js} +1 -1
- package/dist/api/optimade.d.ts +45 -0
- package/dist/api/optimade.js +135 -0
- package/dist/app.css +14 -2
- package/dist/composition/BarChart.svelte +1 -1
- package/dist/composition/BarChart.svelte.d.ts +4 -9
- package/dist/composition/BubbleChart.svelte +4 -2
- package/dist/composition/BubbleChart.svelte.d.ts +7 -11
- package/dist/composition/Composition.svelte +1 -4
- package/dist/composition/PieChart.svelte +5 -4
- package/dist/composition/PieChart.svelte.d.ts +11 -13
- package/dist/composition/index.d.ts +10 -0
- package/dist/element/ElementHeading.svelte +2 -2
- package/dist/element/ElementHeading.svelte.d.ts +1 -0
- package/dist/element/ElementPhoto.svelte +3 -3
- package/dist/element/ElementStats.svelte +3 -4
- package/dist/element/ElementStats.svelte.d.ts +1 -1
- package/dist/element/ElementTile.svelte +4 -5
- package/dist/element/ElementTile.svelte.d.ts +1 -1
- package/dist/icons.d.ts +46 -8
- package/dist/icons.js +77 -8
- package/dist/index.d.ts +13 -19
- package/dist/index.js +22 -1
- package/dist/io/export.d.ts +0 -10
- package/dist/io/export.js +17 -346
- package/dist/io/index.d.ts +0 -2
- package/dist/io/index.js +31 -49
- package/dist/labels.d.ts +3 -3
- package/dist/labels.js +1 -1
- package/dist/math.d.ts +5 -3
- package/dist/math.js +38 -49
- package/dist/periodic-table/PeriodicTable.svelte +1 -1
- package/dist/periodic-table/PeriodicTable.svelte.d.ts +3 -3
- package/dist/periodic-table/TableInset.svelte +2 -2
- package/dist/plot/ColorBar.svelte +17 -18
- package/dist/plot/Histogram.svelte +9 -12
- package/dist/plot/Histogram.svelte.d.ts +2 -2
- package/dist/plot/HistogramControls.svelte +155 -115
- package/dist/plot/HistogramControls.svelte.d.ts +3 -3
- package/dist/plot/Line.svelte +1 -1
- package/dist/plot/Line.svelte.d.ts +1 -1
- package/dist/plot/PlotLegend.svelte +12 -15
- package/dist/plot/ScatterPlot.svelte +25 -27
- package/dist/plot/ScatterPlot.svelte.d.ts +3 -3
- package/dist/plot/ScatterPlotControls.svelte +228 -218
- package/dist/plot/ScatterPlotControls.svelte.d.ts +4 -4
- package/dist/plot/index.js +3 -4
- package/dist/plot/scales.js +9 -7
- package/dist/settings.d.ts +46 -16
- package/dist/settings.js +175 -45
- package/dist/state.svelte.d.ts +2 -2
- package/dist/state.svelte.js +1 -7
- package/dist/structure/Bond.svelte +49 -4
- package/dist/structure/Bond.svelte.d.ts +8 -1
- package/dist/structure/CanvasTooltip.svelte +25 -0
- package/dist/structure/CanvasTooltip.svelte.d.ts +10 -0
- package/dist/structure/Lattice.svelte +29 -6
- package/dist/structure/Lattice.svelte.d.ts +3 -2
- package/dist/structure/Structure.svelte +293 -162
- package/dist/structure/Structure.svelte.d.ts +4 -6
- package/dist/structure/StructureControls.svelte +597 -379
- package/dist/structure/StructureControls.svelte.d.ts +7 -6
- package/dist/structure/{StructureInfoPanel.svelte → StructureInfoPane.svelte} +21 -30
- package/dist/structure/StructureInfoPane.svelte.d.ts +14 -0
- package/dist/structure/StructureLegend.svelte +1 -1
- package/dist/structure/StructureScene.svelte +329 -133
- package/dist/structure/StructureScene.svelte.d.ts +15 -16
- package/dist/structure/Vector.svelte +5 -3
- package/dist/structure/bonding.d.ts +22 -9
- package/dist/structure/bonding.js +230 -112
- package/dist/structure/export.d.ts +10 -0
- package/dist/structure/export.js +339 -0
- package/dist/structure/index.d.ts +11 -2
- package/dist/structure/index.js +3 -1
- package/dist/structure/measure.d.ts +8 -0
- package/dist/structure/measure.js +38 -0
- package/dist/{io → structure}/parse.d.ts +6 -21
- package/dist/{io → structure}/parse.js +489 -189
- package/dist/structure/pbc.js +55 -36
- package/dist/structure/supercell.d.ts +8 -0
- package/dist/structure/supercell.js +157 -0
- package/dist/theme/ThemeControl.svelte +12 -11
- package/dist/theme/themes.js +9 -17
- package/dist/trajectory/Trajectory.svelte +121 -102
- package/dist/trajectory/Trajectory.svelte.d.ts +2 -1
- package/dist/trajectory/TrajectoryError.svelte +2 -2
- package/dist/trajectory/{TrajectoryInfoPanel.svelte → TrajectoryInfoPane.svelte} +19 -23
- package/dist/trajectory/TrajectoryInfoPane.svelte.d.ts +18 -0
- package/dist/trajectory/index.d.ts +3 -3
- package/dist/trajectory/index.js +2 -3
- package/dist/trajectory/parse.d.ts +5 -4
- package/dist/trajectory/parse.js +31 -12
- package/package.json +19 -19
- package/readme.md +29 -17
- package/dist/structure/StructureInfoPanel.svelte.d.ts +0 -14
- package/dist/trajectory/TrajectoryInfoPanel.svelte.d.ts +0 -18
- /package/dist/{mp-api.d.ts → api/mp.d.ts} +0 -0
|
@@ -1,31 +1,30 @@
|
|
|
1
1
|
<script lang="ts">import { Icon } from './';
|
|
2
2
|
import { draggable, tooltip } from 'svelte-multiselect/attachments';
|
|
3
|
-
let { show = $bindable(false),
|
|
3
|
+
let { show = $bindable(false), show_pane = true, children, toggle_props = {}, open_icon = `Cross`, closed_icon = `Settings`, icon_style = ``, offset = { x: 5, y: 5 }, max_width = `450px`, pane_props = {}, onclose = () => { }, on_drag_start = () => { }, custom_toggle = undefined, toggle_pane_btn = $bindable(undefined), pane_div = $bindable(undefined), has_been_dragged = $bindable(false), currently_dragging = $bindable(false), } = $props();
|
|
4
4
|
let initial_position = $state({ left: `50px`, top: `50px` });
|
|
5
5
|
let show_control_buttons = $state(false);
|
|
6
6
|
// Keyboard shortcuts
|
|
7
7
|
function on_keydown(event) {
|
|
8
8
|
if (event.key === `Escape`) {
|
|
9
9
|
event.preventDefault();
|
|
10
|
-
|
|
10
|
+
close_pane();
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
function toggle_panel() {
|
|
13
|
+
function toggle_pane() {
|
|
15
14
|
show = !show;
|
|
16
15
|
if (!show)
|
|
17
16
|
onclose();
|
|
18
17
|
}
|
|
19
|
-
function
|
|
18
|
+
function close_pane() {
|
|
20
19
|
show = false;
|
|
21
20
|
onclose();
|
|
22
21
|
}
|
|
23
22
|
function reset_position() {
|
|
24
|
-
if (
|
|
23
|
+
if (toggle_pane_btn) {
|
|
25
24
|
const pos = calculate_position();
|
|
26
25
|
initial_position = pos;
|
|
27
|
-
if (
|
|
28
|
-
Object.assign(
|
|
26
|
+
if (pane_div) {
|
|
27
|
+
Object.assign(pane_div.style, {
|
|
29
28
|
left: pos.left,
|
|
30
29
|
top: pos.top,
|
|
31
30
|
right: `auto`,
|
|
@@ -47,24 +46,24 @@ function handle_drag_start() {
|
|
|
47
46
|
}
|
|
48
47
|
// Position calculation
|
|
49
48
|
function calculate_position() {
|
|
50
|
-
if (!
|
|
49
|
+
if (!toggle_pane_btn)
|
|
51
50
|
return { left: `50px`, top: `50px` };
|
|
52
|
-
const toggle_rect =
|
|
53
|
-
const
|
|
54
|
-
const positioned_ancestor =
|
|
51
|
+
const toggle_rect = toggle_pane_btn.getBoundingClientRect();
|
|
52
|
+
const pane_width = pane_div?.getBoundingClientRect().width || 450;
|
|
53
|
+
const positioned_ancestor = toggle_pane_btn.offsetParent;
|
|
55
54
|
const ancestor_rect = positioned_ancestor?.getBoundingClientRect();
|
|
56
55
|
if (!ancestor_rect) {
|
|
57
56
|
// Fallback to document positioning
|
|
58
57
|
const scroll_x = window.scrollX || document.documentElement.scrollLeft;
|
|
59
58
|
const scroll_y = window.scrollY || document.documentElement.scrollTop;
|
|
60
59
|
return {
|
|
61
|
-
left: `${toggle_rect.right -
|
|
60
|
+
left: `${toggle_rect.right - pane_width + (offset.x ?? 5) + scroll_x}px`,
|
|
62
61
|
top: `${toggle_rect.bottom + (offset.y ?? 5) + scroll_y}px`,
|
|
63
62
|
};
|
|
64
63
|
}
|
|
65
64
|
// Position relative to positioned ancestor
|
|
66
65
|
return {
|
|
67
|
-
left: `${toggle_rect.right - ancestor_rect.left -
|
|
66
|
+
left: `${toggle_rect.right - ancestor_rect.left - pane_width + (offset.x ?? 5)}px`,
|
|
68
67
|
top: `${toggle_rect.bottom - ancestor_rect.top + (offset.y ?? 5)}px`,
|
|
69
68
|
};
|
|
70
69
|
}
|
|
@@ -73,20 +72,18 @@ function handle_click_outside(event) {
|
|
|
73
72
|
if (!show)
|
|
74
73
|
return;
|
|
75
74
|
const target = event.target;
|
|
76
|
-
const is_toggle_button =
|
|
77
|
-
(target ===
|
|
78
|
-
const
|
|
79
|
-
(target ===
|
|
80
|
-
if (!is_toggle_button && !
|
|
81
|
-
|
|
82
|
-
close_panel();
|
|
83
|
-
}
|
|
75
|
+
const is_toggle_button = toggle_pane_btn &&
|
|
76
|
+
(target === toggle_pane_btn || toggle_pane_btn.contains(target));
|
|
77
|
+
const is_inside_pane = pane_div &&
|
|
78
|
+
(target === pane_div || pane_div.contains(target));
|
|
79
|
+
if (!is_toggle_button && !is_inside_pane && !currently_dragging)
|
|
80
|
+
close_pane();
|
|
84
81
|
}
|
|
85
82
|
// Button click handler
|
|
86
|
-
|
|
83
|
+
const handle_button_click = (action) => (event) => {
|
|
87
84
|
event.stopPropagation();
|
|
88
85
|
action();
|
|
89
|
-
}
|
|
86
|
+
};
|
|
90
87
|
// Debounced resize handler for better performance
|
|
91
88
|
let resize_timeout = $state(undefined);
|
|
92
89
|
function handle_resize() {
|
|
@@ -97,26 +94,27 @@ function handle_resize() {
|
|
|
97
94
|
const current_timeout = setTimeout(() => {
|
|
98
95
|
if (resize_timeout !== current_timeout)
|
|
99
96
|
return;
|
|
100
|
-
if (show &&
|
|
97
|
+
if (show && toggle_pane_btn && !has_been_dragged && pane_div) {
|
|
101
98
|
const pos = calculate_position();
|
|
102
99
|
initial_position = pos;
|
|
103
|
-
|
|
104
|
-
|
|
100
|
+
pane_div.style.left = pos.left;
|
|
101
|
+
pane_div.style.top = pos.top;
|
|
105
102
|
}
|
|
106
103
|
}, 50); // Debounce resize events
|
|
107
104
|
resize_timeout = current_timeout;
|
|
108
105
|
}
|
|
109
|
-
// Position
|
|
106
|
+
// Position pane when shown
|
|
110
107
|
$effect(() => {
|
|
111
|
-
if (show &&
|
|
108
|
+
if (show && toggle_pane_btn && !has_been_dragged) {
|
|
112
109
|
const pos = calculate_position();
|
|
113
110
|
initial_position = pos;
|
|
114
|
-
if (
|
|
115
|
-
Object.assign(
|
|
111
|
+
if (pane_div) {
|
|
112
|
+
Object.assign(pane_div.style, {
|
|
116
113
|
left: pos.left,
|
|
117
114
|
top: pos.top,
|
|
118
115
|
right: `auto`,
|
|
119
116
|
bottom: `auto`,
|
|
117
|
+
width: ``,
|
|
120
118
|
});
|
|
121
119
|
}
|
|
122
120
|
}
|
|
@@ -126,15 +124,15 @@ $effect(() => {
|
|
|
126
124
|
<svelte:window onkeydown={on_keydown} onresize={handle_resize} />
|
|
127
125
|
<svelte:document onclick={handle_click_outside} />
|
|
128
126
|
|
|
129
|
-
{#if
|
|
127
|
+
{#if show_pane}
|
|
130
128
|
<button
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
type="button"
|
|
130
|
+
bind:this={toggle_pane_btn}
|
|
131
|
+
onclick={handle_button_click(custom_toggle || toggle_pane)}
|
|
133
132
|
aria-expanded={show}
|
|
134
|
-
aria-controls="draggable-panel"
|
|
135
133
|
{...toggle_props}
|
|
136
|
-
class="
|
|
137
|
-
{@attach tooltip({ content: toggle_props.title ?? (show ? `Close
|
|
134
|
+
class="pane-toggle {toggle_props.class ?? ``}"
|
|
135
|
+
{@attach tooltip({ content: toggle_props.title ?? (show ? `Close pane` : `Open pane`) })}
|
|
138
136
|
>
|
|
139
137
|
<Icon icon={show ? open_icon : closed_icon} style={icon_style} />
|
|
140
138
|
</button>
|
|
@@ -145,43 +143,43 @@ $effect(() => {
|
|
|
145
143
|
on_drag_start: handle_drag_start,
|
|
146
144
|
on_drag_end: () => (currently_dragging = false),
|
|
147
145
|
})}
|
|
148
|
-
bind:this={
|
|
146
|
+
bind:this={pane_div}
|
|
149
147
|
role="dialog"
|
|
150
|
-
aria-label="Draggable
|
|
148
|
+
aria-label="Draggable pane"
|
|
151
149
|
aria-modal="false"
|
|
152
150
|
style:max-width={max_width}
|
|
153
151
|
style:top={initial_position.top}
|
|
154
152
|
style:left={initial_position.left}
|
|
155
153
|
style:display={show ? `grid` : `none`}
|
|
156
|
-
{...
|
|
157
|
-
class="draggable-
|
|
154
|
+
{...pane_props}
|
|
155
|
+
class="draggable-pane {show ? `pane-open` : ``} {pane_props.class ?? ``}"
|
|
158
156
|
>
|
|
159
|
-
<div class="
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
157
|
+
<div class="control-buttons">
|
|
158
|
+
{#if show_control_buttons}
|
|
159
|
+
<button
|
|
160
|
+
type="button"
|
|
161
|
+
class="reset-button"
|
|
162
|
+
onclick={handle_button_click(reset_position)}
|
|
163
|
+
title="Reset pane position"
|
|
164
|
+
aria-label="Reset pane position"
|
|
165
|
+
>
|
|
166
|
+
<Icon icon="Reset" style="width: 1.25em; height: 1.25em" />
|
|
167
|
+
</button>
|
|
168
|
+
<button
|
|
169
|
+
type="button"
|
|
170
|
+
class="close-button"
|
|
171
|
+
onclick={handle_button_click(close_pane)}
|
|
172
|
+
title="Close pane"
|
|
173
|
+
aria-label="Close pane"
|
|
174
|
+
>
|
|
175
|
+
<Icon icon="Cross" style="width: 1.25em; height: 1.25em" />
|
|
176
|
+
</button>
|
|
177
|
+
{/if}
|
|
178
|
+
<Icon
|
|
179
|
+
icon="DragIndicator"
|
|
180
|
+
class="drag-handle"
|
|
181
|
+
style="width: 1.25em; height: 1.25em"
|
|
182
|
+
/>
|
|
185
183
|
</div>
|
|
186
184
|
|
|
187
185
|
{@render children()}
|
|
@@ -189,27 +187,27 @@ $effect(() => {
|
|
|
189
187
|
{/if}
|
|
190
188
|
|
|
191
189
|
<style>
|
|
192
|
-
button.
|
|
190
|
+
button.pane-toggle {
|
|
193
191
|
box-sizing: border-box;
|
|
194
192
|
display: flex;
|
|
195
193
|
place-items: center;
|
|
196
|
-
padding: var(--
|
|
197
|
-
border-radius: var(--
|
|
194
|
+
padding: var(--pane-toggle-padding, 2pt);
|
|
195
|
+
border-radius: var(--pane-toggle-border-radius, 3pt);
|
|
198
196
|
background-color: transparent;
|
|
199
197
|
transition: background-color 0.2s;
|
|
200
|
-
font-size: clamp(1em,
|
|
198
|
+
font-size: var(--pane-toggle-font-size, clamp(1.1em, calc(1cqw + 1cqh), 1.4em));
|
|
201
199
|
}
|
|
202
|
-
button.
|
|
200
|
+
button.pane-toggle:hover {
|
|
203
201
|
background-color: color-mix(in srgb, currentColor 8%, transparent);
|
|
204
202
|
}
|
|
205
|
-
.draggable-
|
|
206
|
-
position: absolute; /* Use absolute so
|
|
207
|
-
background: var(--
|
|
208
|
-
border: var(--
|
|
203
|
+
div.draggable-pane {
|
|
204
|
+
position: absolute; /* Use absolute so pane scrolls with page content */
|
|
205
|
+
background: var(--pane-bg, var(--page-bg, light-dark(white, black)));
|
|
206
|
+
border: var(--pane-border, 1px solid rgba(255, 255, 255, 0.15));
|
|
209
207
|
border-radius: 6px;
|
|
210
|
-
padding: var(--
|
|
208
|
+
padding: var(--pane-padding, 1ex);
|
|
211
209
|
box-sizing: border-box;
|
|
212
|
-
z-index: 10;
|
|
210
|
+
z-index: var(--pane-z-index, 10);
|
|
213
211
|
display: grid;
|
|
214
212
|
gap: 4pt;
|
|
215
213
|
text-align: left;
|
|
@@ -219,53 +217,52 @@ $effect(() => {
|
|
|
219
217
|
max-width: 90cqw;
|
|
220
218
|
overflow-x: hidden;
|
|
221
219
|
overflow-y: auto;
|
|
222
|
-
max-height:
|
|
220
|
+
max-height: min(90vh, 800px);
|
|
223
221
|
pointer-events: auto;
|
|
224
222
|
}
|
|
225
|
-
:global(body.fullscreen) .draggable-
|
|
223
|
+
:global(body.fullscreen) .draggable-pane {
|
|
226
224
|
position: fixed !important; /* In fullscreen, we want viewport-relative positioning */
|
|
227
225
|
top: 3.3em !important;
|
|
228
226
|
right: 1em !important;
|
|
229
227
|
left: auto !important;
|
|
230
228
|
}
|
|
231
|
-
/*
|
|
232
|
-
.draggable-
|
|
229
|
+
/* Pane content styling */
|
|
230
|
+
.draggable-pane :global(h4) {
|
|
233
231
|
margin: 2pt 0;
|
|
234
232
|
font-size: 0.95em;
|
|
235
233
|
}
|
|
236
|
-
.draggable-
|
|
234
|
+
.draggable-pane :global(hr) {
|
|
237
235
|
border: none;
|
|
238
|
-
background: var(--
|
|
236
|
+
background: var(--pane-hr-bg, rgba(255, 255, 255, 0.1));
|
|
239
237
|
margin: 4pt 0;
|
|
240
238
|
height: 1px;
|
|
241
239
|
}
|
|
242
|
-
.draggable-
|
|
240
|
+
.draggable-pane :global(label) {
|
|
243
241
|
display: flex;
|
|
244
242
|
align-items: center;
|
|
245
243
|
gap: 2pt;
|
|
246
244
|
}
|
|
247
|
-
.draggable-
|
|
245
|
+
.draggable-pane :global(input[type='text']) {
|
|
248
246
|
flex: 1;
|
|
249
247
|
padding: 4px 6px;
|
|
248
|
+
margin: var(--pane-input-margin, 0 0 0 5pt);
|
|
250
249
|
}
|
|
251
|
-
.draggable-
|
|
250
|
+
.draggable-pane :global(input[type='text'].invalid) {
|
|
252
251
|
border-color: var(--error-color, #ff6b6b);
|
|
253
252
|
background: rgba(255, 107, 107, 0.1);
|
|
254
253
|
}
|
|
255
|
-
.draggable-
|
|
254
|
+
.draggable-pane :global(input[type='text'].invalid):focus {
|
|
256
255
|
outline-color: var(--error-color, #ff6b6b);
|
|
257
256
|
box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.2);
|
|
258
257
|
}
|
|
259
|
-
.draggable-
|
|
258
|
+
.draggable-pane :global(input[type='range']) {
|
|
260
259
|
margin-left: 4pt;
|
|
261
260
|
width: 100px;
|
|
262
261
|
flex-shrink: 0;
|
|
263
|
-
}
|
|
264
|
-
.draggable-panel :global(input[type='range']) {
|
|
265
262
|
flex: 1;
|
|
266
263
|
min-width: 60px;
|
|
267
264
|
}
|
|
268
|
-
.draggable-
|
|
265
|
+
.draggable-pane :global(input[type='number']) {
|
|
269
266
|
box-sizing: border-box;
|
|
270
267
|
text-align: center;
|
|
271
268
|
border-radius: 3pt;
|
|
@@ -273,58 +270,59 @@ $effect(() => {
|
|
|
273
270
|
margin: 0 3pt 0 6pt;
|
|
274
271
|
flex-shrink: 0;
|
|
275
272
|
}
|
|
276
|
-
.draggable-
|
|
273
|
+
.draggable-pane :global(input::-webkit-inner-spin-button) {
|
|
277
274
|
display: none;
|
|
278
275
|
}
|
|
279
|
-
.draggable-
|
|
276
|
+
.draggable-pane :global(button) {
|
|
280
277
|
width: max-content;
|
|
281
|
-
background-color: var(--
|
|
278
|
+
background-color: var(--pane-btn-bg, rgba(255, 255, 255, 0.1));
|
|
282
279
|
}
|
|
283
|
-
.draggable-
|
|
284
|
-
background-color: var(--
|
|
280
|
+
.draggable-pane :global(button:hover) {
|
|
281
|
+
background-color: var(--pane-btn-bg-hover, rgba(255, 255, 255, 0.2));
|
|
285
282
|
}
|
|
286
|
-
.draggable-
|
|
283
|
+
.draggable-pane :global(select) {
|
|
287
284
|
margin: 0 0 0 5pt;
|
|
288
285
|
flex: 1;
|
|
289
286
|
border-radius: 3px;
|
|
290
287
|
padding: 2px 4px;
|
|
291
288
|
font-size: 0.8em;
|
|
292
289
|
}
|
|
293
|
-
.draggable-
|
|
290
|
+
.draggable-pane :global(input[type='color']) {
|
|
294
291
|
width: 40px;
|
|
295
292
|
height: 16px;
|
|
296
293
|
margin: 0 0 0 5pt;
|
|
297
294
|
border: 1px solid rgba(255, 255, 255, 0.05);
|
|
298
295
|
box-sizing: border-box;
|
|
299
296
|
}
|
|
300
|
-
.draggable-
|
|
297
|
+
.draggable-pane :global(.pane-row) {
|
|
301
298
|
display: flex;
|
|
302
299
|
gap: 8pt;
|
|
303
300
|
align-items: center;
|
|
304
301
|
}
|
|
305
|
-
.draggable-
|
|
302
|
+
.draggable-pane :global(.pane-grid) {
|
|
303
|
+
display: grid;
|
|
304
|
+
gap: 8pt;
|
|
305
|
+
align-items: center;
|
|
306
|
+
}
|
|
307
|
+
.draggable-pane :global(label:has(input[type='range'])) {
|
|
306
308
|
flex: 1;
|
|
307
309
|
}
|
|
308
|
-
|
|
309
|
-
.draggable-panel .panel-header {
|
|
310
|
+
.draggable-pane .control-buttons {
|
|
310
311
|
display: flex;
|
|
311
|
-
justify-content:
|
|
312
|
+
justify-content: end;
|
|
312
313
|
align-items: center;
|
|
313
|
-
position:
|
|
314
|
-
top:
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
z-index: 10;
|
|
319
|
-
pointer-events: none; /* Allow events to pass through to children */
|
|
320
|
-
}
|
|
321
|
-
.draggable-panel .control-buttons {
|
|
322
|
-
display: flex;
|
|
314
|
+
position: sticky;
|
|
315
|
+
top: 0;
|
|
316
|
+
right: 0;
|
|
317
|
+
height: 0;
|
|
318
|
+
/* Cancel the 12 pt top/bottom padding without relying on width-based percentages */
|
|
323
319
|
gap: 5px;
|
|
324
|
-
|
|
325
|
-
|
|
320
|
+
padding: 12pt 3pt;
|
|
321
|
+
margin-bottom: calc(-2 * 12pt);
|
|
322
|
+
box-sizing: border-box;
|
|
323
|
+
justify-self: end;
|
|
326
324
|
}
|
|
327
|
-
.draggable-
|
|
325
|
+
.draggable-pane :global(.drag-handle) {
|
|
328
326
|
width: 1.3em;
|
|
329
327
|
height: 1.3em;
|
|
330
328
|
cursor: grab;
|
|
@@ -335,17 +333,16 @@ $effect(() => {
|
|
|
335
333
|
background-color: color-mix(in srgb, currentColor 10%, transparent);
|
|
336
334
|
pointer-events: auto; /* Re-enable pointer events for drag handle */
|
|
337
335
|
}
|
|
338
|
-
.draggable-
|
|
336
|
+
.draggable-pane :global(.drag-handle:hover) {
|
|
339
337
|
opacity: 0.8;
|
|
340
338
|
background-color: color-mix(in srgb, currentColor 20%, transparent);
|
|
341
339
|
}
|
|
342
340
|
/* Ensure drag handle cursor changes properly */
|
|
343
|
-
.draggable-
|
|
341
|
+
.draggable-pane :global(.drag-handle:active) {
|
|
344
342
|
cursor: grabbing;
|
|
345
343
|
}
|
|
346
344
|
/* Reset and close button styling */
|
|
347
|
-
.draggable-
|
|
348
|
-
.draggable-panel .close-button {
|
|
345
|
+
.draggable-pane :where(.reset-button, .close-button) {
|
|
349
346
|
background: none;
|
|
350
347
|
border: none;
|
|
351
348
|
padding: 2px;
|
|
@@ -360,7 +357,7 @@ $effect(() => {
|
|
|
360
357
|
opacity: 0.6;
|
|
361
358
|
background-color: color-mix(in srgb, currentColor 10%, transparent);
|
|
362
359
|
}
|
|
363
|
-
.draggable-
|
|
360
|
+
.draggable-pane :where(.reset-button:hover, .close-button:hover) {
|
|
364
361
|
opacity: 0.8;
|
|
365
362
|
background-color: color-mix(in srgb, currentColor 20%, transparent);
|
|
366
363
|
}
|
|
@@ -3,7 +3,7 @@ import type { Snippet } from 'svelte';
|
|
|
3
3
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
4
|
interface Props {
|
|
5
5
|
show?: boolean;
|
|
6
|
-
|
|
6
|
+
show_pane?: boolean;
|
|
7
7
|
children: Snippet<[]>;
|
|
8
8
|
toggle_props?: HTMLAttributes<HTMLButtonElement>;
|
|
9
9
|
open_icon?: IconName;
|
|
@@ -14,15 +14,15 @@ interface Props {
|
|
|
14
14
|
y?: number;
|
|
15
15
|
};
|
|
16
16
|
max_width?: string;
|
|
17
|
-
|
|
17
|
+
pane_props?: HTMLAttributes<HTMLDivElement>;
|
|
18
18
|
onclose?: () => void;
|
|
19
19
|
on_drag_start?: () => void;
|
|
20
20
|
custom_toggle?: () => void;
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
toggle_pane_btn?: HTMLButtonElement;
|
|
22
|
+
pane_div?: HTMLDivElement;
|
|
23
23
|
has_been_dragged?: boolean;
|
|
24
24
|
currently_dragging?: boolean;
|
|
25
25
|
}
|
|
26
|
-
declare const
|
|
27
|
-
type
|
|
28
|
-
export default
|
|
26
|
+
declare const DraggablePane: import("svelte").Component<Props, {}, "show" | "toggle_pane_btn" | "pane_div" | "has_been_dragged" | "currently_dragging">;
|
|
27
|
+
type DraggablePane = ReturnType<typeof DraggablePane>;
|
|
28
|
+
export default DraggablePane;
|