diff options
| author | (quasar) nebula <qznebula@protonmail.com> | 2025-11-26 19:53:46 -0400 |
|---|---|---|
| committer | (quasar) nebula <qznebula@protonmail.com> | 2025-11-26 20:20:20 -0400 |
| commit | 3fe4b78ad3fb15296447891fa59baeea05ba6c24 (patch) | |
| tree | 0250063d4d07be9d932ee0335c098ef9f5939108 | |
| parent | 5a3d62e696f251647ebf11607b05405aaf384957 (diff) | |
data: Artwork: chop withArtTags, withContentWarningArtTags
| -rw-r--r-- | src/data/composite/things/artwork/index.js | 2 | ||||
| -rw-r--r-- | src/data/composite/things/artwork/withArtTags.js | 99 | ||||
| -rw-r--r-- | src/data/composite/things/artwork/withContentWarningArtTags.js | 27 | ||||
| -rw-r--r-- | src/data/things/artwork.js | 61 |
4 files changed, 49 insertions, 140 deletions
diff --git a/src/data/composite/things/artwork/index.js b/src/data/composite/things/artwork/index.js index b5e5e167..3693c10f 100644 --- a/src/data/composite/things/artwork/index.js +++ b/src/data/composite/things/artwork/index.js @@ -1,7 +1,5 @@ -export {default as withArtTags} from './withArtTags.js'; export {default as withAttachedArtwork} from './withAttachedArtwork.js'; export {default as withContainingArtworkList} from './withContainingArtworkList.js'; -export {default as withContentWarningArtTags} from './withContentWarningArtTags.js'; export {default as withContribsFromAttachedArtwork} from './withContribsFromAttachedArtwork.js'; export {default as withDate} from './withDate.js'; export {default as withPropertyFromAttachedArtwork} from './withPropertyFromAttachedArtwork.js'; diff --git a/src/data/composite/things/artwork/withArtTags.js b/src/data/composite/things/artwork/withArtTags.js deleted file mode 100644 index 1f605d68..00000000 --- a/src/data/composite/things/artwork/withArtTags.js +++ /dev/null @@ -1,99 +0,0 @@ -import {input, templateCompositeFrom} from '#composite'; - -import {raiseOutputWithoutDependency, withResultOfAvailabilityCheck} - from '#composite/control-flow'; -import {withPropertyFromObject} from '#composite/data'; -import {withResolvedReferenceList} from '#composite/wiki-data'; -import {soupyFind} from '#composite/wiki-properties'; - -import withPropertyFromAttachedArtwork - from './withPropertyFromAttachedArtwork.js'; - -export default templateCompositeFrom({ - annotation: `withArtTags`, - - inputs: { - from: input({ - type: 'array', - acceptsNull: true, - defaultDependency: '_artTags', - }), - }, - - outputs: ['#artTags'], - - steps: () => [ - withResolvedReferenceList({ - list: input('from'), - find: soupyFind.input('artTag'), - }), - - withResultOfAvailabilityCheck({ - from: '#resolvedReferenceList', - mode: input.value('empty'), - }), - - { - dependencies: ['#availability', '#resolvedReferenceList'], - compute: (continuation, { - ['#availability']: availability, - ['#resolvedReferenceList']: resolvedReferenceList, - }) => - (availability - ? continuation.raiseOutput({ - '#artTags': resolvedReferenceList, - }) - : continuation()), - }, - - withPropertyFromAttachedArtwork({ - property: input.value('artTags'), - }), - - withResultOfAvailabilityCheck({ - from: '#attachedArtwork.artTags', - mode: input.value('empty'), - }), - - { - dependencies: ['#availability', '#attachedArtwork.artTags'], - compute: (continuation, { - ['#availability']: availability, - ['#attachedArtwork.artTags']: attachedArtworkArtTags, - }) => - (availability - ? continuation.raiseOutput({ - '#artTags': attachedArtworkArtTags, - }) - : continuation()), - }, - - raiseOutputWithoutDependency({ - dependency: 'artTagsFromThingProperty', - output: input.value({'#artTags': []}), - }), - - withPropertyFromObject({ - object: 'thing', - property: 'artTagsFromThingProperty', - }).outputs({ - ['#value']: '#thing.artTags', - }), - - withResultOfAvailabilityCheck({ - from: '#thing.artTags', - mode: input.value('empty'), - }), - - { - dependencies: ['#availability', '#thing.artTags'], - compute: (continuation, { - ['#availability']: availability, - ['#thing.artTags']: thingArtTags, - }) => - (availability - ? continuation({'#artTags': thingArtTags}) - : continuation({'#artTags': []})), - }, - ], -}); diff --git a/src/data/composite/things/artwork/withContentWarningArtTags.js b/src/data/composite/things/artwork/withContentWarningArtTags.js deleted file mode 100644 index 4c07e837..00000000 --- a/src/data/composite/things/artwork/withContentWarningArtTags.js +++ /dev/null @@ -1,27 +0,0 @@ -import {input, templateCompositeFrom} from '#composite'; - -import {withFilteredList, withPropertyFromList} from '#composite/data'; - -import withArtTags from './withArtTags.js'; - -export default templateCompositeFrom({ - annotation: `withContentWarningArtTags`, - - outputs: ['#contentWarningArtTags'], - - steps: () => [ - withArtTags(), - - withPropertyFromList({ - list: '#artTags', - property: input.value('isContentWarning'), - }), - - withFilteredList({ - list: '#artTags', - filter: '#artTags.isContentWarning', - }).outputs({ - '#filteredList': '#contentWarningArtTags', - }), - ], -}); diff --git a/src/data/things/artwork.js b/src/data/things/artwork.js index f30ae29f..d8f7458a 100644 --- a/src/data/things/artwork.js +++ b/src/data/things/artwork.js @@ -25,8 +25,6 @@ import { parseDimensions, } from '#yaml'; -import {withPropertyFromList, withPropertyFromObject} from '#composite/data'; - import { exitWithoutDependency, exposeConstant, @@ -36,9 +34,16 @@ import { } from '#composite/control-flow'; import { + withFilteredList, + withPropertyFromList, + withPropertyFromObject, +} from '#composite/data'; + +import { withRecontextualizedContributionList, withResolvedAnnotatedReferenceList, withResolvedContribs, + withResolvedReferenceList, } from '#composite/wiki-data'; import { @@ -54,12 +59,11 @@ import { } from '#composite/wiki-properties'; import { - withArtTags, withAttachedArtwork, withContainingArtworkList, - withContentWarningArtTags, withContribsFromAttachedArtwork, withDate, + withPropertyFromAttachedArtwork, } from '#composite/things/artwork'; export class Artwork extends Thing { @@ -218,15 +222,42 @@ export class Artwork extends Thing { artTagsFromThingProperty: simpleString(), artTags: [ - withArtTags({ - from: input.updateValue({ + withResolvedReferenceList({ + list: input.updateValue({ validate: validateReferenceList(ArtTag[Thing.referenceType]), }), + find: soupyFind.input('artTag'), + }), + + exposeDependencyOrContinue({ + dependency: '#resolvedReferenceList', + mode: input.value('empty'), + }), + + withPropertyFromAttachedArtwork({ + property: input.value('artTags'), + }), + + exposeDependencyOrContinue({ + dependency: '#attachedArtwork.artTags', + mode: input.value('empty'), + }), + + exitWithoutDependency({ + dependency: 'artTagsFromThingProperty', + value: input.value([]), + }), + + withPropertyFromObject({ + object: 'thing', + property: 'artTagsFromThingProperty', + }).outputs({ + ['#value']: '#thing.artTags', }), exposeDependency({ - dependency: '#artTags', + dependency: '#thing.artTags' }), ], @@ -372,18 +403,24 @@ export class Artwork extends Thing { ], contentWarningArtTags: [ - withContentWarningArtTags(), + withPropertyFromList({ + list: 'artTags', + property: input.value('isContentWarning'), + }), + + withFilteredList({ + list: 'artTags', + filter: '#artTags.isContentWarning', + }), exposeDependency({ - dependency: '#contentWarningArtTags', + dependency: '#filteredList', }), ], contentWarnings: [ - withContentWarningArtTags(), - withPropertyFromList({ - list: '#contentWarningArtTags', + list: 'contentWarningArtTags', property: input.value('name'), }), |