@@ -23,7 +23,9 @@ interface Default {
23
23
inline: boolean ;
24
24
}
25
25
const formatDefault = (value ? : string ): Default => {
26
- if (! value ) value = " " ;
26
+ if (! value ) {
27
+ value = lang === " properties" ? " " : ' ""' ;
28
+ }
27
29
if (! json && value .length > 2 && value .match (/ ^ \[ . + ]$ / )) {
28
30
return {
29
31
value: value
@@ -44,7 +46,9 @@ const formatDefault = (value?: string): Default => {
44
46
{
45
47
Object .entries (data ).map (([key , rawValue ], i , entries ) => {
46
48
let displayKey = key .replace (/ _+ $ / , " " ); // remove trailing underscores, used for duplicating keys
47
- if (json ) displayKey = ` "${displayKey }" ` ;
49
+ if (json ) {
50
+ displayKey = ` "${displayKey }" ` ;
51
+ }
48
52
49
53
const childPath = [... path , key .replace (/ -/ g , " _" )];
50
54
const hasComma = json && i !== (entries .length - 1 );
@@ -61,16 +65,16 @@ const formatDefault = (value?: string): Default => {
61
65
) : " description" in rawValue ? (
62
66
<details id = { childPath .join (" _" )} >
63
67
<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 >{
65
69
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 >)
67
71
: (<a class = " link" href = { ` #${childPath .join (" _" )} ` } >#</a ><p class = " value" >{ value } </p ><>{ hasComma && <span class = " muted" >,</span >} </>)
68
72
}
69
73
</summary >
70
74
<div class = " block" set :html = { render (rawValue .description )} />
71
75
</details >
72
76
) : (
73
- <span class = " key notranslate" translate = " no" >{ displayKey } { separator } </span >
77
+ <span class = " key notranslate" translate = " no" >{ displayKey } </ span >< span class = " muted " > { separator } </span >
74
78
<Astro.self child data = { rawValue } path = { childPath } { lang } />
75
79
)}
76
80
</div >
@@ -108,6 +112,10 @@ const formatDefault = (value?: string): Default => {
108
112
109
113
.key {
110
114
white-space: pre-wrap;
115
+ color: var(--sl-color-gray-3);
116
+ }
117
+
118
+ .key-leaf {
111
119
color: var(--sl-color-text-accent);
112
120
}
113
121
@@ -125,7 +133,6 @@ const formatDefault = (value?: string): Default => {
125
133
color: var(--sl-color-white);
126
134
background-color: var(--sl-color-gray-5);
127
135
border-left: 5px solid var(--sl-color-bg-accent);
128
- white-space: pre-wrap;
129
136
}
130
137
131
138
.message {
@@ -144,14 +151,24 @@ const formatDefault = (value?: string): Default => {
144
151
color: var(--sl-color-gray-3);
145
152
}
146
153
147
- .link {
148
- opacity: 0;
149
- padding-left: 0.5rem ;
154
+ .link,
155
+ .link:visited {
156
+ color: var(--sl-color-accent-high) ;
150
157
transition: opacity 0.2s ease;
151
158
}
152
159
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
+ }
155
172
}
156
173
</style >
157
174
0 commit comments