« get me outta code hell

FlashSide.js « flash « things « data « src - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things/flash/FlashSide.js
blob: 5e2ea3de24c3d6ff134edd532a74f43f1f293e72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import {V} from '#composite';
import Thing from '#thing';

import {exposeConstant} from '#composite/control-flow';
import {color, contentString, directory, name, soupyFind, thingList}
  from '#composite/wiki-properties';

export class FlashSide extends Thing {
  static [Thing.referenceType] = 'flash-side';
  static [Thing.friendlyName] = `Flash Side`;
  static [Thing.wikiData] = 'flashSideData';

  static [Thing.getPropertyDescriptors] = ({FlashAct}) => ({
    // Update & expose

    name: name(V('Unnamed Flash Side')),
    directory: directory(),
    color: color(),
    listTerminology: contentString(),

    acts: thingList(V(FlashAct)),

    // Update only

    find: soupyFind(),

    // Expose only

    isFlashSide: exposeConstant(V(true)),
  });

  static [Thing.yamlDocumentSpec] = {
    fields: {
      'Side': {property: 'name'},
      'Directory': {property: 'directory'},
      'Color': {property: 'color'},
      'List Terminology': {property: 'listTerminology'},
    },
  };

  static [Thing.findSpecs] = {
    flashSide: {
      referenceTypes: ['flash-side'],
      bindTo: 'flashSideData',
    },
  };

  static [Thing.reverseSpecs] = {
    flashSidesWhoseActsInclude: {
      bindTo: 'flashSideData',

      referencing: flashSide => [flashSide],
      referenced: flashSide => flashSide.acts,
    },
  };
}