« get me outta code hell

content: pass color directly through slots in various places - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateColorStyleVariables.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-08-02 12:45:30 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-08-02 12:45:30 -0300
commit00644623eb6c99a33b3b08771f4f23841f747b88 (patch)
treeeffb4db5cb5a317adc56614484180552c447cc70 /src/content/dependencies/generateColorStyleVariables.js
parentc699396105f5aaa2380ab3dee282e1f99f7055fb (diff)
content: pass color directly through slots in various places
Primarily through generateColorStyle{Rules,Variables}, the former
of which is also refactored into generatePageLayout, which now
takes a direct color slot itself as well.
Diffstat (limited to 'src/content/dependencies/generateColorStyleVariables.js')
-rw-r--r--src/content/dependencies/generateColorStyleVariables.js14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/content/dependencies/generateColorStyleVariables.js b/src/content/dependencies/generateColorStyleVariables.js
index 90346d8d..f30d786b 100644
--- a/src/content/dependencies/generateColorStyleVariables.js
+++ b/src/content/dependencies/generateColorStyleVariables.js
@@ -1,14 +1,12 @@
 export default {
-  extraDependencies: [
-    'getColors',
-  ],
+  extraDependencies: ['html', 'getColors'],
 
-  data(color) {
-    return {color};
+  slots: {
+    color: {validate: v => v.isColor},
   },
 
-  generate(data, {getColors}) {
-    if (!data.color) return [];
+  generate(slots, {getColors}) {
+    if (!slots.color) return [];
 
     const {
       primary,
@@ -18,7 +16,7 @@ export default {
       bg,
       bgBlack,
       shadow,
-    } = getColors(data.color);
+    } = getColors(slots.color);
 
     return [
       `--primary-color: ${primary}`,