« get me outta code hell

data: Flash.color: replace erroneous syntax w/ composite definition - 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-26 19:32:14 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-10-26 19:37:14 -0300
commit991386372f418b165a192a3ad36fb9b6cecc4d76 (patch)
treecd08f3b21f8da029a44937fd8e75ea570dcfd45a /src/data/things
parent855dcdbc17831809cfb3c800d378c62186702740 (diff)
data: Flash.color: replace erroneous syntax w/ composite definition
Diffstat (limited to 'src/data/things')
-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(),