Represents the object with defaults allowed to be used via make_memory_storage
Represents if the current context is in-Browser
Returns the key
and value
stringified to a CSS Property Declaration, e.g. color:red
import {format_css_declaration} from "svelte-commons/lib/util/shared";
const key = "color";
const value = "red";
const declaration = format_css_declaration(key, value);
console.log(declaration); // logs: `color:red`
Returns the key
stringified into a CSS Variable reference, e.g. var(--primary-color)
import {format_css_reference} from "svelte-commons/lib/util/shared";
const key = "primary-color";
const default_value = "blue";
const reference = format_css_reference(key, default_value);
console.log(reference); // logs: `var(--primary-color, blue)`
Returns the key
and value
stringified into a CSS Variable Declaration, e.g. --primary-color:red
import {format_css_variable} from "svelte-commons/lib/util/shared";
const key = "primary-color";
const value = "red";
const variable = format_css_variable(key, value);
console.log(variable); // logs: `--primary-color:red`
Represents an in-memory reimplementation of a Web Storage API
import {make_memory_storage} from "svelte-commons/lib/util/shared";
const storage = make_memory_storage();
// Save data to Storage
storage.setItem("key", "value");
// Get saved data from Storage
let data = storage.getItem("key");
// Remove saved data from Storage
storage.removeItem("key");
// Remove all saved data from Storage
storage.clear();
Returns a key-value mapping of CSS Classes transformed into a single spaced string, e.g.
btn btn-primary
import {map_classes} from "svelte-commons/lib/util/shared";
const data = {
btn: "true",
"btn-%s": "primary",
btn_outline: false
};
const classes = map_classes(data);
console.log(classes); // logs: `btn btn-primary`
Returns a key-value mapping of CSS Properties transformed into a single semi-colon ;
string, e.g. background-color:black;color:white;
import {map_style} from "svelte-commons/lib/util/shared";
const data = {
background_color: "white",
color: "black"
};
const style = map_style(data);
console.log(style); // logs: `background-color:white;color:black;`
Returns a key-value mapping of CSS Variables transformed into a single semi-colon ;
string, e.g. --background:black;--foreground:white;
import {map_variables} from "svelte-commons/lib/util/shared";
const data = {
theme_background: "white",
theme_foreground: "black"
};
const variables = map_variables(data);
console.log(variables); // logs: `--theme-background:white;--theme-foreground:black;`
Generated using TypeDoc
Represents the type mapping used for the
map_*
functions