« get me outta code hell

data: contribution: context - 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>2024-03-04 20:25:05 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-06-12 17:26:32 -0300
commitbe402bfcad9a8ab5287ed15f942f5d4730d7490e (patch)
tree192b87ebba2f90ba383bb5e1b547d8b236643594 /src/data/things
parentef84fb80de0a26fcb959fa6e6799cd01388d236f (diff)
data: contribution: context
Diffstat (limited to 'src/data/things')
-rw-r--r--src/data/things/contribution.js26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/data/things/contribution.js b/src/data/things/contribution.js
index 7eb8cfc7..e6479a1e 100644
--- a/src/data/things/contribution.js
+++ b/src/data/things/contribution.js
@@ -10,7 +10,10 @@ import {isStringNonEmpty, isThing, validateReference} from '#validators';
 import {exposeDependency} from '#composite/control-flow';
 import {withResolvedReference} from '#composite/wiki-data';
 
-import {withContributionArtist} from '#composite/things/contribution';
+import {
+  withContributionArtist,
+  withContributionContext,
+} from '#composite/things/contribution';
 
 export class Contribution extends Thing {
   static [Thing.getPropertyDescriptors] = () => ({
@@ -42,6 +45,27 @@ export class Contribution extends Thing {
       flags: {update: true, expose: true},
       update: {validate: isStringNonEmpty},
     },
+
+    // Expose only
+
+    context: [
+      withContributionContext(),
+
+      {
+        dependencies: [
+          '#contributionTarget',
+          '#contributionProperty',
+        ],
+
+        compute: ({
+          ['#contributionTarget']: target,
+          ['#contributionProperty']: property,
+        }) => ({
+          target,
+          property,
+        }),
+      },
+    ],
   });
 
   [inspect.custom](depth, options, inspect) {