Skip to content

Commit cec4f28

Browse files
committed
Fix build errors
1 parent f95cb3c commit cec4f28

File tree

4 files changed

+68
-83
lines changed

4 files changed

+68
-83
lines changed
Lines changed: 58 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,58 @@
1-
---
2-
import { uniqueId } from "./uniqueid";
3-
import Field from "./Field.astro";
4-
5-
export type Props = {
6-
name: string;
7-
defaultValue: boolean;
8-
};
9-
10-
const cid = uniqueId("BooleanField-");
11-
12-
const { name = "", defaultValue = false } = Astro.props;
13-
---
14-
15-
<Field cid={cid} name={name} fieldType="BooleanField">
16-
<input type="checkbox" id={cid} name={name} checked={defaultValue} />
17-
</Field>
18-
19-
<style>
20-
input {
21-
border: 1px solid var(--sl-color-gray-5);
22-
}
23-
</style>
24-
25-
<script>
26-
function checkboxChange(ev: Event) {
27-
const field = (ev.target as HTMLInputElement).closest<HTMLDivElement>(
28-
'[data-astro-component="BooleanField"]'
29-
)!;
30-
31-
updateFieldTarget(field);
32-
}
33-
34-
function updateFieldTarget(field: HTMLDivElement) {
35-
const root = field.closest<HTMLFieldSetElement>(
36-
'[data-astro-component="Controls"]'
37-
);
38-
const cb = field.querySelector("input")!;
39-
40-
if (root) {
41-
const target = root.dataset.target!;
42-
const targetEl = document.querySelector(target);
43-
44-
if (targetEl) {
45-
targetEl[cb.name] = cb.checked;
46-
}
47-
}
48-
}
49-
50-
document
51-
.querySelectorAll<HTMLDivElement>('[data-astro-component="BooleanField"]')
52-
.forEach((el) => {
53-
const cb = el.querySelector("input");
54-
cb?.addEventListener("change", checkboxChange);
55-
updateFieldTarget(el);
56-
});
57-
</script>
1+
---
2+
import { uniqueId } from "./uniqueid";
3+
import Field from "./Field.astro";
4+
5+
export type Props = {
6+
name: string;
7+
defaultValue: boolean;
8+
};
9+
10+
const cid = uniqueId("BooleanField-");
11+
12+
const { name = "", defaultValue = false } = Astro.props;
13+
---
14+
15+
<Field cid={cid} name={name} fieldType="BooleanField">
16+
<input type="checkbox" id={cid} name={name} checked={defaultValue} />
17+
</Field>
18+
19+
<style>
20+
input {
21+
border: 1px solid var(--sl-color-gray-5);
22+
}
23+
</style>
24+
25+
<script>
26+
function checkboxChange(ev: Event) {
27+
const field = (ev.target as HTMLInputElement).closest<HTMLDivElement>(
28+
'[data-astro-component="BooleanField"]'
29+
)!;
30+
31+
updateFieldTarget(field);
32+
}
33+
34+
function updateFieldTarget(field: HTMLDivElement) {
35+
const root = field.closest<HTMLFieldSetElement>(
36+
'[data-astro-component="Controls"]'
37+
);
38+
const cb = field.querySelector("input")!;
39+
40+
if (root) {
41+
const target = root.dataset.target!;
42+
const targetEl = document.querySelector(target);
43+
44+
if (targetEl) {
45+
// @ts-ignore
46+
targetEl[cb.name] = cb.checked;
47+
}
48+
}
49+
}
50+
51+
document
52+
.querySelectorAll<HTMLDivElement>('[data-astro-component="BooleanField"]')
53+
.forEach((el) => {
54+
const cb = el.querySelector("input");
55+
cb?.addEventListener("change", checkboxChange);
56+
updateFieldTarget(el);
57+
});
58+
</script>

src/components/Controls/EnumField.astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ const { name = "", defaultValue = false, options = [] } = Astro.props;
5858
const targetEl = document.querySelector(target);
5959

6060
if (targetEl) {
61+
// @ts-ignore
6162
targetEl[select.name] = select.value;
6263
}
6364
}

src/components/Controls/NumberField.astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ const { name = "", defaultValue = 0 } = Astro.props;
4949
const targetEl = document.querySelector(target);
5050

5151
if (targetEl) {
52+
// @ts-ignore
5253
targetEl[input.name] = input.value;
5354
}
5455
}

src/components/SiteTitle.astro

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,13 @@ const { siteTitle, siteTitleHref } = Astro.locals.starlightRoute;
66
---
77

88
<a href={siteTitleHref} class="site-title sl-flex">
9-
{
10-
config.logo && logos.dark && (
11-
<>
12-
<img
13-
class:list={{
14-
"light:sl-hidden print:hidden": !("src" in config.logo),
15-
}}
16-
alt={config.logo.alt}
17-
src={logos.dark.src}
18-
width={logos.dark.width}
19-
height={logos.dark.height}
20-
/>
21-
{/* Show light alternate if a user configure both light and dark logos. */}
22-
{!("src" in config.logo) && (
23-
<img
24-
class="dark:sl-hidden print:block"
25-
alt={config.logo.alt}
26-
src={logos.light?.src}
27-
width={logos.light?.width}
28-
height={logos.light?.height}
29-
/>
30-
)}
31-
</>
32-
)
33-
}
9+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 167.435 73.998">
10+
<g fill="#007acc"
11+
><path
12+
d="M115.89 8.141L100.762.857a4.574 4.574 0 00-5.23.89L66.537 28.2l-12.63-9.584a3.042 3.042 0 00-3.908.173l-4.051 3.678a3.067 3.067 0 00-.015 4.526l10.963 10-10.963 10a3.067 3.067 0 00.015 4.526l4.051 3.692c1.107.992 2.745 1.064 3.908.173l12.63-9.584L95.53 72.251a4.552 4.552 0 005.216.89l15.144-7.284a4.576 4.576 0 002.6-4.138V12.28a4.552 4.552 0 00-2.6-4.138zm-15.761 45.56l-22.012-16.71 22.012-16.709zM134.34 0l-7.81 7.81L155.73 37l-29.2 29.188 7.81 7.81 33.095-33.094v-7.81zM40.904 7.81L11.704 37l29.2 29.188-7.81 7.81L0 40.904v-7.81L33.094 0z"
13+
></path></g
14+
>
15+
</svg>
3416
<span class:list={{ "sr-only": config.logo?.replacesTitle }} translate="no">
3517
{siteTitle}
3618
</span>
@@ -58,7 +40,7 @@ const { siteTitle, siteTitleHref } = Astro.locals.starlightRoute;
5840
span {
5941
overflow: hidden;
6042
}
61-
img {
43+
img, svg {
6244
height: calc(var(--sl-nav-height) - 2 * var(--sl-nav-pad-y));
6345
width: auto;
6446
max-width: 100%;

0 commit comments

Comments
 (0)