chore: automated housekeeping...

This commit is contained in:
Pieter Vander Vennet 2024-08-23 13:13:41 +02:00
parent 18e977db2a
commit 22a7a14880
111 changed files with 25070 additions and 1612 deletions

View file

@ -7,16 +7,19 @@ export default class UrlValidator extends Validator {
private static readonly aggregatorWebsites = new Set<string>([
"booking.com",
"hotel-details-guide.com", "tripingguide.com",
"tripadvisor.com", "tripadvisor.co.uk", "tripadvisor.com.au",
"hotel-details-guide.com",
"tripingguide.com",
"tripadvisor.com",
"tripadvisor.co.uk",
"tripadvisor.com.au",
])
constructor(name?: string, explanation?: string, forceHttps?: boolean) {
super(
name ?? "url",
explanation ??
"The validatedTextField will format URLs to always be valid and have a https://-header (even though the 'https'-part will be hidden from the user. Furthermore, some tracking parameters will be removed",
"url",
"The validatedTextField will format URLs to always be valid and have a https://-header (even though the 'https'-part will be hidden from the user. Furthermore, some tracking parameters will be removed",
"url"
)
this._forceHttps = forceHttps ?? false
}

View file

@ -147,7 +147,7 @@
{:else if icon === "user_circle"}
<UserCircleIcon class={clss} {color} />
{:else if Utils.isEmoji(icon)}
<span style= {`font-size: ${emojiHeight}; line-height: ${emojiHeight}`}>
<span style={`font-size: ${emojiHeight}; line-height: ${emojiHeight}`}>
{icon}
</span>
{:else}

View file

@ -30,7 +30,7 @@
* Class which is applied onto the individual icons
*/
export let clss = ""
export let emojiHeight : string = "40px"
export let emojiHeight: string = "40px"
/**
* Class applied onto the entire element

View file

@ -23,7 +23,7 @@
let rasterLayerId = rasterLayer.sync(
(l) => l?.properties?.id,
[],
(id) => availableLayers.find((l) => l.properties.id === id),
(id) => availableLayers.find((l) => l.properties.id === id)
)
rasterLayer.setData(availableLayers[0])
$: rasterLayer.setData(availableLayers[0])
@ -36,13 +36,13 @@
return
}
rasterLayer.setData(fav)
}),
})
)
onDestroy(
rasterLayer.addCallbackAndRunD((selected) => {
favourite?.setData(selected.properties.id)
}),
})
)
}
@ -56,7 +56,7 @@
} else {
rasterLayerOnMap.setData(undefined)
}
}),
})
)
}

View file

@ -40,38 +40,39 @@
}
const emojiHeights = {
"small": "2rem",
"medium": "3rem",
"large": "5rem",
small: "2rem",
medium: "3rem",
large: "5rem",
}
function getAutoIcon(mapping: {if?: TagsFilter }): BaseUIElement {
function getAutoIcon(mapping: { if?: TagsFilter }): BaseUIElement {
for (const preset of layer.presets) {
if (!new And(preset.tags).shadows(mapping.if)) {
continue
}
return layer.defaultIcon(TagUtils.asProperties(preset.tags))
}
return undefined
}
</script>
{#if mapping.icon !== undefined}
<div class="inline-flex items-center">
{#if mapping.icon === "auto"}
<div class="w-8 h-8 shrink-0 mr-2">
<div class="mr-2 h-8 w-8 shrink-0">
<ToSvelte construct={() => getAutoIcon(mapping)} />
</div>
{:else}
<Marker
icons={mapping.icon}
size={twJoin("shrink-0",
`mapping-icon-${mapping.iconClass ?? "small"}-height mapping-icon-${
mapping.iconClass ?? "small"
}-width`)}
emojiHeight={ emojiHeights[mapping.iconClass] ?? "2rem"}
size={twJoin(
"shrink-0",
`mapping-icon-${mapping.iconClass ?? "small"}-height mapping-icon-${
mapping.iconClass ?? "small"
}-width`
)}
emojiHeight={emojiHeights[mapping.iconClass] ?? "2rem"}
clss={`mapping-icon-${mapping.iconClass ?? "small"}`}
/>
{/if}

View file

@ -46,7 +46,9 @@ export default class SpecialVisualisationUtils {
}
// Note: the '.*?' in the regex reads as 'any character, but in a non-greedy way'
const matched = template.match(new RegExp(`(.*?){\([a-zA-Z_]+\)\\((.*?)\\)(:.*)?}(.*)`, "s"))
const matched = template.match(
new RegExp(`(.*?){\([a-zA-Z_]+\)\\((.*?)\\)(:.*)?}(.*)`, "s")
)
if (matched === null) {
// IF we end up here, no changes have to be made - except to remove any resting {}
return [template]

View file

@ -2132,7 +2132,7 @@ export default class SpecialVisualizations {
layer,
})
},
}
},
]
specialVisualizations.push(new AutoApplyButton(specialVisualizations))
@ -2151,12 +2151,12 @@ export default class SpecialVisualizations {
)
}
const allNames = specialVisualizations.map(f => f.funcName)
const allNames = specialVisualizations.map((f) => f.funcName)
const seen = new Set<string>()
for (let name of allNames) {
name = name.toLowerCase()
if(seen.has(name)){
throw "Invalid special visualisations: detected a duplicate name: "+name
if (seen.has(name)) {
throw "Invalid special visualisations: detected a duplicate name: " + name
}
seen.add(name)
}