diff --git a/src/actions/cssVariables/index.js b/src/actions/cssVariables/index.js
index 523e09e8..177a077d 100644
--- a/src/actions/cssVariables/index.js
+++ b/src/actions/cssVariables/index.js
@@ -5,16 +5,16 @@ export default (node, props) => {
});
return {
- update(new_props) {
- Object.entries(new_props).forEach(([key, value]) => {
+ update(newProps) {
+ Object.entries(newProps).forEach(([key, value]) => {
node.style.setProperty(`--${key}`, value);
delete props[key];
});
- Object.keys(props).forEach(name =>
- node.style.removeProperty(`--${name}`),
- );
- props = new_props;
+ Object.keys(props).forEach((name) => {
+ node.style.removeProperty(`--${name}`);
+ });
+ props = newProps;
},
};
-};
\ No newline at end of file
+};
diff --git a/src/components/GraphicBlock/stories/docs/ai2svelte.md b/src/components/GraphicBlock/stories/docs/ai2svelte.md
index 13a78558..d6485156 100644
--- a/src/components/GraphicBlock/stories/docs/ai2svelte.md
+++ b/src/components/GraphicBlock/stories/docs/ai2svelte.md
@@ -14,6 +14,6 @@ You can use `GraphicBlock` with components created by [ai2svelte](https://github
notes="Note: A shakemap represents the ground shaking produced by an earthquake."
ariaDescription="A map showing shake intensity of the quake."
>
-
+
```
diff --git a/src/components/GraphicBlock/stories/docs/aria.md b/src/components/GraphicBlock/stories/docs/aria.md
index a8e99842..b7c2d395 100644
--- a/src/components/GraphicBlock/stories/docs/aria.md
+++ b/src/components/GraphicBlock/stories/docs/aria.md
@@ -12,7 +12,7 @@ The `ariaDescription` string will be processed as markdown, so you can add multi
notes="Note: A shakemap represents the ground shaking produced by an earthquake."
ariaDescription="A map showing the shake intensity produced by the earthquake."
>
-
+
```
diff --git a/src/components/Theme/Theme.stories.svelte b/src/components/Theme/Theme.stories.svelte
new file mode 100644
index 00000000..878d52c0
--- /dev/null
+++ b/src/components/Theme/Theme.stories.svelte
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
My theme
+
+
+
My sub-theme
+
+
+
+
+
+
My other sub-sub-theme
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/Theme/Theme.svelte b/src/components/Theme/Theme.svelte
new file mode 100644
index 00000000..57a0f9ab
--- /dev/null
+++ b/src/components/Theme/Theme.svelte
@@ -0,0 +1,42 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/Theme/stories/docs/component.md b/src/components/Theme/stories/docs/component.md
new file mode 100644
index 00000000..7528df87
--- /dev/null
+++ b/src/components/Theme/stories/docs/component.md
@@ -0,0 +1,3 @@
+> ⏳ Coming soon!
+
+Set a theme for your page.
diff --git a/src/components/Theme/utils/flatten.js b/src/components/Theme/utils/flatten.js
new file mode 100644
index 00000000..3385c935
--- /dev/null
+++ b/src/components/Theme/utils/flatten.js
@@ -0,0 +1,40 @@
+function isBuffer(obj) {
+ return obj &&
+ obj.constructor &&
+ (typeof obj.constructor.isBuffer === 'function') &&
+ obj.constructor.isBuffer(obj);
+}
+
+const transformKey = (key) => key.replace(/[^a-z0-9-]/gi, '');
+
+export default function flatten(target) {
+ const delimiter = '-';
+ const output = {};
+
+ function step(object, prev, currentDepth = 1) {
+ Object.keys(object).forEach(function(key) {
+ const value = object[key];
+ const isArray = Array.isArray(value);
+ const type = Object.prototype.toString.call(value);
+ const isbuffer = isBuffer(value);
+ const isObject = (
+ type === '[object Object]' ||
+ type === '[object Array]'
+ );
+
+ const newKey = prev ?
+ prev + delimiter + transformKey(key) :
+ transformKey(key);
+
+ if (!isArray && !isbuffer && isObject && Object.keys(value).length) {
+ return step(value, newKey, currentDepth + 1);
+ }
+
+ output[newKey] = value;
+ });
+ }
+
+ step(target);
+
+ return output;
+}