« get me outta code hell

data: add various art tag properties - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things/art-tag.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-10-02 19:05:11 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-10-02 19:05:11 -0300
commit161db8862cef023f5076c4495e48202d54d8b84a (patch)
tree4857db59f95b7159817e49fe93b72cfa5b20ecd9 /src/data/things/art-tag.js
parent83892033efd40cb4baebe10718930d856b56254d (diff)
data: add various art tag properties
Diffstat (limited to 'src/data/things/art-tag.js')
-rw-r--r--src/data/things/art-tag.js39
1 files changed, 37 insertions, 2 deletions
diff --git a/src/data/things/art-tag.js b/src/data/things/art-tag.js
index f6798214..d86800de 100644
--- a/src/data/things/art-tag.js
+++ b/src/data/things/art-tag.js
@@ -1,9 +1,11 @@
 import {input} from '#composite';
 import find from '#find';
+import {unique} from '#sugar';
 import {isName} from '#validators';
 import {sortAlbumsTracksChronologically} from '#wiki-data';
 
-import {exposeUpdateValueOrContinue} from '#composite/control-flow';
+import {exitWithoutDependency, exposeDependency, exposeUpdateValueOrContinue}
+  from '#composite/control-flow';
 
 import {
   color,
@@ -11,10 +13,13 @@ import {
   flag,
   referenceList,
   reverseReferenceList,
+  simpleString,
   name,
   wikiData,
 } from '#composite/wiki-properties';
 
+import {withAllDescendantTags} from '#composite/things/art-tag';
+
 import Thing from './thing.js';
 
 export class ArtTag extends Thing {
@@ -40,6 +45,8 @@ export class ArtTag extends Thing {
       },
     ],
 
+    description: simpleString(),
+
     directDescendantTags: referenceList({
       class: input.value(ArtTag),
       find: input.value(find.artTag),
@@ -54,7 +61,20 @@ export class ArtTag extends Thing {
 
     // Expose only
 
-    taggedInThings: {
+    descriptionShort: [
+      exitWithoutDependency({
+        dependency: 'description',
+        mode: input.value('falsy'),
+      }),
+
+      {
+        dependencies: ['description'],
+        compute: ({description}) =>
+          description.split('<hr class="split">')[0],
+      },
+    ],
+
+    directlyTaggedInThings: {
       flags: {expose: true},
 
       expose: {
@@ -67,6 +87,21 @@ export class ArtTag extends Thing {
       },
     },
 
+    indirectlyTaggedInThings: [
+      withAllDescendantTags(),
+
+      {
+        dependencies: ['#allDescendantTags'],
+        compute: ({'#allDescendantTags': allDescendantTags}) =>
+          unique(allDescendantTags.flatMap(tag => tag.directlyTaggedInThings)),
+      },
+    ],
+
+    allDescendantTags: [
+      withAllDescendantTags(),
+      exposeDependency({dependency: '#allDescendantTags'}),
+    ],
+
     directAncestorTags: reverseReferenceList({
       data: 'artTagData',
       list: input.value('directDescendantTags'),