From 048e79a1ea83a942579ce89f797795e34cc4199e Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sun, 19 May 2024 21:44:18 -0300 Subject: data: TrackSection thing objects Sorry this commit is kind of monolithic! It's difficult to separate out any of the changes since they're all related to track sections' basic functionality. --- src/data/composite/things/track-section/index.js | 1 + .../composite/things/track-section/withAlbum.js | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 src/data/composite/things/track-section/index.js create mode 100644 src/data/composite/things/track-section/withAlbum.js (limited to 'src/data/composite/things/track-section') diff --git a/src/data/composite/things/track-section/index.js b/src/data/composite/things/track-section/index.js new file mode 100644 index 00000000..3202ed49 --- /dev/null +++ b/src/data/composite/things/track-section/index.js @@ -0,0 +1 @@ +export {default as withAlbum} from './withAlbum.js'; diff --git a/src/data/composite/things/track-section/withAlbum.js b/src/data/composite/things/track-section/withAlbum.js new file mode 100644 index 00000000..608cc0cd --- /dev/null +++ b/src/data/composite/things/track-section/withAlbum.js @@ -0,0 +1,22 @@ +// Gets the track section's album. This will early exit if ownAlbumData is +// missing. If there's no album whose list of track sections includes this one, +// the output dependency will be null. + +import {input, templateCompositeFrom} from '#composite'; + +import {withUniqueReferencingThing} from '#composite/wiki-data'; + +export default templateCompositeFrom({ + annotation: `withAlbum`, + + outputs: ['#album'], + + steps: () => [ + withUniqueReferencingThing({ + data: 'ownAlbumData', + list: input.value('trackSections'), + }).outputs({ + ['#uniqueReferencingThing']: '#album', + }), + ], +}); -- cgit 1.3.0-6-gf8a5