« get me outta code hell

data, yaml: new flash Color / color field - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-10-24 11:33:25 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-10-24 11:33:25 -0300
commita80dcfd176c41cef1995f5349a1464d4746badbd (patch)
tree9c3d503f637c6fc5240bda7d0d98e783913ed5ce /src/data/things
parent0df06e2f5d7bb3aeaccfd6b2187eec6e8f40755f (diff)
data, yaml: new flash Color / color field
Diffstat (limited to 'src/data/things')
-rw-r--r--src/data/things/flash.js28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/data/things/flash.js b/src/data/things/flash.js
index 511ff19c..71174931 100644
--- a/src/data/things/flash.js
+++ b/src/data/things/flash.js
@@ -10,6 +10,10 @@ import {
 } from '#validators';
 
 import {
+  exposeUpdateValueOrContinue,
+} from '#composite/control-flow';
+
+import {
   color,
   contributionList,
   directory,
@@ -58,6 +62,19 @@ export class Flash extends Thing {
       },
     },
 
+    color: [
+      exposeUpdateValueOrContinue({
+        validate: input.value(isColor),
+      }),
+
+      {
+        flags: {expose: true},
+        dependencies: ['this', 'flashActData'],
+        compute: ({this: flash, flashActData}) =>
+          flashActData.find((act) => act.flashes.includes(flash))?.color ?? null,
+      },
+    ],
+
     date: simpleDate(),
 
     coverArtFileExtension: fileExtension('jpg'),
@@ -90,17 +107,6 @@ export class Flash extends Thing {
           flashActData.find((act) => act.flashes.includes(flash)) ?? null,
       },
     },
-
-    color: {
-      flags: {expose: true},
-
-      expose: {
-        dependencies: ['this', 'flashActData'],
-
-        compute: ({this: flash, flashActData}) =>
-          flashActData.find((act) => act.flashes.includes(flash))?.color ?? null,
-      },
-    },
   });
 
   static [Thing.getSerializeDescriptors] = ({