From a80dcfd176c41cef1995f5349a1464d4746badbd Mon Sep 17 00:00:00 2001
From: "(quasar) nebula" <qznebula@protonmail.com>
Date: Tue, 24 Oct 2023 11:33:25 -0300
Subject: data, yaml: new flash Color / color field

---
 src/data/things/flash.js | 28 +++++++++++++++++-----------
 src/data/yaml.js         |  1 +
 2 files changed, 18 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
@@ -9,6 +9,10 @@ import {
   oneOf,
 } from '#validators';
 
+import {
+  exposeUpdateValueOrContinue,
+} from '#composite/control-flow';
+
 import {
   color,
   contributionList,
@@ -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] = ({
diff --git a/src/data/yaml.js b/src/data/yaml.js
index 16303a64..f7856cb7 100644
--- a/src/data/yaml.js
+++ b/src/data/yaml.js
@@ -544,6 +544,7 @@ export const processFlashDocument = makeProcessDocument(T.Flash, {
     name: 'Flash',
     directory: 'Directory',
     page: 'Page',
+    color: 'Color',
     urls: 'URLs',
 
     date: 'Date',
-- 
cgit 1.3.0-6-gf8a5