chore: automated housekeeping...

This commit is contained in:
Pieter Vander Vennet 2025-04-15 18:18:44 +02:00
parent 79b6927b56
commit 42ded4c1b1
328 changed files with 4062 additions and 1284 deletions

View file

@ -79,7 +79,13 @@ export class ImageVisualisations {
const estimated = tags.mapD((tags) =>
AllImageProviders.estimateNumberOfImages(tags, imagePrefixes)
)
return new SvelteUIElement(ImageCarousel, { state, tags, images, estimated, feature })
return new SvelteUIElement(ImageCarousel, {
state,
tags,
images,
estimated,
feature,
})
},
},
{

View file

@ -1,4 +1,8 @@
import { SpecialVisualization, SpecialVisualizationState, SpecialVisualizationSvelte } from "../SpecialVisualization"
import {
SpecialVisualization,
SpecialVisualizationState,
SpecialVisualizationSvelte,
} from "../SpecialVisualization"
import Constants from "../../Models/Constants"
import { UIEventSource } from "../../Logic/UIEventSource"
import { Feature } from "geojson"

View file

@ -80,23 +80,22 @@ export class SettingsVisualisations {
group: "settings",
docs: "Shows the current state of storage",
args: [],
constr: function(state: SpecialVisualizationState): SvelteUIElement {
constr: function (state: SpecialVisualizationState): SvelteUIElement {
const data = {}
for (const key in localStorage) {
data[key] = localStorage[key]
}
const tags = new UIEventSource(data)
navigator.storage.estimate().then(estimate => {
navigator.storage.estimate().then((estimate) => {
data["__usage:current:bytes"] = estimate.usage
data["__usage:current:human"] = Utils.toHumanByteSize(estimate.usage)
data["__usage:quota:bytes"] = estimate.quota
data["__usage:quota:human"] = Utils.toHumanByteSize(estimate.quota)
tags.ping()
})
return new SvelteUIElement(AllTagsPanel, { state, tags })
}
},
},
{
funcName: "clear_caches",

View file

@ -29,13 +29,13 @@ class QuestionViz implements SpecialVisualizationSvelte {
},
{
name: "blacklisted-labels",
doc: "One or more ';'-separated labels of questions which should _not_ be included. Note that the questionbox which is added by default will blacklist 'hidden'"
doc: "One or more ';'-separated labels of questions which should _not_ be included. Note that the questionbox which is added by default will blacklist 'hidden'",
},
{
name: "show_all",
default: "user-preference",
doc: "Either `no`, `yes` or `user-preference`. Indicates if all questions should be shown at once"
}
doc: "Either `no`, `yes` or `user-preference`. Indicates if all questions should be shown at once",
},
]
svelteBased = true
group: "default"
@ -69,7 +69,7 @@ class QuestionViz implements SpecialVisualizationSvelte {
state,
onlyForLabels: labels,
notForLabels: blacklist,
showAllQuestionsAtOnce
showAllQuestionsAtOnce,
})
}
}

View file

@ -24,8 +24,8 @@ export class WebAndCommunicationSpecialVisualisations {
{
name: "key",
doc: "The attribute-name containing the link",
required: true
}
required: true,
},
],
constr(
@ -35,7 +35,7 @@ export class WebAndCommunicationSpecialVisualisations {
): BaseUIElement {
const key = argument[0]
return new SvelteUIElement(FediverseLink, { key, tags, state })
}
},
},
{
funcName: "wikipedia",
@ -45,8 +45,8 @@ export class WebAndCommunicationSpecialVisualisations {
{
name: "keyToShowWikipediaFor",
doc: "Use the wikidata entry from this key to show the wikipedia article for. Multiple keys can be given (separated by ';'), in which case the first matching value is used",
defaultValue: "wikidata;wikipedia"
}
defaultValue: "wikidata;wikipedia",
},
],
needsUrls: [...Wikidata.neededUrls, ...Wikipedia.neededUrls],
@ -59,9 +59,9 @@ export class WebAndCommunicationSpecialVisualisations {
return tags[key]?.split(";")?.map((id) => id.trim()) ?? []
})
return new SvelteUIElement(WikipediaPanel, {
wikiIds
wikiIds,
})
}
},
},
{
funcName: "wikidata_label",
@ -72,8 +72,8 @@ export class WebAndCommunicationSpecialVisualisations {
{
name: "keyToShowWikidataFor",
doc: "Use the wikidata entry from this key to show the label",
defaultValue: "wikidata"
}
defaultValue: "wikidata",
},
],
needsUrls: Wikidata.neededUrls,
example:
@ -87,7 +87,7 @@ export class WebAndCommunicationSpecialVisualisations {
)
return wikidataIds?.[0]
})
const entry = id.bind(id => Wikidata.LoadWikidataEntry(id))
const entry = id.bind((id) => Wikidata.LoadWikidataEntry(id))
return new VariableUiElement(
entry.map((e) => {
@ -96,8 +96,9 @@ export class WebAndCommunicationSpecialVisualisations {
}
const response = <WikidataResponse>e["success"]
return Translation.fromMap(response.labels)
}))
}
})
)
},
},
new MapillaryLinkVis(),
{
@ -108,29 +109,29 @@ export class WebAndCommunicationSpecialVisualisations {
{
name: "to",
doc: "Who to send the email to?",
required: true
required: true,
},
{
name: "subject",
doc: "The subject of the email",
required: true
required: true,
},
{
name: "body",
doc: "The text in the email",
required: true
required: true,
},
{
name: "button_text",
doc: "The text shown on the button in the UI",
required: true
}
required: true,
},
],
constr(__, tags, args) {
return new SvelteUIElement(SendEmail, { args, tags })
}
},
},
{
funcName: "link",
@ -140,29 +141,29 @@ export class WebAndCommunicationSpecialVisualisations {
{
name: "text",
doc: "Text to be shown",
required: true
required: true,
},
{
name: "href",
doc: "The URL to link to. Note that this will be URI-encoded before ",
required: true
required: true,
},
{
name: "class",
doc: "CSS-classes to add to the element"
doc: "CSS-classes to add to the element",
},
{
name: "download",
doc: "Expects a string which denotes the filename to download the contents of `href` into. If set, this link will act as a download-button."
doc: "Expects a string which denotes the filename to download the contents of `href` into. If set, this link will act as a download-button.",
},
{
name: "arialabel",
doc: "If set, this text will be used as aria-label"
doc: "If set, this text will be used as aria-label",
},
{
name: "icon",
doc: "If set, show this icon next to the link. You might want to combine this with `class: button`"
}
doc: "If set, show this icon next to the link. You might want to combine this with `class: button`",
},
],
constr(
@ -184,10 +185,10 @@ export class WebAndCommunicationSpecialVisualisations {
download: tagSource.map((tags) => Utils.SubstituteKeys(download, tags)),
ariaLabel: tagSource.map((tags) => Utils.SubstituteKeys(ariaLabel, tags)),
newTab: new ImmutableStore(newTab),
icon: tagSource.map((tags) => Utils.SubstituteKeys(icon, tags))
icon: tagSource.map((tags) => Utils.SubstituteKeys(icon, tags)),
}).setSpan()
}
}
},
},
]
}
}