-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathStatusBar.svelte
More file actions
107 lines (88 loc) · 2.34 KB
/
StatusBar.svelte
File metadata and controls
107 lines (88 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<script lang="ts">
import { getContext, onMount } from "svelte";
import type { Layout } from "@graphite/../wasm/pkg/graphite_wasm";
import type { Editor } from "@graphite/editor";
import { patchLayout } from "@graphite/utility-functions/widgets";
import LayoutRow from "@graphite/components/layout/LayoutRow.svelte";
import Separator from "@graphite/components/widgets/labels/Separator.svelte";
import WidgetLayout from "@graphite/components/widgets/WidgetLayout.svelte";
const editor = getContext<Editor>("editor");
let statusBarHintsLayout: Layout = [];
let statusBarInfoLayout: Layout = [];
onMount(() => {
editor.subscriptions.subscribeLayoutUpdate("StatusBarHints", (data) => {
patchLayout(statusBarHintsLayout, data);
statusBarHintsLayout = statusBarHintsLayout;
});
editor.subscriptions.subscribeLayoutUpdate("StatusBarInfo", (data) => {
patchLayout(statusBarInfoLayout, data);
statusBarInfoLayout = statusBarInfoLayout;
});
});
</script>
<LayoutRow class="status-bar">
<WidgetLayout class="hints" layout={statusBarHintsLayout} layoutTarget="StatusBarHints" />
<Separator />
<WidgetLayout class="info" layout={statusBarInfoLayout} layoutTarget="StatusBarInfo" />
</LayoutRow>
<style lang="scss" global>
.status-bar {
height: 24px;
width: 100%;
flex: 0 0 auto;
justify-content: space-between;
.hints {
overflow-x: auto;
scrollbar-width: none;
&::-webkit-scrollbar {
display: none;
}
--row-height: 24px;
margin: 0 4px;
max-width: calc(100% - 2 * 4px);
flex: 1 1 auto;
> * {
flex: 0 0 auto;
}
.text-label,
.shortcut-label {
align-items: center;
flex-shrink: 0;
+ .text-label,
+ .shortcut-label {
margin-left: 4px;
}
}
.text-label:not(.bold) + .shortcut-label {
margin-left: 12px;
}
.text-label.bold {
padding: 0 4px;
}
}
.hints + .separator {
position: relative;
&::before {
content: "";
position: absolute;
top: 0;
bottom: 0;
left: -40px;
width: 40px;
background: linear-gradient(to right, rgba(var(--color-2-mildblack-rgb), 0) 0%, rgba(var(--color-2-mildblack-rgb), 1) 100%);
}
}
.info {
margin: 0 4px;
--row-height: 24px;
justify-content: flex-end;
.text-label {
align-items: center;
flex-shrink: 0;
+ .text-label {
margin-left: 4px;
}
}
}
}
</style>