File tree Expand file tree Collapse file tree 3 files changed +17
-17
lines changed
packages/site-kit/src/lib Expand file tree Collapse file tree 3 files changed +17
-17
lines changed Original file line number Diff line number Diff line change 59
59
}
60
60
}
61
61
62
- if ( localStorage . getItem ( 'svelte:prefers-ts' ) ! == 'false' ) {
63
- for ( const node of document . querySelectorAll ( '.ts -toggle' ) ) {
62
+ if ( localStorage . getItem ( 'svelte:prefers-ts' ) = == 'false' ) {
63
+ for ( const node of document . querySelectorAll ( '.js -toggle' ) ) {
64
64
node . checked = true ;
65
65
}
66
66
}
Original file line number Diff line number Diff line change 11
11
afterNavigate (update );
12
12
13
13
function update() {
14
- const inputs = container .querySelectorAll (' .ts -toggle' ) as NodeListOf <HTMLInputElement >;
14
+ const inputs = container .querySelectorAll (' .js -toggle' ) as NodeListOf <HTMLInputElement >;
15
15
16
16
for (const input of inputs ) {
17
- input .checked = $prefers_ts ;
17
+ input .checked = ! $prefers_ts ;
18
18
}
19
19
}
20
20
21
21
function toggle(e : Event ) {
22
- if ((e .target as HTMLElement ).classList .contains (' ts -toggle' )) {
22
+ if ((e .target as HTMLElement ).classList .contains (' js -toggle' )) {
23
23
const input = e .target as HTMLInputElement ;
24
- $prefers_ts = input .checked ;
24
+ $prefers_ts = ! input .checked ;
25
25
fix_position (input , update );
26
26
}
27
27
}
32
32
.composedPath ()
33
33
.find ((node ) => (node as HTMLElement ).classList .contains (' code-block' )) as HTMLElement ;
34
34
35
- const ts = !! parent .querySelector (' .ts -toggle:checked' );
35
+ const ts = ! parent .querySelector (' .js -toggle:checked' );
36
36
const code = parent .querySelector (` pre:${ts ? ' last' : ' first' }-of-type code ` ) as HTMLElement ;
37
37
38
38
let result = ' ' ;
132
132
}
133
133
}
134
134
135
- &:has (.ts -toggle :checked ) {
136
- .filename [data-ext ='.js ']::after {
137
- content : ' .ts ' ;
135
+ &:has (.js -toggle :checked ) {
136
+ .filename [data-ext ='.ts ']::after {
137
+ content : ' .js ' ;
138
138
}
139
139
}
140
140
141
- .ts -toggle {
141
+ .js -toggle {
142
142
appearance : none ;
143
143
display : flex ;
144
144
align-items : center ;
160
160
161
161
&::before {
162
162
content : ' JS' ;
163
+ opacity : 0.3 ;
163
164
}
164
165
165
166
&::after {
166
167
content : ' TS' ;
167
168
border-left : none ;
168
- opacity : 0.3 ;
169
169
}
170
170
171
171
&:checked {
172
172
&::before {
173
- opacity: 0.3 ;
173
+ opacity: 1 ;
174
174
}
175
175
176
176
&::after {
177
- opacity : 1 ;
177
+ opacity : 0.3 ;
178
178
}
179
179
}
180
180
}
236
236
}
237
237
}
238
238
239
- &:has (.ts -toggle :checked ) pre :first-of-type {
239
+ &:has (.js -toggle :not ( : checked) ) pre :first-of-type {
240
240
display : none ;
241
241
}
242
242
243
- &:has (.ts -toggle :not ( : checked) ) pre :last-of-type {
243
+ &:has (.js -toggle :checked ) pre :last-of-type {
244
244
display : none ;
245
245
}
246
246
Original file line number Diff line number Diff line change @@ -171,7 +171,7 @@ export async function render_content_markdown(
171
171
}
172
172
173
173
if ( converted ) {
174
- html += `<input class="ts -toggle" title="Toggle language" type="checkbox" aria-label="Toggle JS/TS">` ;
174
+ html += `<input class="js -toggle" title="Toggle language" type="checkbox" aria-label="Toggle JS/TS">` ;
175
175
}
176
176
177
177
if ( options . copy ) {
You can’t perform that action at this time.
0 commit comments