« get me outta code hell

data: flash-act: inherit list terminology from side - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things/flash.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-04-03 14:05:23 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-04-03 14:05:23 -0300
commit27e67da7b6f31b6d6da52a7ad09a0da1acc06e03 (patch)
treedfd48f1e420a20ed9a2d032ba766934b844326f9 /src/data/things/flash.js
parentedf927a8d145e27f137d957d20c477c31f1151c3 (diff)
data: flash-act: inherit list terminology from side
Diffstat (limited to 'src/data/things/flash.js')
-rw-r--r--src/data/things/flash.js36
1 files changed, 32 insertions, 4 deletions
diff --git a/src/data/things/flash.js b/src/data/things/flash.js
index 5500707d..dc6a32df 100644
--- a/src/data/things/flash.js
+++ b/src/data/things/flash.js
@@ -4,14 +4,20 @@ import {input} from '#composite';
 import find from '#find';
 import {sortFlashesChronologically} from '#sort';
 import Thing from '#thing';
-import {anyOf, isColor, isDirectory, isNumber, isString} from '#validators';
+import {anyOf, isColor, isContentString, isDirectory, isNumber, isString}
+  from '#validators';
 import {parseDate, parseContributors} from '#yaml';
 
-import {exposeDependency, exposeUpdateValueOrContinue}
-  from '#composite/control-flow';
 import {withPropertyFromObject} from '#composite/data';
 
 import {
+  exposeConstant,
+  exposeDependency,
+  exposeDependencyOrContinue,
+  exposeUpdateValueOrContinue,
+} from '#composite/control-flow';
+
+import {
   color,
   contentString,
   contributionList,
@@ -179,7 +185,27 @@ export class FlashAct extends Thing {
     name: name('Unnamed Flash Act'),
     directory: directory(),
     color: color(),
-    listTerminology: contentString(),
+
+    listTerminology: [
+      exposeUpdateValueOrContinue({
+        validate: input.value(isContentString),
+      }),
+
+      withFlashSide(),
+
+      withPropertyFromObject({
+        object: '#flashSide',
+        property: input.value('listTerminology'),
+      }),
+
+      exposeDependencyOrContinue({
+        dependency: '#flashSide.listTerminology',
+      }),
+
+      exposeConstant({
+        value: input.value(null),
+      }),
+    ],
 
     flashes: referenceList({
       class: input.value(Flash),
@@ -235,6 +261,7 @@ export class FlashSide extends Thing {
     name: name('Unnamed Flash Side'),
     directory: directory(),
     color: color(),
+    listTerminology: contentString(),
 
     acts: referenceList({
       class: input.value(FlashAct),
@@ -254,6 +281,7 @@ export class FlashSide extends Thing {
       'Side': {property: 'name'},
       'Directory': {property: 'directory'},
       'Color': {property: 'color'},
+      'List Terminology': {property: 'listTerminology'},
     },
   };