« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/data/things/flash.js22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/data/things/flash.js b/src/data/things/flash.js
index 71174931..e2afcef4 100644
--- a/src/data/things/flash.js
+++ b/src/data/things/flash.js
@@ -9,9 +9,9 @@ import {
   oneOf,
 } from '#validators';
 
-import {
-  exposeUpdateValueOrContinue,
-} from '#composite/control-flow';
+import {exposeDependency, exposeUpdateValueOrContinue}
+  from '#composite/control-flow';
+import {withPropertyFromObject} from '#composite/data';
 
 import {
   color,
@@ -26,6 +26,8 @@ import {
   wikiData,
 } from '#composite/wiki-properties';
 
+import {withFlashAct} from '#composite/things/flash';
+
 import Thing from './thing.js';
 
 export class Flash extends Thing {
@@ -67,12 +69,14 @@ export class Flash extends Thing {
         validate: input.value(isColor),
       }),
 
-      {
-        flags: {expose: true},
-        dependencies: ['this', 'flashActData'],
-        compute: ({this: flash, flashActData}) =>
-          flashActData.find((act) => act.flashes.includes(flash))?.color ?? null,
-      },
+      withFlashAct(),
+
+      withPropertyFromObject({
+        object: '#flashAct',
+        property: input.value('color'),
+      }),
+
+      exposeDependency({dependency: '#flashAct.color'}),
     ],
 
     date: simpleDate(),