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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
import {empty} from '#sugar';
export default {
contentDependencies: [
'generateColorStyleAttribute',
'generateTextWithTooltip',
'generateTooltip',
'linkArtist',
'transformContent',
],
extraDependencies: ['html', 'language'],
relations: (relation, entry) => ({
artistLinks:
(!empty(entry.artists) && !entry.artistDisplayText
? entry.artists
.map(artist => relation('linkArtist', artist))
: null),
artistsContent:
(entry.artistDisplayText
? relation('transformContent', entry.artistDisplayText)
: null),
annotationContent:
(entry.annotation
? relation('transformContent', entry.annotation)
: null),
bodyContent:
(entry.body
? relation('transformContent', entry.body)
: null),
colorStyle:
relation('generateColorStyleAttribute'),
textWithTooltip:
relation('generateTextWithTooltip'),
tooltip:
relation('generateTooltip'),
}),
data: (entry) => ({
date: entry.date,
accessDate: entry.accessDate,
accessKind: entry.accessKind,
}),
slots: {
color: {validate: v => v.isColor},
},
generate: (data, relations, slots, {html, language}) =>
language.encapsulate('misc.artistCommentary.entry', entryCapsule =>
html.tags([
html.tag('p', {class: 'commentary-entry-heading'},
slots.color &&
relations.colorStyle.clone()
.slot('color', slots.color),
language.encapsulate(entryCapsule, 'title', titleCapsule => [
html.tag('span', {class: 'commentary-entry-heading-text'},
language.encapsulate(titleCapsule, workingCapsule => {
const workingOptions = {};
workingOptions.artists =
html.tag('span', {class: 'commentary-entry-artists'},
(relations.artistsContent
? relations.artistsContent.slot('mode', 'inline')
: relations.artistLinks
? language.formatConjunctionList(relations.artistLinks)
: language.$(titleCapsule, 'noArtists')));
const accent =
html.tag('span', {class: 'commentary-entry-accent'},
{[html.onlyIfContent]: true},
language.encapsulate(titleCapsule, 'accent', accentCapsule =>
language.encapsulate(accentCapsule, workingCapsule => {
const workingOptions = {};
if (relations.annotationContent) {
workingCapsule += '.withAnnotation';
workingOptions.annotation =
relations.annotationContent.slot('mode', 'inline');
}
if (workingCapsule === accentCapsule) {
return html.blank();
} else {
return language.$(workingCapsule, workingOptions);
}
})));
if (!html.isBlank(accent)) {
workingCapsule += '.withAccent';
workingOptions.accent = accent;
}
return language.$(workingCapsule, workingOptions);
})),
relations.textWithTooltip.slots({
attributes: {class: 'commentary-date'},
customInteractionCue: true,
text:
html.tag('time',
{class: 'text-with-tooltip-interaction-cue'},
{[html.onlyIfContent]: true},
language.$(titleCapsule, 'date', {
[language.onlyIfOptions]: ['date'],
date:
language.formatDate(data.date),
})),
tooltip:
data.accessKind &&
relations.tooltip.slots({
attributes: {class: 'commentary-date-tooltip'},
content:
language.$(titleCapsule, 'date', data.accessKind, {
date:
language.formatDate(data.accessDate),
}),
}),
}),
])),
html.tag('blockquote', {class: 'commentary-entry-body'},
slots.color &&
relations.colorStyle.clone()
.slot('color', slots.color),
relations.bodyContent.slot('mode', 'multiline')),
])),
};
|