Skip to content

Commit 6bf9833

Browse files
committed
chore: improve config diagram accessibility, spacing
1 parent 745d1e5 commit 6bf9833

File tree

5 files changed

+30
-21
lines changed

5 files changed

+30
-21
lines changed

src/components/ConfigNode.astro

+28-11
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ interface Default {
2323
inline: boolean;
2424
}
2525
const formatDefault = (value?: string): Default => {
26-
if (!value) value = "";
26+
if (!value) {
27+
value = lang === "properties" ? "" : '""';
28+
}
2729
if (!json && value.length > 2 && value.match(/^\[.+]$/)) {
2830
return {
2931
value: value
@@ -44,7 +46,9 @@ const formatDefault = (value?: string): Default => {
4446
{
4547
Object.entries(data).map(([key, rawValue], i, entries) => {
4648
let displayKey = key.replace(/_+$/, ""); // remove trailing underscores, used for duplicating keys
47-
if (json) displayKey = `"${displayKey}"`;
49+
if (json) {
50+
displayKey = `"${displayKey}"`;
51+
}
4852

4953
const childPath = [...path, key.replace(/-/g, "_")];
5054
const hasComma = json && i !== (entries.length - 1);
@@ -61,16 +65,16 @@ const formatDefault = (value?: string): Default => {
6165
) : "description" in rawValue ? (
6266
<details id={childPath.join("_")}>
6367
<summary class="line notranslate" translate="no">
64-
<span class="key">{displayKey}{separator}</span>{
68+
<span class="key key-leaf">{displayKey}</span><span class="muted">{separator}</span>{
6569
inline
66-
? (<span class="value">{value}</span><>{hasComma && <span class="muted">,</span>}</><a class="link" href={`#${childPath.join("_")}`}>#</a>)
70+
? (<span class="value">{value}</span><>{hasComma && <span class="muted">,</span>}</><a class="link link-inline" href={`#${childPath.join("_")}`}>#</a>)
6771
: (<a class="link" href={`#${childPath.join("_")}`}>#</a><p class="value">{value}</p><>{hasComma && <span class="muted">,</span>}</>)
6872
}
6973
</summary>
7074
<div class="block" set:html={render(rawValue.description)} />
7175
</details>
7276
) : (
73-
<span class="key notranslate" translate="no">{displayKey}{separator}</span>
77+
<span class="key notranslate" translate="no">{displayKey}</span><span class="muted">{separator}</span>
7478
<Astro.self child data={rawValue} path={childPath} {lang} />
7579
)}
7680
</div>
@@ -108,6 +112,10 @@ const formatDefault = (value?: string): Default => {
108112

109113
.key {
110114
white-space: pre-wrap;
115+
color: var(--sl-color-gray-3);
116+
}
117+
118+
.key-leaf {
111119
color: var(--sl-color-text-accent);
112120
}
113121

@@ -125,7 +133,6 @@ const formatDefault = (value?: string): Default => {
125133
color: var(--sl-color-white);
126134
background-color: var(--sl-color-gray-5);
127135
border-left: 5px solid var(--sl-color-bg-accent);
128-
white-space: pre-wrap;
129136
}
130137

131138
.message {
@@ -144,14 +151,24 @@ const formatDefault = (value?: string): Default => {
144151
color: var(--sl-color-gray-3);
145152
}
146153

147-
.link {
148-
opacity: 0;
149-
padding-left: 0.5rem;
154+
.link,
155+
.link:visited {
156+
color: var(--sl-color-accent-high);
150157
transition: opacity 0.2s ease;
151158
}
152159

153-
.line:hover .link {
154-
opacity: 1;
160+
.link-inline {
161+
padding-left: 0.5rem;
162+
}
163+
164+
@media not (hover: none) {
165+
.link {
166+
opacity: 0;
167+
}
168+
169+
.line:hover .link {
170+
opacity: 1;
171+
}
155172
}
156173
</style>
157174

src/config/paper/help.yml

-9
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,16 @@ general-topics:
77
The first line of the help entry, used as a summary in index pages.
88
99
This is formatted with legacy "&" style formatting.
10-
default: '""'
1110
fullText:
1211
description: |
1312
The remaining lines of this help entry.
1413
1514
This is formatted with legacy "&" style formatting.
16-
default: '""'
1715
permission:
1816
description: |
1917
The permission required to view this help entry.
2018
2119
If this is empty/not set, the entry does not require a permission.
22-
default: '""'
2320
2421
index-topics:
2522
<topic name>:
@@ -36,19 +33,16 @@ index-topics:
3633
This is not displayed when showing this topic itself.
3734
3835
This is formatted with legacy "&" style formatting.
39-
default: '""'
4036
preamble:
4137
description: |
4238
Information to show before the index.
4339
4440
This is formatted with legacy "&" style formatting.
45-
default: '""'
4641
permission:
4742
description: |
4843
A custom permission required to view this help entry.
4944
5045
If this is empty/not set, the entry does not require a permission.
51-
default: '""'
5246
commands:
5347
description: |
5448
What to show in the index.
@@ -72,7 +66,6 @@ amended-topics:
7266
If this contains the literal string `<text>`, it will be replaced with the original short text.
7367
7468
This is formatted with legacy "&" style formatting.
75-
default: '""'
7669
fullText:
7770
description: |
7871
A replacement for the full text of the topic.
@@ -82,13 +75,11 @@ amended-topics:
8275
If this contains the literal string `<text>`, it will be replaced with the original full text.
8376
8477
This is formatted with legacy "&" style formatting.
85-
default: '""'
8678
permission:
8779
description: |
8880
Overrides the permission required to view this help entry.
8981
9082
If this is empty/not set, the original permission is NOT used, instead no permission is required.
91-
default: '""'
9283
9384
ignore-plugins:
9485
description: |

src/config/paper/paper-global.yml

+1
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ unsupported-settings:
477477
message: >-
478478
**Unsupported settings**
479479
480+
480481
The following settings are provided by Paper but are not officially
481482
supported. Use them at your own risk and they may be removed at any time.
482483
allow-headless-pistons:

src/config/paper/paper-world-defaults.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1097,6 +1097,7 @@ unsupported-settings:
10971097
message: >-
10981098
**Unsupported settings**
10991099
1100+
11001101
The following settings are provided by Paper but are not officially
11011102
supported. Use them at your own risk and they may be removed at any time.
11021103
disable-world-ticking-when-empty:

src/config/paper/permissions.yml

-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,3 @@
2626
default: "true"
2727
description_:
2828
description: The description of the permission.
29-
default: '""'

0 commit comments

Comments
 (0)