Chore: formatting

This commit is contained in:
Pieter Vander Vennet 2024-06-16 16:06:26 +02:00
parent 35eff07c80
commit c08fe03ed0
422 changed files with 31594 additions and 43019 deletions

View file

@ -42,16 +42,16 @@ export default class ChartJs<
this._config = config
}
public static ConstructDoughnut(data: Record<string, number>){
public static ConstructDoughnut(data: Record<string, number>) {
const borderColor = [
// ChartJsColours.unkownBorderColor,
// ChartJsColours.otherBorderColor,
// ChartJsColours.notApplicableBorderColor,
// ChartJsColours.unkownBorderColor,
// ChartJsColours.otherBorderColor,
// ChartJsColours.notApplicableBorderColor,
]
const backgroundColor = [
// ChartJsColours.unkownColor,
// ChartJsColours.otherColor,
// ChartJsColours.notApplicableColor,
// ChartJsColours.unkownColor,
// ChartJsColours.otherColor,
// ChartJsColours.notApplicableColor,
]
let i = 0
@ -59,10 +59,10 @@ export default class ChartJs<
const bg = ChartJsColours.backgroundColors
for (const key in data) {
if(key === ""){
if (key === "") {
borderColor.push(ChartJsColours.unknownBorderColor)
backgroundColor.push(ChartJsColours.unknownColor)
}else{
} else {
borderColor.push(borders[i % borders.length])
backgroundColor.push(bg[i % bg.length])
i++

View file

@ -7,7 +7,7 @@
export let isOpened: Store<boolean>
export let moveTo: Store<HTMLElement>
export let debug : string
export let debug: string
function copySizeOf(htmlElem: HTMLElement) {
const target = htmlElem.getBoundingClientRect()
elem.style.left = target.x + "px"
@ -31,18 +31,18 @@
}
}
onDestroy(isOpened.addCallback(opened => animate(opened)))
onMount(() => requestAnimationFrame(() => animate(isOpened.data)))
onDestroy(isOpened.addCallback((opened) => animate(opened)))
onMount(() => requestAnimationFrame(() => animate(isOpened.data)))
</script>
<div class={"absolute bottom-0 right-0 h-full w-screen p-4 md:p-6 pointer-events-none invisible"}>
<div class={"pointer-events-none invisible absolute bottom-0 right-0 h-full w-screen p-4 md:p-6"}>
<div class="content h-full" bind:this={targetOuter} style="background: red" />
</div>
<div bind:this={elem} class="pointer-events-none absolute bottom-0 right-0 low-interaction rounded-2xl"
style="transition: all 0.5s ease-out, background-color 1.4s ease-out; background: var(--background-color);">
<div
bind:this={elem}
class="low-interaction pointer-events-none absolute bottom-0 right-0 rounded-2xl"
style="transition: all 0.5s ease-out, background-color 1.4s ease-out; background: var(--background-color);"
>
<!-- Classes should be the same as the 'floatoaver' -->
</div>

View file

@ -10,7 +10,6 @@
* The slotted element will be shown on top, with a lower-opacity border
*/
const dispatch = createEventDispatcher<{ close }>()
</script>
<!-- Draw the background over the total screen -->

View file

@ -7,7 +7,7 @@
export let osmConnection: OsmConnection
export let clss: string | undefined = undefined
if(osmConnection === undefined){
if (osmConnection === undefined) {
console.error("No osmConnection passed into loginButton")
}
</script>

View file

@ -19,7 +19,7 @@
/**
* Only show the 'successful' state, don't show loading or error messages
*/
export let silentFail : boolean = false
export let silentFail: boolean = false
let loadingStatus = state?.osmConnection?.loadingStatus ?? new ImmutableStore("logged-in")
let badge = state?.featureSwitches?.featureSwitchEnableLogin ?? new ImmutableStore(true)
const t = Translations.t.general

View file

@ -13,7 +13,7 @@
export let enabled: Store<boolean> = new ImmutableStore(true)
export let arialabel: Translation = undefined
export let htmlElem: UIEventSource<HTMLElement> = undefined
let _htmlElem : HTMLElement
let _htmlElem: HTMLElement
$: {
htmlElem?.setData(_htmlElem)
}

View file

@ -4,15 +4,15 @@
export let src: string = undefined
export let srcWritable: Store<string> = undefined
srcWritable?.addCallbackAndRunD(t => {
srcWritable?.addCallbackAndRunD((t) => {
src = t
})
if(src !== undefined && typeof src !== "string") {
if (src !== undefined && typeof src !== "string") {
console.trace("Got a non-string object in Markdown", src)
throw "Markdown.svelte got a non-string object"
}
</script>
{#if src?.length > 0}
{@html marked.parse(src)}
{/if}

View file

@ -6,13 +6,13 @@ import { default as turndown } from "turndown"
import { Utils } from "../../Utils"
export default class TableOfContents {
private static asLinkableId(text: string): string {
return text
?.replace(/ /g, "-")
?.replace(/[?#.;:/]/, "")
?.toLowerCase() ?? ""
return (
text
?.replace(/ /g, "-")
?.replace(/[?#.;:/]/, "")
?.toLowerCase() ?? ""
)
}
private static mergeLevel(
@ -33,7 +33,7 @@ export default class TableOfContents {
if (running.length !== undefined) {
result.push({
content: new List(running),
level: maxLevel - 1
level: maxLevel - 1,
})
running = []
}
@ -42,7 +42,7 @@ export default class TableOfContents {
if (running.length !== undefined) {
result.push({
content: new List(running),
level: maxLevel - 1
level: maxLevel - 1,
})
}
@ -56,13 +56,16 @@ export default class TableOfContents {
const firstTitle = structure[1]
let minDepth = undefined
do {
minDepth = Math.min(...structure.map(s => s.depth))
const minDepthCount = structure.filter(s => s.depth === minDepth)
minDepth = Math.min(...structure.map((s) => s.depth))
const minDepthCount = structure.filter((s) => s.depth === minDepth)
if (minDepthCount.length > 1) {
break
}
// Erase a single top level heading
structure.splice(structure.findIndex(s => s.depth === minDepth), 1)
structure.splice(
structure.findIndex((s) => s.depth === minDepth),
1
)
} while (structure.length > 0)
if (structure.length <= 1) {
@ -71,7 +74,7 @@ export default class TableOfContents {
const separators = {
1: " -",
2: " +",
3: " *"
3: " *",
}
let toc = ""
@ -96,15 +99,16 @@ export default class TableOfContents {
const splitPoint = intro.lastIndexOf("\n")
return md.substring(0, splitPoint) + toc + md.substring(splitPoint)
}
public static generateStructure(html: Element): { depth: number, title: string, el: Element }[] {
public static generateStructure(
html: Element
): { depth: number; title: string; el: Element }[] {
if (html === undefined) {
return []
}
return [].concat(...Array.from(html.childNodes ?? []).map(
child => {
return [].concat(
...Array.from(html.childNodes ?? []).map((child) => {
const tag: string = child["tagName"]?.toLowerCase()
if (!tag) {
return []
@ -114,7 +118,7 @@ export default class TableOfContents {
return [{ depth, title: child.textContent, el: child }]
}
return TableOfContents.generateStructure(<Element>child)
}
))
})
)
}
}

View file

@ -17,7 +17,6 @@
txt = t?.current
lang = t?.currentLang
}
</script>
{#if $txt}