@pseudolux-ui/media-library 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/package.json +22 -4
- package/src/checks.ts +132 -0
- package/src/components/BinDialog.lsp +208 -0
- package/src/components/CommandBar.lsp +526 -0
- package/src/components/CropEditor.lsp +616 -0
- package/src/components/DescribeRun.lsp +527 -0
- package/src/components/GroupCover.lsp +227 -0
- package/src/components/LibraryDesk.lsp +415 -0
- package/src/components/LibraryFrame.lsp +362 -0
- package/src/components/LibraryGroups.lsp +197 -0
- package/src/components/LinkDialog.lsp +436 -0
- package/src/components/PictureEditor.lsp +1813 -0
- package/src/components/PicturePeek.lsp +428 -0
- package/src/components/PictureWall.lsp +1532 -0
- package/src/components/ResponsiveImage.lsp +297 -0
- package/src/components/SentenceBar.lsp +361 -0
- package/src/components/UploadBatch.lsp +1083 -0
- package/src/config.ts +206 -0
- package/src/cuts.ts +29 -0
- package/src/index.ts +44 -0
- package/src/ladder.ts +82 -0
- package/src/port.ts +217 -0
- package/src/rows.ts +142 -0
- package/src/sentence.ts +164 -0
- package/src/styles/px.css +152 -0
- package/src/survey.ts +75 -0
- package/README.md +0 -3
|
@@ -0,0 +1,1813 @@
|
|
|
1
|
+
<view>
|
|
2
|
+
<div class="studio" role="dialog" aria-modal="true" $aria-label="'Editing ' + state.label" $show="state.open" $ref="root" @keydown="onKey">
|
|
3
|
+
<div class="ebar">
|
|
4
|
+
<button class="dk-btn" type="button" $ref="back" @click="close"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m15 18-6-6 6-6"></path></svg> Back</button>
|
|
5
|
+
<div class="who">
|
|
6
|
+
<b class="who-name">{{ state.label }}</b>
|
|
7
|
+
<span class="who-pos">{{ state.position }}</span>
|
|
8
|
+
</div>
|
|
9
|
+
<div class="ring" role="img" $aria-label="state.ringLabel" $title="state.ringTitle" $style="state.ringStyle"><span>{{ state.ringText }}</span></div>
|
|
10
|
+
<span class="status" role="status" $class="{ 'is-bad': state.saveFailed }">{{ state.status }}</span>
|
|
11
|
+
<button class="dk-btn" type="button" aria-label="Previous picture" $disabled="!state.prevId" @click="go(state.prevId)"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m15 18-6-6 6-6"></path></svg></button>
|
|
12
|
+
<button class="dk-btn" type="button" aria-label="Next picture" $disabled="!state.nextId" @click="go(state.nextId)"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 18 6-6-6-6"></path></svg></button>
|
|
13
|
+
<button class="dk-btn pri" type="button" $show="state.needsId" @click="go(state.needsId)">{{ state.needsLabel }}</button>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<div class="st-body">
|
|
17
|
+
<div class="st-crops" role="group" aria-label="Crops">
|
|
18
|
+
<span class="dk-lbl">Crops · follow the focal point</span>
|
|
19
|
+
<button class="cbtn" type="button" $for="crop in state.crops" $key="crop.name" $aria-pressed="crop.name === state.crop" @click="showCrop(crop.name)">
|
|
20
|
+
<span class="cfr" $style="crop.style"></span>
|
|
21
|
+
<span class="cmeta">
|
|
22
|
+
<span>{{ crop.label }}</span>
|
|
23
|
+
<span class="q" $show="crop.quality" $class="{ 'is-soft': crop.soft }" $title="crop.qualityTitle">{{ crop.quality }}</span>
|
|
24
|
+
</span>
|
|
25
|
+
<small>{{ crop.size }}</small>
|
|
26
|
+
</button>
|
|
27
|
+
<div class="crop-acts" $show="state.cropActs">
|
|
28
|
+
<button class="dk-btn" type="button" @click="adjustCrop">Adjust by hand…</button>
|
|
29
|
+
<button class="dk-btn" type="button" $show="state.cropStored" @click="resetCrop">{{ state.cropResetLabel }}</button>
|
|
30
|
+
</div>
|
|
31
|
+
<button class="dk-btn add-crop" type="button" $show="!state.readOnly && !state.binned" @click="customCrop">+ Custom crop</button>
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
<div class="st-mid">
|
|
35
|
+
<div class="tools" role="toolbar" aria-label="Picture tools">
|
|
36
|
+
<button class="tool" type="button" $aria-pressed="state.mode === 'studio'" @click="setMode('studio')">Studio</button>
|
|
37
|
+
<button class="tool" type="button" $aria-pressed="state.mode === 'pages'" @click="setMode('pages')">On its pages</button>
|
|
38
|
+
<span class="sep" aria-hidden="true"></span>
|
|
39
|
+
<button class="tool" type="button" $aria-pressed="state.overlay === 'thirds'" @click="toggleOverlay('thirds')">Thirds</button>
|
|
40
|
+
<button class="tool" type="button" $aria-pressed="state.overlay === 'headline'" @click="toggleOverlay('headline')">Headline area</button>
|
|
41
|
+
<button class="tool" type="button" $aria-pressed="state.overlay === 'safe'" @click="toggleOverlay('safe')">Social safe zone</button>
|
|
42
|
+
<span class="sep" aria-hidden="true"></span>
|
|
43
|
+
<button class="tool" type="button" $aria-pressed="!state.zoomed" @click="setZoom(false)">Fit</button>
|
|
44
|
+
<button class="tool" type="button" $aria-pressed="state.zoomed" $disabled="!state.canZoom" @click="setZoom(true)">100%</button>
|
|
45
|
+
<span class="focal-text">{{ state.focalText }}</span>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<div class="stage-wrap" $ref="stageWrap" $class="{ 'is-small': state.mode === 'pages' }">
|
|
49
|
+
<div class="stage" tabindex="0" role="group" $aria-label="state.stageAria" $style="state.stageStyle" $ref="stage" @click="clickFocal" @keydown="keyFocal">
|
|
50
|
+
<span class="ov-g v1" $show="state.overlay === 'thirds'"></span>
|
|
51
|
+
<span class="ov-g v2" $show="state.overlay === 'thirds'"></span>
|
|
52
|
+
<span class="ov-g h1" $show="state.overlay === 'thirds'"></span>
|
|
53
|
+
<span class="ov-g h2" $show="state.overlay === 'thirds'"></span>
|
|
54
|
+
<span class="ov-zone" $show="state.overlay === 'headline'" $style="state.headlineStyle">Headline sits here on heroes · {{ state.headlineVerdict }}</span>
|
|
55
|
+
<span class="ov-zone safe" $show="state.overlay === 'safe'" $style="state.safeStyle">Social apps may cover the edges outside this line</span>
|
|
56
|
+
<span class="box" $show="state.boxStyle" $style="state.boxStyle"><span class="rd">{{ state.boxSize }}</span></span>
|
|
57
|
+
<span class="focal" $show="state.showFocal" $style="state.focalStyle"></span>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
<span class="hint">{{ state.hint }} <button class="link" type="button" $show="state.focalSet && state.canFocal" @click="clearFocal">Use the centre</button></span>
|
|
62
|
+
|
|
63
|
+
<div class="pages" $show="state.mode === 'pages'">
|
|
64
|
+
<span class="dk-lbl">{{ state.pagesTitle }}</span>
|
|
65
|
+
<div class="page-grid">
|
|
66
|
+
<figure class="page" $for="page in state.pages" $key="page.key">
|
|
67
|
+
<span class="cfr" $style="page.style"></span>
|
|
68
|
+
<figcaption>
|
|
69
|
+
<b>{{ page.title }}</b>
|
|
70
|
+
<span class="small">{{ page.meta }}</span>
|
|
71
|
+
<span class="hears" $class="{ 'is-empty': !page.hears }">{{ page.hears ? 'Screen readers hear: “' + page.hears + '”' : 'Screen readers hear nothing here: it needs words.' }}</span>
|
|
72
|
+
</figcaption>
|
|
73
|
+
</figure>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<div class="cards" $show="state.mode === 'studio'">
|
|
78
|
+
<div class="icard">
|
|
79
|
+
<span class="dk-lbl">Colours</span>
|
|
80
|
+
<div class="sw" $show="state.swatches.length">
|
|
81
|
+
<span $for="one in state.swatches" $key="one.hex" $style="one.style" $title="one.title"></span>
|
|
82
|
+
</div>
|
|
83
|
+
<span class="small" $show="state.colourNote">{{ state.colourNote }}</span>
|
|
84
|
+
<button class="dk-btn small-btn" type="button" $show="state.canEnrich" @click="enrich">Work out colours</button>
|
|
85
|
+
</div>
|
|
86
|
+
<div class="icard">
|
|
87
|
+
<span class="dk-lbl">The file</span>
|
|
88
|
+
<span class="small">{{ state.fileNote }}</span>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
|
|
93
|
+
<div class="st-side">
|
|
94
|
+
<div class="px-callout px-callout-danger" $show="state.binned">
|
|
95
|
+
<b>In the bin.</b> {{ state.binnedNote }}
|
|
96
|
+
<button class="px-btn px-btn-secondary px-btn-sm" type="button" $show="state.canRestore" $disabled="state.busy" @click="restore">Restore</button>
|
|
97
|
+
</div>
|
|
98
|
+
<div class="px-callout" $show="state.readOnly && !state.binned">{{ state.whyReadOnly }}</div>
|
|
99
|
+
|
|
100
|
+
<div class="px-seg" role="radiogroup" aria-label="Which words" $show="state.canView">
|
|
101
|
+
<button type="button" role="radio" $aria-checked="state.words === 'shared'" @click="setWords('shared')">Shared · all sites</button>
|
|
102
|
+
<button type="button" role="radio" $aria-checked="state.words === 'view'" @click="setWords('view')">Just {{ state.viewName }}</button>
|
|
103
|
+
</div>
|
|
104
|
+
<p class="px-hint" $show="state.canView">{{ state.wordsNote }} <button class="link" type="button" $show="state.words === 'view' && state.viewHasWords" @click="dropView">Use the shared words again</button></p>
|
|
105
|
+
|
|
106
|
+
<div class="px-field">
|
|
107
|
+
<label class="px-label" for="studio-alt">Alt text</label>
|
|
108
|
+
<textarea class="px-textarea alt" id="studio-alt" $ref="alt" $placeholder="state.altPlaceholder" $readonly="state.wordsLocked" @input="onAlt" @blur="flush"></textarea>
|
|
109
|
+
<span class="chk" $for="check in state.checks" $key="check.text" $class="{ ok: check.tone === 'ok', warn: check.tone === 'warn' }">{{ check.mark }} {{ check.text }}</span>
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
<div class="px-field">
|
|
113
|
+
<label class="px-label" for="studio-credit">Credit</label>
|
|
114
|
+
<input class="px-input" id="studio-credit" type="text" $ref="credit" $placeholder="state.creditPlaceholder" $readonly="state.wordsLocked" @input="onCredit" @blur="flush" />
|
|
115
|
+
</div>
|
|
116
|
+
|
|
117
|
+
<div class="labels">
|
|
118
|
+
<span class="px-label">Labels</span>
|
|
119
|
+
<div class="px-row chips">
|
|
120
|
+
<span class="px-chip" $for="chip in state.labelChips" $key="chip.term" $class="{ 'is-internal': chip.internal }" $title="chip.title">
|
|
121
|
+
{{ chip.term }}
|
|
122
|
+
<button type="button" $show="!state.readOnly" $aria-label="chip.audienceLabel" $aria-pressed="chip.internal" @click="toggleAudience(chip)"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" aria-hidden="true"><rect x="4" y="11" width="16" height="10" rx="2"></rect><path d="M8 11V7a4 4 0 0 1 8 0v4"></path></svg></button>
|
|
123
|
+
<button type="button" $show="!state.readOnly" $aria-label="'Remove ' + chip.term" @click="removeLabel(chip)"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" aria-hidden="true"><path d="M18 6 6 18M6 6l12 12"></path></svg></button>
|
|
124
|
+
</span>
|
|
125
|
+
<span class="px-chip is-suggested" $for="chip in state.suggested" $key="chip.term" $title="chip.title">
|
|
126
|
+
{{ chip.term }}
|
|
127
|
+
<button type="button" $show="!state.readOnly" $aria-label="'Accept ' + chip.term" @click="acceptLabel(chip)"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 6 9 17l-5-5"></path></svg></button>
|
|
128
|
+
<button type="button" $show="!state.readOnly" $aria-label="'Reject ' + chip.term" @click="rejectLabel(chip)"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" aria-hidden="true"><path d="M18 6 6 18M6 6l12 12"></path></svg></button>
|
|
129
|
+
</span>
|
|
130
|
+
<span class="px-subtle" $show="!state.labelChips.length && !state.suggested.length && state.readOnly">None</span>
|
|
131
|
+
</div>
|
|
132
|
+
<input class="px-input" type="text" aria-label="Add a label" placeholder="Add a label, then Enter" $show="!state.readOnly" $ref="labelInput" @keydown="labelKey" />
|
|
133
|
+
<span class="px-hint" $show="state.suggested.length">Suggested labels are not applied until you accept them.</span>
|
|
134
|
+
<span class="px-hint" $show="state.hasInternal">A dashed label is internal: only staff see it.</span>
|
|
135
|
+
</div>
|
|
136
|
+
|
|
137
|
+
<div class="used" $show="state.usageKnown">
|
|
138
|
+
<span class="px-label">Used on</span>
|
|
139
|
+
<span class="px-subtle" $show="!state.uses.length">Not used on any page.</span>
|
|
140
|
+
<a class="use" $for="use in state.uses" $key="use.key" $href="use.url || null" target="_blank" rel="noopener">
|
|
141
|
+
<span class="cfr" $style="use.style"></span>
|
|
142
|
+
<span><b>{{ use.title }}</b><br /><span class="px-subtle">{{ use.meta }}</span></span>
|
|
143
|
+
</a>
|
|
144
|
+
</div>
|
|
145
|
+
|
|
146
|
+
<div class="groups" $show="state.groups.length">
|
|
147
|
+
<span class="px-label">Groups</span>
|
|
148
|
+
<div class="px-row chips">
|
|
149
|
+
<span class="px-badge" $for="one in state.groups" $key="one.name" $class="{ 'px-badge-accent': one.mine, 'px-badge-neutral': !one.mine }">{{ one.text }}</span>
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
|
|
153
|
+
<div class="px-row foot">
|
|
154
|
+
<button class="px-btn px-btn-ghost px-btn-sm" type="button" $show="!state.binned" @click="copyLink">{{ state.copyLabel }}</button>
|
|
155
|
+
<button class="px-btn px-btn-ghost px-btn-sm" type="button" $show="!state.binned" @click="getLink">Get a link or file…</button>
|
|
156
|
+
<button class="px-btn px-btn-danger-quiet px-btn-sm bin" type="button" $show="state.canBin" @click="askToBin">Move to bin…</button>
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
</div>
|
|
160
|
+
|
|
161
|
+
<div class="film" $ref="film" $aria-label="'Pictures shown, ' + state.position" $show="state.film.length > 1">
|
|
162
|
+
<button type="button" $for="one in state.film" $key="one.id" $aria-current="one.id === state.id ? 'true' : null" $aria-label="one.label" @click="go(one.id)">
|
|
163
|
+
<img $src="one.thumb" alt="" loading="lazy" />
|
|
164
|
+
<i $show="one.noAlt"></i>
|
|
165
|
+
</button>
|
|
166
|
+
</div>
|
|
167
|
+
|
|
168
|
+
<CropEditor />
|
|
169
|
+
<BinDialog />
|
|
170
|
+
</div>
|
|
171
|
+
</view>
|
|
172
|
+
|
|
173
|
+
<logic lang="ts">
|
|
174
|
+
import { reactive, onMounted, onUnmounted, shared, defineRefs } from '@lightspeed-js/core'
|
|
175
|
+
import { presetRect } from '@pseudolux-ui/client'
|
|
176
|
+
import {
|
|
177
|
+
getLibrary,
|
|
178
|
+
thumbnailUrl,
|
|
179
|
+
previewUrl,
|
|
180
|
+
cannotChange,
|
|
181
|
+
canWrite,
|
|
182
|
+
canDescribeView,
|
|
183
|
+
SELECTED,
|
|
184
|
+
CHANGED,
|
|
185
|
+
VIEW,
|
|
186
|
+
PRESETS,
|
|
187
|
+
PATCHED,
|
|
188
|
+
SET,
|
|
189
|
+
CROP_EDITOR,
|
|
190
|
+
BIN_DIALOG,
|
|
191
|
+
LINK,
|
|
192
|
+
} from '../config.ts'
|
|
193
|
+
import { pixelsFor } from '../ladder.ts'
|
|
194
|
+
import { cutStyle } from '../cuts.ts'
|
|
195
|
+
import { altChecks, completeness, textOver } from '../checks.ts'
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* One picture, with room to work: every crop down the left, the picture and
|
|
199
|
+
* its focal point in the middle, its words on the right. Opens over the
|
|
200
|
+
* library whenever a picture is chosen for editing, and steps through the
|
|
201
|
+
* pictures the wall is showing.
|
|
202
|
+
*
|
|
203
|
+
* Everything saves as it is changed. There is no Save button to forget.
|
|
204
|
+
*/
|
|
205
|
+
const refs = defineRefs()
|
|
206
|
+
|
|
207
|
+
const SAVE_AFTER = 700
|
|
208
|
+
const FILM_EITHER_SIDE = 14
|
|
209
|
+
const FOCAL_STEP = 2
|
|
210
|
+
const FOCAL_LEAP = 10
|
|
211
|
+
|
|
212
|
+
const state = reactive({
|
|
213
|
+
open: false,
|
|
214
|
+
id: '',
|
|
215
|
+
label: '',
|
|
216
|
+
position: '',
|
|
217
|
+
status: '',
|
|
218
|
+
saveFailed: false,
|
|
219
|
+
busy: false,
|
|
220
|
+
ringText: '',
|
|
221
|
+
ringLabel: '',
|
|
222
|
+
ringTitle: '',
|
|
223
|
+
ringStyle: '',
|
|
224
|
+
prevId: '',
|
|
225
|
+
nextId: '',
|
|
226
|
+
needsId: '',
|
|
227
|
+
needsLabel: '',
|
|
228
|
+
film: [],
|
|
229
|
+
|
|
230
|
+
crops: [],
|
|
231
|
+
crop: 'original',
|
|
232
|
+
cropActs: false,
|
|
233
|
+
cropStored: false,
|
|
234
|
+
cropResetLabel: 'Use the default',
|
|
235
|
+
|
|
236
|
+
overlay: '',
|
|
237
|
+
mode: 'studio',
|
|
238
|
+
pages: [],
|
|
239
|
+
pagesTitle: '',
|
|
240
|
+
zoomed: false,
|
|
241
|
+
canZoom: false,
|
|
242
|
+
stageStyle: '',
|
|
243
|
+
stageAria: '',
|
|
244
|
+
headlineStyle: '',
|
|
245
|
+
headlineVerdict: '',
|
|
246
|
+
safeStyle: '',
|
|
247
|
+
boxStyle: '',
|
|
248
|
+
boxSize: '',
|
|
249
|
+
showFocal: false,
|
|
250
|
+
focalStyle: '',
|
|
251
|
+
focalText: '',
|
|
252
|
+
focalSet: false,
|
|
253
|
+
canFocal: false,
|
|
254
|
+
hint: '',
|
|
255
|
+
|
|
256
|
+
swatches: [],
|
|
257
|
+
colourNote: '',
|
|
258
|
+
canEnrich: false,
|
|
259
|
+
fileNote: '',
|
|
260
|
+
|
|
261
|
+
binned: false,
|
|
262
|
+
binnedNote: '',
|
|
263
|
+
canRestore: false,
|
|
264
|
+
readOnly: true,
|
|
265
|
+
whyReadOnly: '',
|
|
266
|
+
canBin: false,
|
|
267
|
+
|
|
268
|
+
canView: false,
|
|
269
|
+
viewName: '',
|
|
270
|
+
words: 'shared',
|
|
271
|
+
wordsNote: '',
|
|
272
|
+
wordsLocked: true,
|
|
273
|
+
viewHasWords: false,
|
|
274
|
+
altPlaceholder: 'What is in this picture?',
|
|
275
|
+
creditPlaceholder: 'Who to credit',
|
|
276
|
+
checks: [],
|
|
277
|
+
|
|
278
|
+
labelChips: [],
|
|
279
|
+
suggested: [],
|
|
280
|
+
hasInternal: false,
|
|
281
|
+
|
|
282
|
+
usageKnown: false,
|
|
283
|
+
uses: [],
|
|
284
|
+
groups: [],
|
|
285
|
+
copyLabel: 'Copy link',
|
|
286
|
+
})
|
|
287
|
+
|
|
288
|
+
const selected = shared(SELECTED)
|
|
289
|
+
const changed = shared(CHANGED)
|
|
290
|
+
const view = shared(VIEW)
|
|
291
|
+
const presets = shared(PRESETS)
|
|
292
|
+
const patched = shared(PATCHED)
|
|
293
|
+
const set = shared(SET)
|
|
294
|
+
const cropEditor = shared(CROP_EDITOR)
|
|
295
|
+
const binDialog = shared(BIN_DIALOG)
|
|
296
|
+
const link = shared(LINK)
|
|
297
|
+
|
|
298
|
+
const plural = (n, one, many) => n + ' ' + (n === 1 ? one : many)
|
|
299
|
+
const clamp = (value, low, high) => Math.max(low, Math.min(high, value))
|
|
300
|
+
const tidy = (value) => String(Math.round(value * 100) / 100)
|
|
301
|
+
|
|
302
|
+
// The record as the store has it, and the words as typed but not yet saved.
|
|
303
|
+
let current = null
|
|
304
|
+
let draft = { alt: '', credit: '' }
|
|
305
|
+
let focal = { x: 50, y: 50 }
|
|
306
|
+
let labels = []
|
|
307
|
+
let rejected = []
|
|
308
|
+
let placements = []
|
|
309
|
+
let generation = 0
|
|
310
|
+
let opener = null
|
|
311
|
+
|
|
312
|
+
const viewKey = () => (state.viewName ? state.viewName.trim().toLowerCase() : '')
|
|
313
|
+
const ownView = () => (current && current.views && current.views[viewKey()]) || null
|
|
314
|
+
const presetsNow = () => presets.value || []
|
|
315
|
+
|
|
316
|
+
function croppable() {
|
|
317
|
+
return {
|
|
318
|
+
dimensions: { width: current.width || 0, height: current.height || 0 },
|
|
319
|
+
...(state.focalSet ? { focal: { ...focal } } : {}),
|
|
320
|
+
crops: current.crops || {},
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// --- opening, and moving between pictures --------------------------------------------
|
|
325
|
+
|
|
326
|
+
function start(summary) {
|
|
327
|
+
const mine = ++generation
|
|
328
|
+
current = JSON.parse(JSON.stringify(summary))
|
|
329
|
+
rejected = []
|
|
330
|
+
placements = []
|
|
331
|
+
state.id = current.id
|
|
332
|
+
state.crop = 'original'
|
|
333
|
+
state.zoomed = false
|
|
334
|
+
state.status = ''
|
|
335
|
+
state.saveFailed = false
|
|
336
|
+
state.copyLabel = 'Copy link'
|
|
337
|
+
state.usageKnown = false
|
|
338
|
+
state.uses = []
|
|
339
|
+
state.viewName = view.value || ''
|
|
340
|
+
state.words = ownView() && (ownView().altText !== undefined || ownView().credit !== undefined) ? 'view' : 'shared'
|
|
341
|
+
adopt()
|
|
342
|
+
writeFields()
|
|
343
|
+
describeSet()
|
|
344
|
+
|
|
345
|
+
if (!state.open) {
|
|
346
|
+
opener = document.activeElement
|
|
347
|
+
state.open = true
|
|
348
|
+
document.documentElement.style.overflow = 'hidden'
|
|
349
|
+
requestAnimationFrame(() => refs.back && refs.back.focus())
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// The row the wall had is enough to start on; the detail fills in the rest.
|
|
353
|
+
getLibrary().detail(current.id).then((detail) => {
|
|
354
|
+
if (mine !== generation) return
|
|
355
|
+
const typing = dirty.alt || dirty.credit
|
|
356
|
+
current = { ...current, ...detail }
|
|
357
|
+
adopt()
|
|
358
|
+
if (!typing) writeFields()
|
|
359
|
+
}).catch(() => {})
|
|
360
|
+
loadUsage(current.id, mine)
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/** What the record says, taken into the editor's working copies. */
|
|
364
|
+
function adopt() {
|
|
365
|
+
state.label = current.filename || current.id
|
|
366
|
+
state.binned = Boolean(current.deletedAt)
|
|
367
|
+
state.binnedNote = (current.deletedReason ? '“' + current.deletedReason + '”. ' : '') + 'It is hidden from pickers and no longer served.'
|
|
368
|
+
const why = cannotChange(current.tags)
|
|
369
|
+
state.readOnly = Boolean(why) || state.binned
|
|
370
|
+
state.whyReadOnly = why
|
|
371
|
+
state.canBin = !why && !state.binned
|
|
372
|
+
state.canRestore = !why && state.binned
|
|
373
|
+
state.canView = Boolean(state.viewName) && canDescribeView(state.viewName) && !state.readOnly
|
|
374
|
+
if (!state.canView) state.words = 'shared'
|
|
375
|
+
if (!dirty.focal) {
|
|
376
|
+
state.focalSet = Boolean(current.focal)
|
|
377
|
+
focal = current.focal ? { x: current.focal.x, y: current.focal.y } : { x: 50, y: 50 }
|
|
378
|
+
}
|
|
379
|
+
if (!dirty.labels) labels = personLabelsOf(current.labels)
|
|
380
|
+
state.groups = (current.tags || []).map((name) => {
|
|
381
|
+
const mine = !cannotChange([name])
|
|
382
|
+
return { name, mine, text: name + (canWrite() ? (mine ? ' · you can change' : ' · you can see') : '') }
|
|
383
|
+
})
|
|
384
|
+
state.fileNote = [
|
|
385
|
+
current.width && current.height ? current.width + ' × ' + current.height + ' px' : '',
|
|
386
|
+
current.format ? String(current.format).toUpperCase() : '',
|
|
387
|
+
current.createdAt ? 'added ' + new Date(current.createdAt).toLocaleDateString(undefined, { day: 'numeric', month: 'short', year: 'numeric' }) : '',
|
|
388
|
+
].filter(Boolean).join(' · ')
|
|
389
|
+
describeWords()
|
|
390
|
+
drawLabels()
|
|
391
|
+
drawColours()
|
|
392
|
+
draw()
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
function describeSet() {
|
|
396
|
+
const items = (set.value && set.value.items) || []
|
|
397
|
+
const at = items.findIndex((one) => one.id === state.id)
|
|
398
|
+
state.position = at >= 0 ? at + 1 + ' of ' + items.length + ' shown' : ''
|
|
399
|
+
state.prevId = at > 0 ? items[at - 1].id : ''
|
|
400
|
+
state.nextId = at >= 0 && at < items.length - 1 ? items[at + 1].id : ''
|
|
401
|
+
const needing = items.filter((one) => one.noAlt && one.id !== state.id)
|
|
402
|
+
const after = at >= 0 ? items.slice(at + 1).find((one) => one.noAlt) : null
|
|
403
|
+
const target = after || needing[0]
|
|
404
|
+
state.needsId = target ? target.id : ''
|
|
405
|
+
state.needsLabel = 'Next that needs words · ' + needing.length
|
|
406
|
+
const from = Math.max(0, (at < 0 ? 0 : at) - FILM_EITHER_SIDE)
|
|
407
|
+
state.film = items.slice(from, from + FILM_EITHER_SIDE * 2 + 1).map((one) => ({
|
|
408
|
+
id: one.id,
|
|
409
|
+
label: one.label + (one.noAlt ? ', needs words' : ''),
|
|
410
|
+
noAlt: one.noAlt,
|
|
411
|
+
thumb: thumbnailUrl(one.id),
|
|
412
|
+
}))
|
|
413
|
+
requestAnimationFrame(() => {
|
|
414
|
+
const here = refs.film && refs.film.querySelector('[aria-current="true"]')
|
|
415
|
+
if (here && refs.film) refs.film.scrollLeft = here.offsetLeft - (refs.film.clientWidth - here.offsetWidth) / 2
|
|
416
|
+
})
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
async function go(id) {
|
|
420
|
+
if (!id || id === state.id) return
|
|
421
|
+
await flush()
|
|
422
|
+
const item = ((set.value && set.value.items) || []).find((one) => one.id === id)
|
|
423
|
+
selected.value = { id, ...(item && item.record ? item.record : {}) }
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
async function close() {
|
|
427
|
+
await flush()
|
|
428
|
+
selected.value = null
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
function shut() {
|
|
432
|
+
generation++
|
|
433
|
+
state.open = false
|
|
434
|
+
state.id = ''
|
|
435
|
+
current = null
|
|
436
|
+
if (cropEditor.value) cropEditor.value = null
|
|
437
|
+
if (binDialog.value) binDialog.value = null
|
|
438
|
+
document.documentElement.style.overflow = ''
|
|
439
|
+
if (opener && document.contains(opener) && opener.focus) opener.focus()
|
|
440
|
+
opener = null
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
// --- the words ----------------------------------------------------------------------
|
|
444
|
+
|
|
445
|
+
function describeWords() {
|
|
446
|
+
const mine = ownView()
|
|
447
|
+
state.viewHasWords = Boolean(mine && (mine.altText !== undefined || mine.credit !== undefined))
|
|
448
|
+
state.wordsLocked = state.readOnly
|
|
449
|
+
state.wordsNote = state.words === 'view'
|
|
450
|
+
? 'These words show only where ' + state.viewName + ' uses the picture.'
|
|
451
|
+
: 'Changes here show on every site that uses this picture.'
|
|
452
|
+
state.altPlaceholder = state.words === 'view' && current.altText ? 'Shared: ' + current.altText : 'What is in this picture?'
|
|
453
|
+
state.creditPlaceholder = state.words === 'view' && current.credit ? 'Shared: ' + current.credit : 'Who to credit'
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
function storedWords() {
|
|
457
|
+
if (state.words === 'view') {
|
|
458
|
+
const mine = ownView() || {}
|
|
459
|
+
return { alt: mine.altText || '', credit: mine.credit || '' }
|
|
460
|
+
}
|
|
461
|
+
return { alt: current.altText || '', credit: current.credit || '' }
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/** Written into the boxes themselves: a box keeps what was typed into it
|
|
465
|
+
* over whatever a new render says its value is. */
|
|
466
|
+
function writeFields() {
|
|
467
|
+
draft = storedWords()
|
|
468
|
+
dirty.alt = false
|
|
469
|
+
dirty.credit = false
|
|
470
|
+
if (refs.alt) refs.alt.value = draft.alt
|
|
471
|
+
if (refs.credit) refs.credit.value = draft.credit
|
|
472
|
+
drawChecks()
|
|
473
|
+
drawRing()
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
function drawChecks() {
|
|
477
|
+
state.checks = state.binned ? [] : altChecks(draft.alt).map((one) => ({ ...one, mark: one.tone === 'ok' ? '✓' : '!' }))
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
function drawRing() {
|
|
481
|
+
const shared = state.words === 'shared'
|
|
482
|
+
const score = completeness({
|
|
483
|
+
altText: shared ? draft.alt : current.altText,
|
|
484
|
+
credit: shared ? draft.credit : current.credit,
|
|
485
|
+
labels,
|
|
486
|
+
focal: state.focalSet ? focal : undefined,
|
|
487
|
+
})
|
|
488
|
+
state.ringText = score.done + '/' + score.of
|
|
489
|
+
state.ringLabel = score.done + ' of ' + score.of + ' done'
|
|
490
|
+
state.ringTitle = score.missing.length ? 'Still to do: ' + score.missing.join(', ') : 'Alt text, credit, labels and focal point are all done'
|
|
491
|
+
state.ringStyle = '--p: ' + Math.round((score.done / score.of) * 100)
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
async function setWords(which) {
|
|
495
|
+
if (which === state.words) return
|
|
496
|
+
await flush()
|
|
497
|
+
state.words = which
|
|
498
|
+
describeWords()
|
|
499
|
+
writeFields()
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
async function dropView() {
|
|
503
|
+
if (!state.viewHasWords) return
|
|
504
|
+
const id = state.id
|
|
505
|
+
const name = state.viewName
|
|
506
|
+
saving('Saving…')
|
|
507
|
+
try {
|
|
508
|
+
await getLibrary().removeView(id, name)
|
|
509
|
+
if (state.id !== id) return
|
|
510
|
+
const views = { ...current.views }
|
|
511
|
+
delete views[viewKey()]
|
|
512
|
+
current.views = views
|
|
513
|
+
patched.value = { id, replace: { views } }
|
|
514
|
+
state.words = 'shared'
|
|
515
|
+
describeWords()
|
|
516
|
+
writeFields()
|
|
517
|
+
saving('✓ Saved')
|
|
518
|
+
} catch (err) {
|
|
519
|
+
failed(err)
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
// --- saving as things change ------------------------------------------------------------
|
|
524
|
+
|
|
525
|
+
const dirty = { alt: false, credit: false, focal: false, labels: false }
|
|
526
|
+
let timer = null
|
|
527
|
+
let inFlight = Promise.resolve()
|
|
528
|
+
|
|
529
|
+
function saving(text) {
|
|
530
|
+
state.status = text
|
|
531
|
+
state.saveFailed = false
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
function failed(err) {
|
|
535
|
+
state.status = "Couldn't save: " + (err && err.message ? err.message : 'no answer from the library')
|
|
536
|
+
state.saveFailed = true
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
function touch(field) {
|
|
540
|
+
dirty[field] = true
|
|
541
|
+
if (timer) clearTimeout(timer)
|
|
542
|
+
timer = setTimeout(flush, SAVE_AFTER)
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
function onAlt(event) {
|
|
546
|
+
draft.alt = event.target.value
|
|
547
|
+
drawChecks()
|
|
548
|
+
drawRing()
|
|
549
|
+
if (state.mode === 'pages') drawPages()
|
|
550
|
+
touch('alt')
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
function onCredit(event) {
|
|
554
|
+
draft.credit = event.target.value
|
|
555
|
+
drawRing()
|
|
556
|
+
touch('credit')
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
/** Everything changed since the last save, sent one after another so a late
|
|
560
|
+
* answer never overwrites a newer one. */
|
|
561
|
+
function flush() {
|
|
562
|
+
if (timer) clearTimeout(timer)
|
|
563
|
+
timer = null
|
|
564
|
+
if (!current || state.readOnly || !(dirty.alt || dirty.credit || dirty.focal || dirty.labels)) return inFlight
|
|
565
|
+
const id = current.id
|
|
566
|
+
const record = current
|
|
567
|
+
const inView = state.words === 'view'
|
|
568
|
+
const name = state.viewName
|
|
569
|
+
const key = viewKey()
|
|
570
|
+
const words = {}
|
|
571
|
+
if (dirty.alt) words.altText = draft.alt.trim() || null
|
|
572
|
+
if (dirty.credit) words.credit = draft.credit.trim() || null
|
|
573
|
+
const rest = {}
|
|
574
|
+
if (dirty.focal) rest.focal = state.focalSet ? { x: focal.x, y: focal.y } : null
|
|
575
|
+
if (dirty.labels) rest.labels = labels.map((one) => ({ term: one.term, audience: one.audience }))
|
|
576
|
+
dirty.alt = dirty.credit = dirty.focal = dirty.labels = false
|
|
577
|
+
|
|
578
|
+
saving('Saving…')
|
|
579
|
+
inFlight = inFlight.then(async () => {
|
|
580
|
+
try {
|
|
581
|
+
const port = getLibrary()
|
|
582
|
+
const hasWords = Object.keys(words).length > 0
|
|
583
|
+
const hasRest = Object.keys(rest).length > 0
|
|
584
|
+
const patch = {}
|
|
585
|
+
if (inView) {
|
|
586
|
+
// A group's own words go to its view; the focal point and labels
|
|
587
|
+
// belong to the picture.
|
|
588
|
+
if (hasWords) await port.describe(id, words, { view: name })
|
|
589
|
+
if (hasRest) await port.describe(id, rest)
|
|
590
|
+
if (hasWords) {
|
|
591
|
+
const mine = { ...(record.views && record.views[key]) }
|
|
592
|
+
for (const field of Object.keys(words)) {
|
|
593
|
+
if (words[field] === null) delete mine[field]
|
|
594
|
+
else mine[field] = words[field]
|
|
595
|
+
}
|
|
596
|
+
record.views = { ...record.views, [key]: mine }
|
|
597
|
+
patch.views = record.views
|
|
598
|
+
}
|
|
599
|
+
} else if (hasWords || hasRest) {
|
|
600
|
+
await port.describe(id, { ...words, ...rest })
|
|
601
|
+
for (const field of Object.keys(words)) {
|
|
602
|
+
if (words[field] === null) delete record[field]
|
|
603
|
+
else record[field] = words[field]
|
|
604
|
+
patch[field] = words[field] === null ? undefined : words[field]
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
if ('focal' in rest) {
|
|
608
|
+
if (rest.focal) record.focal = rest.focal
|
|
609
|
+
else delete record.focal
|
|
610
|
+
patch.focal = rest.focal || undefined
|
|
611
|
+
}
|
|
612
|
+
if ('labels' in rest) {
|
|
613
|
+
const others = (record.labels || []).filter((one) => one.source && one.source.kind !== 'person')
|
|
614
|
+
record.labels = rest.labels.concat(others)
|
|
615
|
+
patch.labels = record.labels
|
|
616
|
+
}
|
|
617
|
+
patched.value = { id, replace: patch }
|
|
618
|
+
if (state.id === id) {
|
|
619
|
+
saving('✓ Saved')
|
|
620
|
+
describeWords()
|
|
621
|
+
describeSet()
|
|
622
|
+
}
|
|
623
|
+
} catch (err) {
|
|
624
|
+
if (state.id === id) failed(err)
|
|
625
|
+
}
|
|
626
|
+
})
|
|
627
|
+
return inFlight
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
// --- labels ---------------------------------------------------------------------------
|
|
631
|
+
|
|
632
|
+
function personLabelsOf(list) {
|
|
633
|
+
return (list || [])
|
|
634
|
+
.filter((one) => (!one.source || one.source.kind === 'person') && one.status !== 'rejected')
|
|
635
|
+
.map((one) => ({ term: one.term, audience: one.audience === 'internal' ? 'internal' : 'public' }))
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
function drawLabels() {
|
|
639
|
+
state.labelChips = labels.map((one) => ({
|
|
640
|
+
term: one.term,
|
|
641
|
+
internal: one.audience === 'internal',
|
|
642
|
+
audienceLabel: one.audience === 'internal' ? 'Make ' + one.term + ' public' : 'Make ' + one.term + ' internal',
|
|
643
|
+
title: one.audience === 'internal' ? 'Internal: only staff see this' : '',
|
|
644
|
+
}))
|
|
645
|
+
state.hasInternal = labels.some((one) => one.audience === 'internal')
|
|
646
|
+
state.suggested = ((current && current.labels) || [])
|
|
647
|
+
.filter((one) => one.source && one.source.kind !== 'person' && (one.status === 'generated' || one.status === 'pending'))
|
|
648
|
+
.filter((one) => !rejected.includes(one.term) && !labels.some((have) => have.term === one.term))
|
|
649
|
+
.map((one) => ({
|
|
650
|
+
term: one.term,
|
|
651
|
+
title: 'Suggested by ' + (one.source.model || one.source.connector || 'a model') + (typeof one.score === 'number' ? ', ' + Math.round(one.score * 100) + '% sure' : ''),
|
|
652
|
+
}))
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
function changeLabels(next) {
|
|
656
|
+
labels = next
|
|
657
|
+
drawLabels()
|
|
658
|
+
drawRing()
|
|
659
|
+
touch('labels')
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
function addLabel(word) {
|
|
663
|
+
const term = String(word || '').trim().toLowerCase().replace(/\s+/g, ' ')
|
|
664
|
+
if (!term || term.length > 50 || labels.length >= 100 || labels.some((one) => one.term === term)) return
|
|
665
|
+
changeLabels(labels.concat([{ term, audience: 'public' }]))
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
function labelKey(event) {
|
|
669
|
+
if (event.key !== 'Enter' && event.key !== ',') return
|
|
670
|
+
event.preventDefault()
|
|
671
|
+
const input = refs.labelInput
|
|
672
|
+
if (!input) return
|
|
673
|
+
for (const part of input.value.split(',')) addLabel(part)
|
|
674
|
+
input.value = ''
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
function removeLabel(chip) {
|
|
678
|
+
changeLabels(labels.filter((one) => one.term !== chip.term))
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
function toggleAudience(chip) {
|
|
682
|
+
changeLabels(labels.map((one) => (one.term === chip.term ? { ...one, audience: one.audience === 'internal' ? 'public' : 'internal' } : one)))
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
function acceptLabel(chip) {
|
|
686
|
+
addLabel(chip.term)
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
// Dismissed while this picture is open. The store has no way yet to be told
|
|
690
|
+
// a model's word was wrong.
|
|
691
|
+
function rejectLabel(chip) {
|
|
692
|
+
rejected = rejected.concat([chip.term])
|
|
693
|
+
drawLabels()
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
// --- the picture, its focal point and its crops ---------------------------------------
|
|
697
|
+
|
|
698
|
+
function cropList() {
|
|
699
|
+
if (!current || !current.width || !current.height) return []
|
|
700
|
+
const picture = croppable()
|
|
701
|
+
const list = [{ name: 'original', label: 'Original', rect: { x: 0, y: 0, width: current.width, height: current.height }, stored: false, preset: null }]
|
|
702
|
+
for (const preset of presetsNow()) {
|
|
703
|
+
const stored = picture.crops[preset.name]
|
|
704
|
+
list.push({ name: preset.name, label: preset.label + ' ' + preset.ratioLabel, rect: stored || presetRect(picture, preset), stored: Boolean(stored), preset })
|
|
705
|
+
}
|
|
706
|
+
for (const name of Object.keys(picture.crops)) {
|
|
707
|
+
if (presetsNow().some((preset) => preset.name === name)) continue
|
|
708
|
+
list.push({ name, label: name, rect: picture.crops[name], stored: true, preset: null })
|
|
709
|
+
}
|
|
710
|
+
return list
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
function draw() {
|
|
714
|
+
if (!current) return
|
|
715
|
+
const W = current.width || 0
|
|
716
|
+
const H = current.height || 0
|
|
717
|
+
const url = previewUrl(current.id)
|
|
718
|
+
const list = cropList()
|
|
719
|
+
if (!list.some((one) => one.name === state.crop)) state.crop = 'original'
|
|
720
|
+
|
|
721
|
+
state.crops = list.map((one) => {
|
|
722
|
+
const soft = Boolean(one.preset && one.preset.minWidth && one.rect.width < one.preset.minWidth)
|
|
723
|
+
return {
|
|
724
|
+
name: one.name,
|
|
725
|
+
label: one.label + (one.stored && one.preset ? ' · adjusted' : ''),
|
|
726
|
+
style: cutStyle(one.rect, { width: W, height: H }, url, { height: 100, maxWidth: 180 }),
|
|
727
|
+
size: one.rect.width.toLocaleString() + ' × ' + one.rect.height.toLocaleString() + ' px',
|
|
728
|
+
quality: one.preset && one.preset.minWidth ? (soft ? 'May look soft' : 'Sharp') : '',
|
|
729
|
+
soft,
|
|
730
|
+
qualityTitle: one.preset && one.preset.minWidth
|
|
731
|
+
? soft
|
|
732
|
+
? 'Shown up to ' + one.preset.minWidth.toLocaleString() + ' px wide; this crop is ' + one.rect.width.toLocaleString() + ' px.'
|
|
733
|
+
: 'At least the ' + one.preset.minWidth.toLocaleString() + ' px this shape is shown at.'
|
|
734
|
+
: '',
|
|
735
|
+
}
|
|
736
|
+
})
|
|
737
|
+
|
|
738
|
+
const shown = list.find((one) => one.name === state.crop) || list[0]
|
|
739
|
+
const isOriginal = !shown || shown.name === 'original'
|
|
740
|
+
state.cropActs = !isOriginal && !state.readOnly
|
|
741
|
+
state.cropStored = Boolean(shown && shown.stored)
|
|
742
|
+
state.cropResetLabel = shown && shown.preset ? 'Use the default' : 'Delete this crop'
|
|
743
|
+
state.canFocal = isOriginal && !state.zoomed && !state.readOnly
|
|
744
|
+
state.showFocal = isOriginal && !state.zoomed && (state.focalSet || state.canFocal)
|
|
745
|
+
state.focalStyle = 'left: ' + focal.x + '%; top: ' + focal.y + '%' + (state.focalSet ? '' : '; opacity: .45')
|
|
746
|
+
state.focalText = (state.focalSet ? 'Focal point ' + focal.x + '%, ' + focal.y + '%' : 'No focal point: crops use the centre') + (state.zoomed ? ' · showing 100% around it' : '')
|
|
747
|
+
state.stageAria = state.label + '. ' + (state.focalSet ? 'Focal point ' + focal.x + '% across, ' + focal.y + '% down.' : 'No focal point set.') + (state.canFocal ? ' Click or use the arrow keys to move it.' : '')
|
|
748
|
+
state.hint = state.readOnly
|
|
749
|
+
? ''
|
|
750
|
+
: isOriginal
|
|
751
|
+
? state.zoomed
|
|
752
|
+
? 'Showing the picture at full size. Choose Fit to move the focal point.'
|
|
753
|
+
: 'Click the picture to mark what matters. Every crop on the left follows it unless it has been adjusted by hand.'
|
|
754
|
+
: shown.stored
|
|
755
|
+
? 'This crop was set by hand, so it stays put when the focal point moves.'
|
|
756
|
+
: 'This crop follows the focal point. Choose Original to move it.'
|
|
757
|
+
|
|
758
|
+
// The stage is the picture's own shape, so percentages of the box are
|
|
759
|
+
// percentages of the picture.
|
|
760
|
+
const wrap = refs.stageWrap
|
|
761
|
+
const stageWidth = wrap ? Math.min(wrap.clientWidth, (wrap.clientHeight || 520) * (W / H || 1.5)) : 760
|
|
762
|
+
const big = getLibrary().imageUrl(current.id, { width: pixelsFor(Math.min(W || 2000, 4000), 1), format: 'webp' })
|
|
763
|
+
state.canZoom = W > stageWidth * 1.2
|
|
764
|
+
const zoom = state.zoomed && state.canZoom ? (W / stageWidth) * 100 : 100
|
|
765
|
+
state.stageStyle = [
|
|
766
|
+
'aspect-ratio: ' + (W && H ? W + ' / ' + H : '3 / 2'),
|
|
767
|
+
'width: ' + Math.round(stageWidth) + 'px',
|
|
768
|
+
'background-image: url("' + (state.zoomed ? big : url) + '")',
|
|
769
|
+
'background-size: ' + tidy(zoom) + '% ' + tidy(zoom) + '%',
|
|
770
|
+
'background-position: ' + (state.zoomed ? focal.x + '% ' + focal.y + '%' : '0 0'),
|
|
771
|
+
state.canFocal ? 'cursor: crosshair' : 'cursor: default',
|
|
772
|
+
].join('; ')
|
|
773
|
+
|
|
774
|
+
// Overlays sit on what is being looked at: the crop, or the whole picture.
|
|
775
|
+
const area = isOriginal || !W || !H
|
|
776
|
+
? { left: 0, top: 0, width: 100, height: 100 }
|
|
777
|
+
: { left: (shown.rect.x / W) * 100, top: (shown.rect.y / H) * 100, width: (shown.rect.width / W) * 100, height: (shown.rect.height / H) * 100 }
|
|
778
|
+
state.boxStyle = isOriginal || state.zoomed ? '' : 'left: ' + tidy(area.left) + '%; top: ' + tidy(area.top) + '%; width: ' + tidy(area.width) + '%; height: ' + tidy(area.height) + '%'
|
|
779
|
+
state.boxSize = shown ? shown.rect.width.toLocaleString() + ' × ' + shown.rect.height.toLocaleString() + ' px' : ''
|
|
780
|
+
const zone = {
|
|
781
|
+
left: area.left + area.width * 0.04,
|
|
782
|
+
top: area.top + area.height * 0.62,
|
|
783
|
+
width: area.width * 0.52,
|
|
784
|
+
height: area.height * 0.3,
|
|
785
|
+
}
|
|
786
|
+
state.headlineStyle = 'left: ' + tidy(zone.left) + '%; top: ' + tidy(zone.top) + '%; width: ' + tidy(zone.width) + '%; height: ' + tidy(zone.height) + '%'
|
|
787
|
+
const under = state.focalSet && focal.x >= zone.left && focal.x <= zone.left + zone.width && focal.y >= zone.top && focal.y <= zone.top + zone.height
|
|
788
|
+
state.headlineVerdict = !state.focalSet ? 'set a focal point to check it' : under ? 'the subject is under the headline' : 'clear of the subject'
|
|
789
|
+
const inset = 3.5
|
|
790
|
+
state.safeStyle = 'left: ' + tidy(area.left) + '%; top: ' + tidy(area.top + (area.height * inset) / 100) + '%; width: ' + tidy(area.width) + '%; height: ' + tidy(area.height * (1 - (2 * inset) / 100)) + '%'
|
|
791
|
+
if (state.mode === 'pages') drawPages()
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* The picture as each page shows it: the crop that page uses, and the words
|
|
796
|
+
* a screen reader says there. Moving the focal point reframes every one that
|
|
797
|
+
* follows it. With no page using it yet, each standard shape stands in.
|
|
798
|
+
*/
|
|
799
|
+
function drawPages() {
|
|
800
|
+
if (!current || !current.width || !current.height) {
|
|
801
|
+
state.pages = []
|
|
802
|
+
return
|
|
803
|
+
}
|
|
804
|
+
const W = current.width
|
|
805
|
+
const H = current.height
|
|
806
|
+
const url = previewUrl(current.id)
|
|
807
|
+
const picture = croppable()
|
|
808
|
+
const rectFor = (name) => {
|
|
809
|
+
const preset = presetsNow().find((one) => one.name === name)
|
|
810
|
+
return (name && picture.crops[name]) || (preset ? presetRect(picture, preset) : { x: 0, y: 0, width: W, height: H })
|
|
811
|
+
}
|
|
812
|
+
const hearsIn = (site) => {
|
|
813
|
+
const key = site ? site.trim().toLowerCase() : ''
|
|
814
|
+
const own = key && current.views && current.views[key] && current.views[key].altText
|
|
815
|
+
if (state.words === 'view' && key === viewKey()) return draft.alt.trim() || (current.altText || '')
|
|
816
|
+
return own || (state.words === 'shared' ? draft.alt.trim() : current.altText || '')
|
|
817
|
+
}
|
|
818
|
+
const box = { height: 150, maxWidth: 300 }
|
|
819
|
+
if (placements.length) {
|
|
820
|
+
state.pagesTitle = 'As its pages show it'
|
|
821
|
+
state.pages = placements.slice(0, 8).map((one) => {
|
|
822
|
+
const use = (one.uses || []).find((each) => each.crop) || (one.uses || [])[0] || {}
|
|
823
|
+
const preset = presetsNow().find((each) => each.name === use.crop)
|
|
824
|
+
return {
|
|
825
|
+
key: one.site + '|' + one.page,
|
|
826
|
+
title: one.title || one.page,
|
|
827
|
+
meta: [preset ? preset.label : use.crop || 'Whole picture', one.status === 'published' ? 'live' : 'draft', one.site].filter(Boolean).join(' · '),
|
|
828
|
+
style: cutStyle(rectFor(use.crop || ''), { width: W, height: H }, url, box),
|
|
829
|
+
hears: hearsIn(use.view || one.site),
|
|
830
|
+
}
|
|
831
|
+
})
|
|
832
|
+
} else {
|
|
833
|
+
state.pagesTitle = 'Not on a page yet · how each shape would show it'
|
|
834
|
+
state.pages = presetsNow().map((preset) => ({
|
|
835
|
+
key: preset.name,
|
|
836
|
+
title: 'As a ' + preset.label.toLowerCase(),
|
|
837
|
+
meta: preset.ratioLabel + (picture.crops[preset.name] ? ' · adjusted by hand' : ' · follows the focal point'),
|
|
838
|
+
style: cutStyle(rectFor(preset.name), { width: W, height: H }, url, box),
|
|
839
|
+
hears: hearsIn(''),
|
|
840
|
+
}))
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
function setMode(mode) {
|
|
845
|
+
state.mode = mode
|
|
846
|
+
if (mode === 'pages') {
|
|
847
|
+
state.crop = 'original'
|
|
848
|
+
state.zoomed = false
|
|
849
|
+
}
|
|
850
|
+
// The stage changes size with the view, so it is measured after the change.
|
|
851
|
+
requestAnimationFrame(draw)
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
function showCrop(name) {
|
|
855
|
+
state.crop = name
|
|
856
|
+
if (name !== 'original') state.zoomed = false
|
|
857
|
+
draw()
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
function toggleOverlay(name) {
|
|
861
|
+
state.overlay = state.overlay === name ? '' : name
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
function setZoom(on) {
|
|
865
|
+
state.zoomed = Boolean(on) && state.canZoom
|
|
866
|
+
if (state.zoomed) state.crop = 'original'
|
|
867
|
+
draw()
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
function moveFocal(x, y) {
|
|
871
|
+
focal = { x: Math.round(clamp(x, 0, 100)), y: Math.round(clamp(y, 0, 100)) }
|
|
872
|
+
state.focalSet = true
|
|
873
|
+
draw()
|
|
874
|
+
drawRing()
|
|
875
|
+
touch('focal')
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
function clickFocal(event) {
|
|
879
|
+
if (!state.canFocal || !refs.stage) return
|
|
880
|
+
const box = refs.stage.getBoundingClientRect()
|
|
881
|
+
if (!box.width || !box.height) return
|
|
882
|
+
moveFocal(((event.clientX - box.left) / box.width) * 100, ((event.clientY - box.top) / box.height) * 100)
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
const NUDGE = { ArrowLeft: [-1, 0], ArrowRight: [1, 0], ArrowUp: [0, -1], ArrowDown: [0, 1] }
|
|
886
|
+
|
|
887
|
+
function keyFocal(event) {
|
|
888
|
+
const by = NUDGE[event.key]
|
|
889
|
+
if (!by) return
|
|
890
|
+
// Arrow keys on the picture move the point, not the editor to the next picture.
|
|
891
|
+
event.stopPropagation()
|
|
892
|
+
if (!state.canFocal) return
|
|
893
|
+
event.preventDefault()
|
|
894
|
+
const step = event.shiftKey ? FOCAL_LEAP : FOCAL_STEP
|
|
895
|
+
moveFocal(focal.x + by[0] * step, focal.y + by[1] * step)
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
function clearFocal() {
|
|
899
|
+
focal = { x: 50, y: 50 }
|
|
900
|
+
state.focalSet = false
|
|
901
|
+
draw()
|
|
902
|
+
drawRing()
|
|
903
|
+
touch('focal')
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
function openCropEditor(name) {
|
|
907
|
+
if (state.readOnly || !current) return
|
|
908
|
+
const pages = {}
|
|
909
|
+
for (const one of placements) {
|
|
910
|
+
for (const cropName of new Set((one.uses || []).map((use) => use.crop).filter(Boolean))) pages[cropName] = (pages[cropName] || 0) + 1
|
|
911
|
+
}
|
|
912
|
+
cropEditor.value = {
|
|
913
|
+
id: current.id,
|
|
914
|
+
label: state.label,
|
|
915
|
+
width: current.width,
|
|
916
|
+
height: current.height,
|
|
917
|
+
...(state.focalSet ? { focal: { ...focal } } : {}),
|
|
918
|
+
crops: { ...(current.crops || {}) },
|
|
919
|
+
presets: presetsNow(),
|
|
920
|
+
pages,
|
|
921
|
+
name,
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
function adjustCrop() {
|
|
926
|
+
if (state.crop !== 'original') openCropEditor(state.crop)
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
function customCrop() {
|
|
930
|
+
openCropEditor('')
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
async function resetCrop() {
|
|
934
|
+
const name = state.crop
|
|
935
|
+
const id = state.id
|
|
936
|
+
if (!current || !current.crops || !current.crops[name]) return
|
|
937
|
+
saving('Saving…')
|
|
938
|
+
try {
|
|
939
|
+
await getLibrary().removeCrop(id, name)
|
|
940
|
+
if (state.id !== id) return
|
|
941
|
+
const crops = { ...current.crops }
|
|
942
|
+
delete crops[name]
|
|
943
|
+
current.crops = crops
|
|
944
|
+
patched.value = { id, replace: { crops } }
|
|
945
|
+
draw()
|
|
946
|
+
saving('✓ Saved')
|
|
947
|
+
} catch (err) {
|
|
948
|
+
failed(err)
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
// --- colours, usage, the bin ------------------------------------------------------------
|
|
953
|
+
|
|
954
|
+
let enrichTimer = null
|
|
955
|
+
|
|
956
|
+
function drawColours() {
|
|
957
|
+
const palette = (current && current.palette) || []
|
|
958
|
+
state.swatches = palette.slice(0, 6).map((one) => ({
|
|
959
|
+
hex: one.hex,
|
|
960
|
+
style: 'background: ' + one.hex + '; flex: ' + Math.max(0.4, one.weight * 5),
|
|
961
|
+
title: (one.name ? one.name + ' ' : '') + one.hex,
|
|
962
|
+
}))
|
|
963
|
+
state.colourNote = palette.length ? textOver(palette) : state.canEnrich === null ? 'Being worked out…' : 'Not worked out yet.'
|
|
964
|
+
if (palette.length) state.canEnrich = false
|
|
965
|
+
else if (state.canEnrich !== null) state.canEnrich = !state.readOnly
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
async function enrich() {
|
|
969
|
+
const id = state.id
|
|
970
|
+
state.canEnrich = null
|
|
971
|
+
state.colourNote = 'Being worked out…'
|
|
972
|
+
try {
|
|
973
|
+
const answer = await getLibrary().enrich(id)
|
|
974
|
+
if (state.id !== id) return
|
|
975
|
+
if (answer && answer.wanted && !answer.wanted.includes('palette')) {
|
|
976
|
+
state.colourNote = 'This library does not work out colours.'
|
|
977
|
+
return
|
|
978
|
+
}
|
|
979
|
+
let tries = 0
|
|
980
|
+
const look = async () => {
|
|
981
|
+
if (state.id !== id) return
|
|
982
|
+
try {
|
|
983
|
+
const detail = await getLibrary().detail(id)
|
|
984
|
+
if (state.id !== id) return
|
|
985
|
+
if (detail.palette && detail.palette.length) {
|
|
986
|
+
current.palette = detail.palette
|
|
987
|
+
patched.value = { id, replace: { palette: detail.palette } }
|
|
988
|
+
state.canEnrich = false
|
|
989
|
+
drawColours()
|
|
990
|
+
return
|
|
991
|
+
}
|
|
992
|
+
} catch {
|
|
993
|
+
// Looked at again below.
|
|
994
|
+
}
|
|
995
|
+
if (++tries < 12) enrichTimer = setTimeout(look, 5000)
|
|
996
|
+
else {
|
|
997
|
+
state.canEnrich = true
|
|
998
|
+
state.colourNote = 'Still being worked out. Try again in a minute.'
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
look()
|
|
1002
|
+
} catch (err) {
|
|
1003
|
+
state.canEnrich = true
|
|
1004
|
+
state.colourNote = "Couldn't ask: " + (err && err.message ? err.message : 'no answer from the library')
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
async function loadUsage(id, mine) {
|
|
1009
|
+
const port = getLibrary()
|
|
1010
|
+
if (typeof port.usage !== 'function') return
|
|
1011
|
+
try {
|
|
1012
|
+
const usage = await port.usage(id)
|
|
1013
|
+
if (mine !== generation) return
|
|
1014
|
+
placements = usage.placements || []
|
|
1015
|
+
drawUsage()
|
|
1016
|
+
if (state.mode === 'pages') drawPages()
|
|
1017
|
+
state.usageKnown = true
|
|
1018
|
+
} catch {
|
|
1019
|
+
// Usage is a courtesy; the editor is still about the picture.
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
function drawUsage() {
|
|
1024
|
+
if (!current) return
|
|
1025
|
+
const W = current.width || 0
|
|
1026
|
+
const H = current.height || 0
|
|
1027
|
+
const url = previewUrl(current.id)
|
|
1028
|
+
const picture = croppable()
|
|
1029
|
+
state.uses = placements.slice(0, 12).map((one) => {
|
|
1030
|
+
const cropName = ((one.uses || []).find((use) => use.crop) || {}).crop || ''
|
|
1031
|
+
const preset = presetsNow().find((each) => each.name === cropName)
|
|
1032
|
+
const rect = (cropName && picture.crops[cropName]) || (preset ? presetRect(picture, preset) : { x: 0, y: 0, width: W, height: H })
|
|
1033
|
+
return {
|
|
1034
|
+
key: one.site + '|' + one.page,
|
|
1035
|
+
title: one.title || one.page,
|
|
1036
|
+
url: one.url || '',
|
|
1037
|
+
meta: [preset ? preset.label : cropName, one.status === 'published' ? 'live' : 'draft', one.site].filter(Boolean).join(' · '),
|
|
1038
|
+
style: W && H ? cutStyle(rect, { width: W, height: H }, url, { height: 36, maxWidth: 64 }) : '',
|
|
1039
|
+
}
|
|
1040
|
+
})
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
function askToBin() {
|
|
1044
|
+
if (!current) return
|
|
1045
|
+
binDialog.value = {
|
|
1046
|
+
id: current.id,
|
|
1047
|
+
label: state.label,
|
|
1048
|
+
usageKnown: state.usageKnown,
|
|
1049
|
+
pages: placements.map((one) => ({ site: one.site, title: one.title || one.page })),
|
|
1050
|
+
seen: 0,
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
async function restore() {
|
|
1055
|
+
const id = state.id
|
|
1056
|
+
state.busy = true
|
|
1057
|
+
try {
|
|
1058
|
+
await getLibrary().restore(id)
|
|
1059
|
+
if (state.id === id) {
|
|
1060
|
+
delete current.deletedAt
|
|
1061
|
+
delete current.deletedReason
|
|
1062
|
+
adopt()
|
|
1063
|
+
writeFields()
|
|
1064
|
+
}
|
|
1065
|
+
changed.value = (changed.value || 0) + 1
|
|
1066
|
+
} catch (err) {
|
|
1067
|
+
failed(err)
|
|
1068
|
+
} finally {
|
|
1069
|
+
state.busy = false
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
function getLink() {
|
|
1074
|
+
if (current) link.value = { ...current, ...(state.focalSet ? { focal: { ...focal } } : {}) }
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
async function copyLink() {
|
|
1078
|
+
if (!current) return
|
|
1079
|
+
const port = getLibrary()
|
|
1080
|
+
const url = new URL(port.imageUrl(current.id, {}), location.href).href
|
|
1081
|
+
try {
|
|
1082
|
+
await navigator.clipboard.writeText(url)
|
|
1083
|
+
state.copyLabel = 'Copied'
|
|
1084
|
+
if (typeof port.copied === 'function') port.copied(current.id).catch(() => {})
|
|
1085
|
+
} catch {
|
|
1086
|
+
state.copyLabel = "Couldn't copy"
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
// --- keys, and following the rest of the page ---------------------------------------------
|
|
1091
|
+
|
|
1092
|
+
function onKey(event) {
|
|
1093
|
+
// A dialog over the editor has the keys while it is open.
|
|
1094
|
+
if (cropEditor.value || binDialog.value || link.value) return
|
|
1095
|
+
if (event.key === 'Escape') {
|
|
1096
|
+
event.preventDefault()
|
|
1097
|
+
close()
|
|
1098
|
+
return
|
|
1099
|
+
}
|
|
1100
|
+
const target = event.target
|
|
1101
|
+
const typing = target && (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA' || target.tagName === 'SELECT')
|
|
1102
|
+
if (typing || event.metaKey || event.ctrlKey || event.altKey) return
|
|
1103
|
+
if (event.key === 'ArrowLeft' && state.prevId) {
|
|
1104
|
+
event.preventDefault()
|
|
1105
|
+
go(state.prevId)
|
|
1106
|
+
} else if (event.key === 'ArrowRight' && state.nextId) {
|
|
1107
|
+
event.preventDefault()
|
|
1108
|
+
go(state.nextId)
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
// Tab stays inside the editor while it is open.
|
|
1113
|
+
function holdFocus(event) {
|
|
1114
|
+
if (!state.open || event.key !== 'Tab' || cropEditor.value || binDialog.value || link.value || !refs.root) return
|
|
1115
|
+
const stops = Array.from(refs.root.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'))
|
|
1116
|
+
.filter((one) => !one.disabled && one.offsetParent !== null)
|
|
1117
|
+
if (!stops.length) return
|
|
1118
|
+
const first = stops[0]
|
|
1119
|
+
const last = stops[stops.length - 1]
|
|
1120
|
+
if (!refs.root.contains(document.activeElement)) {
|
|
1121
|
+
event.preventDefault()
|
|
1122
|
+
first.focus()
|
|
1123
|
+
} else if (event.shiftKey && document.activeElement === first) {
|
|
1124
|
+
event.preventDefault()
|
|
1125
|
+
last.focus()
|
|
1126
|
+
} else if (!event.shiftKey && document.activeElement === last) {
|
|
1127
|
+
event.preventDefault()
|
|
1128
|
+
first.focus()
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
selected.subscribe((asset) => {
|
|
1133
|
+
if (!asset) {
|
|
1134
|
+
if (state.open) shut()
|
|
1135
|
+
return
|
|
1136
|
+
}
|
|
1137
|
+
if (asset.id !== state.id) {
|
|
1138
|
+
start(asset)
|
|
1139
|
+
return
|
|
1140
|
+
}
|
|
1141
|
+
// The same picture, changed by a dialog over the editor: a crop saved, or
|
|
1142
|
+
// the picture binned.
|
|
1143
|
+
if (!current) return
|
|
1144
|
+
const cropsChanged = JSON.stringify(asset.crops || {}) !== JSON.stringify(current.crops || {})
|
|
1145
|
+
if (cropsChanged) {
|
|
1146
|
+
current.crops = asset.crops || {}
|
|
1147
|
+
patched.value = { id: current.id, replace: { crops: current.crops } }
|
|
1148
|
+
saving('✓ Saved')
|
|
1149
|
+
}
|
|
1150
|
+
if (asset.deletedAt !== current.deletedAt) {
|
|
1151
|
+
current.deletedAt = asset.deletedAt
|
|
1152
|
+
current.deletedReason = asset.deletedReason
|
|
1153
|
+
adopt()
|
|
1154
|
+
} else if (cropsChanged) {
|
|
1155
|
+
draw()
|
|
1156
|
+
drawUsage()
|
|
1157
|
+
}
|
|
1158
|
+
})
|
|
1159
|
+
|
|
1160
|
+
set.subscribe(() => {
|
|
1161
|
+
if (state.open) describeSet()
|
|
1162
|
+
})
|
|
1163
|
+
|
|
1164
|
+
presets.subscribe(() => {
|
|
1165
|
+
if (state.open && current) draw()
|
|
1166
|
+
})
|
|
1167
|
+
|
|
1168
|
+
function onResize() {
|
|
1169
|
+
if (state.open && current) draw()
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
onMounted(() => {
|
|
1173
|
+
document.addEventListener('keydown', holdFocus)
|
|
1174
|
+
window.addEventListener('resize', onResize)
|
|
1175
|
+
if (selected.value) start(selected.value)
|
|
1176
|
+
})
|
|
1177
|
+
|
|
1178
|
+
onUnmounted(() => {
|
|
1179
|
+
document.removeEventListener('keydown', holdFocus)
|
|
1180
|
+
window.removeEventListener('resize', onResize)
|
|
1181
|
+
if (timer) clearTimeout(timer)
|
|
1182
|
+
if (enrichTimer) clearTimeout(enrichTimer)
|
|
1183
|
+
document.documentElement.style.overflow = ''
|
|
1184
|
+
})
|
|
1185
|
+
</logic>
|
|
1186
|
+
|
|
1187
|
+
<style>
|
|
1188
|
+
.studio {
|
|
1189
|
+
position: fixed;
|
|
1190
|
+
inset: 0;
|
|
1191
|
+
z-index: 40;
|
|
1192
|
+
display: flex;
|
|
1193
|
+
flex-direction: column;
|
|
1194
|
+
background: #0d0d0e;
|
|
1195
|
+
color: #f1f1f1;
|
|
1196
|
+
font-size: var(--px-fs-m);
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
.ebar {
|
|
1200
|
+
display: flex;
|
|
1201
|
+
align-items: center;
|
|
1202
|
+
flex-wrap: wrap;
|
|
1203
|
+
gap: 8px 12px;
|
|
1204
|
+
padding: 10px 20px;
|
|
1205
|
+
border-bottom: 1px solid rgba(255, 255, 255, .08);
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
.who {
|
|
1209
|
+
display: flex;
|
|
1210
|
+
flex-direction: column;
|
|
1211
|
+
min-width: 0;
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
.who-name {
|
|
1215
|
+
font-size: 15px;
|
|
1216
|
+
overflow: hidden;
|
|
1217
|
+
text-overflow: ellipsis;
|
|
1218
|
+
white-space: nowrap;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
.who-pos {
|
|
1222
|
+
font-size: 12px;
|
|
1223
|
+
opacity: .6;
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
.status {
|
|
1227
|
+
margin-left: auto;
|
|
1228
|
+
font-size: 13px;
|
|
1229
|
+
opacity: .75;
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
.status.is-bad {
|
|
1233
|
+
color: #ff8f86;
|
|
1234
|
+
opacity: 1;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
.dk-btn {
|
|
1238
|
+
min-height: 40px;
|
|
1239
|
+
min-width: 40px;
|
|
1240
|
+
padding: 0 12px;
|
|
1241
|
+
border-radius: 999px;
|
|
1242
|
+
border: 0;
|
|
1243
|
+
background: rgba(255, 255, 255, .09);
|
|
1244
|
+
color: #f1f1f1;
|
|
1245
|
+
font: inherit;
|
|
1246
|
+
font-size: 13px;
|
|
1247
|
+
font-weight: 500;
|
|
1248
|
+
cursor: pointer;
|
|
1249
|
+
display: inline-flex;
|
|
1250
|
+
align-items: center;
|
|
1251
|
+
gap: 8px;
|
|
1252
|
+
justify-content: center;
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
.dk-btn:hover {
|
|
1256
|
+
background: rgba(255, 255, 255, .17);
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1259
|
+
.dk-btn:disabled {
|
|
1260
|
+
opacity: .35;
|
|
1261
|
+
cursor: default;
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
.dk-btn.pri {
|
|
1265
|
+
background: #f1f1f1;
|
|
1266
|
+
color: #0d0d0e;
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
.studio :is(.dk-btn, .cbtn, .tool, .stage, .film button, .link):focus-visible {
|
|
1270
|
+
outline: 3px solid #a3b9ff;
|
|
1271
|
+
outline-offset: 2px;
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
.ring {
|
|
1275
|
+
--p: 0;
|
|
1276
|
+
width: 34px;
|
|
1277
|
+
height: 34px;
|
|
1278
|
+
flex: none;
|
|
1279
|
+
border-radius: 50%;
|
|
1280
|
+
background: conic-gradient(#8fd19e calc(var(--p) * 1%), rgba(255, 255, 255, .14) 0);
|
|
1281
|
+
display: grid;
|
|
1282
|
+
place-items: center;
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
.ring span {
|
|
1286
|
+
width: 26px;
|
|
1287
|
+
height: 26px;
|
|
1288
|
+
border-radius: 50%;
|
|
1289
|
+
background: #0d0d0e;
|
|
1290
|
+
display: grid;
|
|
1291
|
+
place-items: center;
|
|
1292
|
+
font-size: 10px;
|
|
1293
|
+
font-weight: 700;
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
.st-body {
|
|
1297
|
+
flex: 1;
|
|
1298
|
+
display: grid;
|
|
1299
|
+
grid-template-columns: 232px minmax(0, 1fr) 392px;
|
|
1300
|
+
min-height: 0;
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
.st-crops {
|
|
1304
|
+
padding: 16px;
|
|
1305
|
+
display: flex;
|
|
1306
|
+
flex-direction: column;
|
|
1307
|
+
gap: 10px;
|
|
1308
|
+
border-right: 1px solid rgba(255, 255, 255, .08);
|
|
1309
|
+
overflow: auto;
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
.dk-lbl {
|
|
1313
|
+
font-size: 11px;
|
|
1314
|
+
font-weight: 600;
|
|
1315
|
+
letter-spacing: .06em;
|
|
1316
|
+
text-transform: uppercase;
|
|
1317
|
+
opacity: .55;
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
.cbtn {
|
|
1321
|
+
display: flex;
|
|
1322
|
+
flex-direction: column;
|
|
1323
|
+
gap: 6px;
|
|
1324
|
+
padding: 8px;
|
|
1325
|
+
border-radius: 10px;
|
|
1326
|
+
border: 1px solid transparent;
|
|
1327
|
+
background: transparent;
|
|
1328
|
+
color: #ddd;
|
|
1329
|
+
font: inherit;
|
|
1330
|
+
font-size: 12px;
|
|
1331
|
+
font-weight: 600;
|
|
1332
|
+
cursor: pointer;
|
|
1333
|
+
text-align: left;
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
.cbtn:hover {
|
|
1337
|
+
background: rgba(255, 255, 255, .06);
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
.cbtn[aria-pressed="true"] {
|
|
1341
|
+
border-color: #f1f1f1;
|
|
1342
|
+
background: rgba(255, 255, 255, .08);
|
|
1343
|
+
color: #fff;
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
.cbtn small {
|
|
1347
|
+
font-weight: 500;
|
|
1348
|
+
opacity: .6;
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
.cfr {
|
|
1352
|
+
display: block;
|
|
1353
|
+
flex: none;
|
|
1354
|
+
border-radius: var(--px-r-s);
|
|
1355
|
+
background-color: #111;
|
|
1356
|
+
background-repeat: no-repeat;
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
.cmeta {
|
|
1360
|
+
display: flex;
|
|
1361
|
+
justify-content: space-between;
|
|
1362
|
+
align-items: center;
|
|
1363
|
+
gap: 6px;
|
|
1364
|
+
width: 100%;
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
.q {
|
|
1368
|
+
font-size: 11px;
|
|
1369
|
+
font-weight: 600;
|
|
1370
|
+
padding: 1px 6px;
|
|
1371
|
+
border-radius: 999px;
|
|
1372
|
+
background: rgba(143, 209, 158, .16);
|
|
1373
|
+
color: #8fd19e;
|
|
1374
|
+
white-space: nowrap;
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
.q.is-soft {
|
|
1378
|
+
background: rgba(245, 196, 107, .16);
|
|
1379
|
+
color: #f5c46b;
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
.crop-acts {
|
|
1383
|
+
display: flex;
|
|
1384
|
+
flex-direction: column;
|
|
1385
|
+
gap: 6px;
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
.add-crop {
|
|
1389
|
+
margin-top: 4px;
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
.st-mid {
|
|
1393
|
+
display: flex;
|
|
1394
|
+
flex-direction: column;
|
|
1395
|
+
align-items: center;
|
|
1396
|
+
gap: 12px;
|
|
1397
|
+
padding: 16px 24px;
|
|
1398
|
+
min-width: 0;
|
|
1399
|
+
min-height: 0;
|
|
1400
|
+
overflow: auto;
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
.tools {
|
|
1404
|
+
display: flex;
|
|
1405
|
+
align-items: center;
|
|
1406
|
+
flex-wrap: wrap;
|
|
1407
|
+
gap: 6px;
|
|
1408
|
+
width: 100%;
|
|
1409
|
+
max-width: 760px;
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
.tool {
|
|
1413
|
+
min-height: 34px;
|
|
1414
|
+
padding: 0 10px;
|
|
1415
|
+
border-radius: var(--px-r-m);
|
|
1416
|
+
border: 1px solid rgba(255, 255, 255, .14);
|
|
1417
|
+
background: transparent;
|
|
1418
|
+
color: #ddd;
|
|
1419
|
+
font: inherit;
|
|
1420
|
+
font-size: 12px;
|
|
1421
|
+
font-weight: 500;
|
|
1422
|
+
cursor: pointer;
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
.tool[aria-pressed="true"] {
|
|
1426
|
+
background: #f1f1f1;
|
|
1427
|
+
color: #0d0d0e;
|
|
1428
|
+
border-color: #f1f1f1;
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
.tool:disabled {
|
|
1432
|
+
opacity: .35;
|
|
1433
|
+
cursor: default;
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1436
|
+
.sep {
|
|
1437
|
+
width: 1px;
|
|
1438
|
+
height: 20px;
|
|
1439
|
+
background: rgba(255, 255, 255, .15);
|
|
1440
|
+
margin: 0 4px;
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
.focal-text {
|
|
1444
|
+
margin-left: auto;
|
|
1445
|
+
font-size: 12px;
|
|
1446
|
+
opacity: .6;
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
.stage-wrap {
|
|
1450
|
+
flex: 1 1 320px;
|
|
1451
|
+
min-height: 220px;
|
|
1452
|
+
width: 100%;
|
|
1453
|
+
max-width: 760px;
|
|
1454
|
+
display: flex;
|
|
1455
|
+
align-items: center;
|
|
1456
|
+
justify-content: center;
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
.stage {
|
|
1460
|
+
position: relative;
|
|
1461
|
+
flex: none;
|
|
1462
|
+
max-width: 100%;
|
|
1463
|
+
border-radius: var(--px-r-s);
|
|
1464
|
+
overflow: hidden;
|
|
1465
|
+
background-color: #1b1b1d;
|
|
1466
|
+
background-repeat: no-repeat;
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
.ov-g {
|
|
1470
|
+
position: absolute;
|
|
1471
|
+
background: rgba(255, 255, 255, .45);
|
|
1472
|
+
pointer-events: none;
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
.ov-g.v1 { left: 33.33%; top: 0; bottom: 0; width: 1px; }
|
|
1476
|
+
.ov-g.v2 { left: 66.66%; top: 0; bottom: 0; width: 1px; }
|
|
1477
|
+
.ov-g.h1 { top: 33.33%; left: 0; right: 0; height: 1px; }
|
|
1478
|
+
.ov-g.h2 { top: 66.66%; left: 0; right: 0; height: 1px; }
|
|
1479
|
+
|
|
1480
|
+
.ov-zone {
|
|
1481
|
+
position: absolute;
|
|
1482
|
+
border: 2px solid rgba(255, 255, 255, .85);
|
|
1483
|
+
background: rgba(255, 255, 255, .12);
|
|
1484
|
+
border-radius: 4px;
|
|
1485
|
+
color: #fff;
|
|
1486
|
+
font-size: 12px;
|
|
1487
|
+
font-weight: 600;
|
|
1488
|
+
padding: 6px 8px;
|
|
1489
|
+
display: flex;
|
|
1490
|
+
align-items: flex-end;
|
|
1491
|
+
pointer-events: none;
|
|
1492
|
+
text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
.ov-zone.safe {
|
|
1496
|
+
border-style: dashed;
|
|
1497
|
+
background: transparent;
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
.box {
|
|
1501
|
+
position: absolute;
|
|
1502
|
+
border: 2px solid #fff;
|
|
1503
|
+
box-shadow: 0 0 0 9999px rgba(0, 0, 0, .55);
|
|
1504
|
+
pointer-events: none;
|
|
1505
|
+
transition: all .18s;
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
.rd {
|
|
1509
|
+
position: absolute;
|
|
1510
|
+
left: 8px;
|
|
1511
|
+
bottom: 8px;
|
|
1512
|
+
background: rgba(0, 0, 0, .7);
|
|
1513
|
+
color: #fff;
|
|
1514
|
+
font-size: 12px;
|
|
1515
|
+
font-weight: 600;
|
|
1516
|
+
padding: 3px 8px;
|
|
1517
|
+
border-radius: 4px;
|
|
1518
|
+
white-space: nowrap;
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
.focal {
|
|
1522
|
+
position: absolute;
|
|
1523
|
+
width: 34px;
|
|
1524
|
+
height: 34px;
|
|
1525
|
+
margin: -17px 0 0 -17px;
|
|
1526
|
+
border-radius: 50%;
|
|
1527
|
+
border: 2px solid #fff;
|
|
1528
|
+
box-shadow: 0 0 0 2px rgba(0, 0, 0, .5);
|
|
1529
|
+
pointer-events: none;
|
|
1530
|
+
transition: left .15s, top .15s;
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
.stage-wrap.is-small {
|
|
1534
|
+
flex: 0 0 240px;
|
|
1535
|
+
min-height: 240px;
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
.pages {
|
|
1539
|
+
display: flex;
|
|
1540
|
+
flex-direction: column;
|
|
1541
|
+
gap: 10px;
|
|
1542
|
+
width: 100%;
|
|
1543
|
+
max-width: 760px;
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
.page-grid {
|
|
1547
|
+
display: grid;
|
|
1548
|
+
grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
|
|
1549
|
+
gap: 16px;
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
.page {
|
|
1553
|
+
margin: 0;
|
|
1554
|
+
display: flex;
|
|
1555
|
+
flex-direction: column;
|
|
1556
|
+
gap: 8px;
|
|
1557
|
+
min-width: 0;
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
.page .cfr {
|
|
1561
|
+
max-width: 100%;
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
.page figcaption {
|
|
1565
|
+
display: flex;
|
|
1566
|
+
flex-direction: column;
|
|
1567
|
+
gap: 2px;
|
|
1568
|
+
font-size: 13px;
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1571
|
+
.hears {
|
|
1572
|
+
font-size: 12px;
|
|
1573
|
+
line-height: 1.45;
|
|
1574
|
+
color: #8fd19e;
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
.hears.is-empty {
|
|
1578
|
+
color: #f5c46b;
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
.hint {
|
|
1582
|
+
font-size: 13px;
|
|
1583
|
+
opacity: .75;
|
|
1584
|
+
text-align: center;
|
|
1585
|
+
max-width: 760px;
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
.link {
|
|
1589
|
+
border: 0;
|
|
1590
|
+
background: transparent;
|
|
1591
|
+
padding: 0;
|
|
1592
|
+
font: inherit;
|
|
1593
|
+
color: inherit;
|
|
1594
|
+
text-decoration: underline;
|
|
1595
|
+
cursor: pointer;
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
.st-side .link {
|
|
1599
|
+
color: var(--px-accent-text);
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
.cards {
|
|
1603
|
+
display: grid;
|
|
1604
|
+
grid-template-columns: 1.3fr 1fr;
|
|
1605
|
+
gap: 12px;
|
|
1606
|
+
width: 100%;
|
|
1607
|
+
max-width: 760px;
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
.icard {
|
|
1611
|
+
display: flex;
|
|
1612
|
+
flex-direction: column;
|
|
1613
|
+
gap: 8px;
|
|
1614
|
+
padding: 12px 14px;
|
|
1615
|
+
border-radius: 12px;
|
|
1616
|
+
background: rgba(255, 255, 255, .05);
|
|
1617
|
+
border: 1px solid rgba(255, 255, 255, .08);
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
.small {
|
|
1621
|
+
font-size: 12px;
|
|
1622
|
+
line-height: 1.5;
|
|
1623
|
+
opacity: .75;
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
.small-btn {
|
|
1627
|
+
min-height: 32px;
|
|
1628
|
+
align-self: flex-start;
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
.sw {
|
|
1632
|
+
display: flex;
|
|
1633
|
+
gap: 4px;
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
.sw span {
|
|
1637
|
+
height: 26px;
|
|
1638
|
+
border-radius: 5px;
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
.st-side {
|
|
1642
|
+
background: var(--px-surface);
|
|
1643
|
+
color: var(--px-text);
|
|
1644
|
+
padding: 20px;
|
|
1645
|
+
display: flex;
|
|
1646
|
+
flex-direction: column;
|
|
1647
|
+
gap: 18px;
|
|
1648
|
+
overflow: auto;
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
.st-side .px-seg {
|
|
1652
|
+
align-self: flex-start;
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
.alt {
|
|
1656
|
+
min-height: 110px;
|
|
1657
|
+
font-size: 16px;
|
|
1658
|
+
line-height: 1.5;
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
.chk {
|
|
1662
|
+
font-size: 12px;
|
|
1663
|
+
line-height: 1.4;
|
|
1664
|
+
color: var(--px-text-2);
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
.chk.ok {
|
|
1668
|
+
color: var(--px-ok);
|
|
1669
|
+
}
|
|
1670
|
+
|
|
1671
|
+
.chk.warn {
|
|
1672
|
+
color: var(--px-warn);
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1675
|
+
.labels,
|
|
1676
|
+
.used,
|
|
1677
|
+
.groups {
|
|
1678
|
+
display: flex;
|
|
1679
|
+
flex-direction: column;
|
|
1680
|
+
gap: 8px;
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
.chips {
|
|
1684
|
+
gap: 6px;
|
|
1685
|
+
flex-wrap: wrap;
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
.use {
|
|
1689
|
+
display: flex;
|
|
1690
|
+
gap: 10px;
|
|
1691
|
+
align-items: center;
|
|
1692
|
+
font-size: 13px;
|
|
1693
|
+
color: var(--px-text);
|
|
1694
|
+
text-decoration: none;
|
|
1695
|
+
padding: 6px;
|
|
1696
|
+
border-radius: var(--px-r-m);
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1699
|
+
.use:hover {
|
|
1700
|
+
background: var(--px-surface-2);
|
|
1701
|
+
}
|
|
1702
|
+
|
|
1703
|
+
.foot {
|
|
1704
|
+
gap: 6px;
|
|
1705
|
+
margin-top: auto;
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1708
|
+
.bin {
|
|
1709
|
+
margin-left: auto;
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
.film {
|
|
1713
|
+
position: relative;
|
|
1714
|
+
display: flex;
|
|
1715
|
+
gap: 6px;
|
|
1716
|
+
padding: 10px 20px 14px;
|
|
1717
|
+
border-top: 1px solid rgba(255, 255, 255, .08);
|
|
1718
|
+
overflow-x: auto;
|
|
1719
|
+
scrollbar-width: none;
|
|
1720
|
+
}
|
|
1721
|
+
|
|
1722
|
+
.film button {
|
|
1723
|
+
position: relative;
|
|
1724
|
+
flex: 0 0 86px;
|
|
1725
|
+
height: 52px;
|
|
1726
|
+
border: 0;
|
|
1727
|
+
padding: 0;
|
|
1728
|
+
border-radius: 5px;
|
|
1729
|
+
overflow: hidden;
|
|
1730
|
+
opacity: .5;
|
|
1731
|
+
cursor: pointer;
|
|
1732
|
+
background: #1b1b1d;
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
.film button:hover {
|
|
1736
|
+
opacity: .8;
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1739
|
+
.film img {
|
|
1740
|
+
position: absolute;
|
|
1741
|
+
inset: 0;
|
|
1742
|
+
width: 100%;
|
|
1743
|
+
height: 100%;
|
|
1744
|
+
object-fit: cover;
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
.film button[aria-current="true"] {
|
|
1748
|
+
opacity: 1;
|
|
1749
|
+
outline: 2px solid #f1f1f1;
|
|
1750
|
+
outline-offset: 2px;
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1753
|
+
.film i {
|
|
1754
|
+
position: absolute;
|
|
1755
|
+
right: 5px;
|
|
1756
|
+
top: 5px;
|
|
1757
|
+
width: 7px;
|
|
1758
|
+
height: 7px;
|
|
1759
|
+
border-radius: 50%;
|
|
1760
|
+
background: #f5c46b;
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
@media (max-width: 1100px) {
|
|
1764
|
+
.st-body {
|
|
1765
|
+
grid-template-columns: 180px minmax(0, 1fr) 320px;
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
/* Too narrow for three columns: one column that scrolls, the picture first. */
|
|
1770
|
+
@media (max-width: 820px) {
|
|
1771
|
+
.studio {
|
|
1772
|
+
overflow: auto;
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
.st-body {
|
|
1776
|
+
display: flex;
|
|
1777
|
+
flex-direction: column;
|
|
1778
|
+
flex: none;
|
|
1779
|
+
}
|
|
1780
|
+
|
|
1781
|
+
.st-mid {
|
|
1782
|
+
order: -1;
|
|
1783
|
+
overflow: visible;
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
.st-crops {
|
|
1787
|
+
flex-direction: row;
|
|
1788
|
+
flex-wrap: nowrap;
|
|
1789
|
+
overflow-x: auto;
|
|
1790
|
+
border-right: 0;
|
|
1791
|
+
border-top: 1px solid rgba(255, 255, 255, .08);
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1794
|
+
.st-crops .dk-lbl {
|
|
1795
|
+
display: none;
|
|
1796
|
+
}
|
|
1797
|
+
|
|
1798
|
+
.st-side {
|
|
1799
|
+
overflow: visible;
|
|
1800
|
+
}
|
|
1801
|
+
|
|
1802
|
+
.film {
|
|
1803
|
+
display: none;
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1808
|
+
.box,
|
|
1809
|
+
.focal {
|
|
1810
|
+
transition: none;
|
|
1811
|
+
}
|
|
1812
|
+
}
|
|
1813
|
+
</style>
|