@nickpaustian/tela 0.2.0 → 0.4.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/CHANGELOG.md +35 -0
- package/lib/index.js +15 -1
- package/package.json +2 -2
- package/scripts/media-sync.ts +3 -0
- package/scripts/republish.ts +3 -0
- package/src/components/EntryEditor.lsp +40 -0
- package/src/components/GroupField.lsp +303 -92
- package/src/components/MediaLibrary.lsp +30 -42
- package/src/components/MediaPickerField.lsp +42 -23
- package/src/components/PictureSummary.lsp +188 -0
- package/src/components/PicturesSummary.lsp +69 -0
- package/src/components/RepeaterField.lsp +118 -10
- package/src/config/types.ts +39 -1
- package/src/content/export.ts +27 -1
- package/src/content/gathered.ts +103 -0
- package/src/content/glance.ts +249 -0
- package/src/main.ts +5 -1
- package/src/media-library.ts +4 -1
- package/src/server/index.ts +5 -0
- package/src/server/library-routes.ts +76 -3
- package/src/styles/tokens.css +0 -1
|
@@ -1,35 +1,59 @@
|
|
|
1
1
|
<view>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
$value="part.value"
|
|
16
|
-
$options="part.options"
|
|
17
|
-
/>
|
|
2
|
+
<section class="group" $class="{ 'is-error': state.invalid, 'is-full': state.full }" $show="state.shown" $aria-labelledby="state.id + '-title'">
|
|
3
|
+
<div class="group-head">
|
|
4
|
+
<!-- The whole title is the button: it opens the fields, or puts them away
|
|
5
|
+
to whatever closed sections show on this page. -->
|
|
6
|
+
<button class="group-toggle" type="button" $id="state.id + '-title'" $aria-expanded="state.full ? 'true' : 'false'" $aria-controls="state.id + '-body'" @click="toggle()">
|
|
7
|
+
<span class="group-chevron" aria-hidden="true"></span>
|
|
8
|
+
<span class="group-title">{{ props.field.label || props.field.name }}</span>
|
|
9
|
+
|
|
10
|
+
<!-- How the fields inside are doing, from whichever of them can tell:
|
|
11
|
+
a shape, a colour and words, never the colour alone. Said in every
|
|
12
|
+
state, because a problem is not something to open a section to find. -->
|
|
13
|
+
<span class="group-health badge" $class="state.healthClass" $show="state.healthText">
|
|
14
|
+
<span class="icon icon-s" $class="state.healthIcon" aria-hidden="true"></span>{{ state.healthText }}
|
|
18
15
|
</span>
|
|
19
|
-
</span>
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
<span class="icon icon-s" $class="state.healthIcon" aria-hidden="true"></span>{{ state.healthText }}
|
|
25
|
-
</span>
|
|
17
|
+
<span class="group-alert badge badge-danger" $show="state.invalid">
|
|
18
|
+
<span class="icon icon-s icon-alert" aria-hidden="true"></span>{{ state.toFix }} to fix
|
|
19
|
+
</span>
|
|
26
20
|
|
|
27
|
-
|
|
28
|
-
<span class="
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
<!-- One line of what is inside, for the state that shows nothing else. -->
|
|
22
|
+
<span class="group-line" $show="state.mode === 'minimal'">
|
|
23
|
+
<span class="peek-part" $for="part in state.peek" $key="part.key">
|
|
24
|
+
<span $show="part.text">{{ part.text }}</span>
|
|
25
|
+
<Dynamic $if="part.component" $is="part.component" $value="part.value" $options="part.options" />
|
|
26
|
+
</span>
|
|
27
|
+
</span>
|
|
28
|
+
</button>
|
|
29
|
+
|
|
30
|
+
<div class="group-density" role="group" $aria-label="'How much of ' + (props.field.label || props.field.name) + ' to show'">
|
|
31
|
+
<button type="button" $aria-pressed="state.mode === 'minimal' ? 'true' : 'false'" aria-label="Minimal" title="Minimal: one line" @click="show('minimal')">
|
|
32
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true"><path d="M4 12h16"></path></svg>
|
|
33
|
+
</button>
|
|
34
|
+
<button type="button" $aria-pressed="state.mode === 'summary' ? 'true' : 'false'" aria-label="Summary" title="Summary: what's in it at a glance" @click="show('summary')">
|
|
35
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true"><path d="M4 8h16M4 13h10M4 18h12"></path></svg>
|
|
36
|
+
</button>
|
|
37
|
+
<button type="button" $aria-pressed="state.full ? 'true' : 'false'" aria-label="Full" title="Full: edit everything" @click="show('full')">
|
|
38
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="4" y="4" width="16" height="16" rx="2"></rect><path d="M4 10h16"></path></svg>
|
|
39
|
+
</button>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
31
42
|
|
|
32
|
-
|
|
43
|
+
<!-- A glance: what is inside, read-only. Each row is words or a summary
|
|
44
|
+
component, so every section's summary looks and reads the same. -->
|
|
45
|
+
<div class="group-glance" $if="state.mode === 'summary'">
|
|
46
|
+
<div class="glance-row" $for="row in state.glance" $key="row.key" $class="row.label ? '' : 'is-wide'">
|
|
47
|
+
<span class="glance-label" $if="row.label">{{ row.label }}</span>
|
|
48
|
+
<span class="glance-text" $if="row.text">{{ row.text }}</span>
|
|
49
|
+
<Dynamic $if="row.component" $is="row.component" $value="row.value" $options="row.options" />
|
|
50
|
+
</div>
|
|
51
|
+
<p class="subtle" $if="state.glance.length === 0">Nothing here yet.</p>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<!-- Kept in the page while shut, as a closed disclosure keeps its content:
|
|
55
|
+
a field that is not drawn cannot say what is wrong with it. -->
|
|
56
|
+
<div class="group-fields" $id="state.id + '-body'" $show="state.full">
|
|
33
57
|
<!-- The same registry again, and the same `values`: a group arranges the
|
|
34
58
|
form, it is not a level in the entry. Its children store exactly where
|
|
35
59
|
they would without it. -->
|
|
@@ -42,13 +66,15 @@
|
|
|
42
66
|
$path="inner.path"
|
|
43
67
|
/>
|
|
44
68
|
</div>
|
|
45
|
-
</
|
|
69
|
+
</section>
|
|
46
70
|
</view>
|
|
47
71
|
|
|
48
72
|
<logic lang="ts">
|
|
49
73
|
import { defineProps, reactive, onMounted, onUnmounted, onUpdate, shared } from '@lightspeed-js/core'
|
|
50
74
|
import { componentFor, dataFields } from '../config/components.ts'
|
|
51
75
|
import { resolveParts } from '../content/summary.ts'
|
|
76
|
+
import { gatherAt } from '../content/entry.ts'
|
|
77
|
+
import { REST, THIS_BROWSER, defaultGlance, defaultPeek, memoryKey, readMemory, startingMode, writeMemory } from '../content/glance.ts'
|
|
52
78
|
import { watchShown } from '../components/visibility.ts'
|
|
53
79
|
|
|
54
80
|
/**
|
|
@@ -68,12 +94,12 @@ const props = defineProps({
|
|
|
68
94
|
function shape() {
|
|
69
95
|
// A group is not a level in the entry, so its children's paths are siblings
|
|
70
96
|
// of its own - the same flattening `dataFields` does for validation.
|
|
71
|
-
const
|
|
97
|
+
const before = props.path.split('.').slice(0, -1)
|
|
72
98
|
|
|
73
99
|
return (props.field.fields || []).map((field) => ({
|
|
74
100
|
name: field.name,
|
|
75
101
|
field,
|
|
76
|
-
path:
|
|
102
|
+
path: before.concat(field.name).join('.'),
|
|
77
103
|
component: componentFor(field),
|
|
78
104
|
}))
|
|
79
105
|
}
|
|
@@ -81,8 +107,11 @@ function shape() {
|
|
|
81
107
|
// Built at setup rather than on mount: the children are what this component
|
|
82
108
|
// is, and a pass with none of them renders an empty box.
|
|
83
109
|
const state = reactive({
|
|
110
|
+
id: 'group-' + props.path.replace(/[^a-z0-9]+/gi, '-'),
|
|
84
111
|
fields: shape(),
|
|
85
|
-
|
|
112
|
+
mode: 'full',
|
|
113
|
+
full: true,
|
|
114
|
+
glance: [],
|
|
86
115
|
invalid: false,
|
|
87
116
|
toFix: 0,
|
|
88
117
|
healthText: '',
|
|
@@ -97,67 +126,109 @@ const state = reactive({
|
|
|
97
126
|
* waiting for a change it has already missed is a peek that stays empty
|
|
98
127
|
* until somebody types.
|
|
99
128
|
*/
|
|
100
|
-
peek:
|
|
129
|
+
peek: [],
|
|
101
130
|
})
|
|
102
131
|
|
|
103
132
|
watchShown(props.field, props.path, shared, (shown) => {
|
|
104
133
|
state.shown = shown
|
|
105
134
|
})
|
|
106
135
|
|
|
136
|
+
const prefix = () => props.path.split('.').slice(0, -1)
|
|
137
|
+
|
|
107
138
|
/**
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
* Values come from the cells rather than from what was saved, so a group shut
|
|
111
|
-
* after a change previews the change. The same resolver the server uses for a
|
|
112
|
-
* collection summary, so a part means one thing on both sides of the wire.
|
|
139
|
+
* What the fields inside hold, as they are being *edited*.
|
|
113
140
|
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
141
|
+
* Gathered from the cells rather than from what was saved, so a section put
|
|
142
|
+
* away after a change shows the change. Every cell read is listened to from
|
|
143
|
+
* then on: an update callback runs when *this* component updates, and a field
|
|
144
|
+
* inside writing a value is not that.
|
|
117
145
|
*/
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
if (!parts || !parts.length) return []
|
|
121
|
-
|
|
122
|
-
const children = dataFields(props.field.fields || [])
|
|
123
|
-
const prefix = props.path.split('.').slice(0, -1)
|
|
146
|
+
const heard = new Set()
|
|
147
|
+
let queued = false
|
|
124
148
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
149
|
+
function hearing(key) {
|
|
150
|
+
if (!heard.has(key)) {
|
|
151
|
+
heard.add(key)
|
|
152
|
+
shared(key).subscribe(soon)
|
|
128
153
|
}
|
|
154
|
+
return shared(key).value
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function soon() {
|
|
158
|
+
if (queued) return
|
|
159
|
+
queued = true
|
|
160
|
+
queueMicrotask(() => {
|
|
161
|
+
queued = false
|
|
162
|
+
rebuild()
|
|
163
|
+
})
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function held() {
|
|
167
|
+
const before = prefix()
|
|
168
|
+
return gatherAt(props.field.fields || [], before.length ? before.join('.') + '.' : '', hearing)
|
|
169
|
+
}
|
|
129
170
|
|
|
171
|
+
/**
|
|
172
|
+
* A component part naming a reference gets `to` filled in from the field it
|
|
173
|
+
* draws: the field already knows what it points at, and a config should not
|
|
174
|
+
* have to say it twice.
|
|
175
|
+
*/
|
|
176
|
+
function resolved(parts, values) {
|
|
177
|
+
const children = dataFields(props.field.fields || [])
|
|
130
178
|
const filled = parts.map((part) => {
|
|
131
179
|
if (typeof part === 'string' || !part.from) return part
|
|
132
|
-
|
|
133
180
|
const field = children.find((one) => one.name === part.from)
|
|
134
181
|
if (!field || field.type !== 'reference') return part
|
|
135
|
-
|
|
136
182
|
return { ...part, options: { to: field.to, ...(part.options || {}) } }
|
|
137
183
|
})
|
|
184
|
+
// Parts have no identity of their own; position is what the row is.
|
|
185
|
+
return resolveParts(filled, values).map((part, index) => ({ ...part, key: String(index) }))
|
|
186
|
+
}
|
|
138
187
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
})
|
|
188
|
+
/** The one line: the group's own `peek`, or the first few things it holds. */
|
|
189
|
+
function peek(values) {
|
|
190
|
+
const parts = props.field.peek
|
|
191
|
+
if (parts && parts.length) return resolved(parts, values)
|
|
192
|
+
return defaultPeek(props.field.fields || [], values, { registered: window.telaComponents })
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* The glance: the group's own `glance`, or each field that holds something.
|
|
197
|
+
* A summary that cannot be worked out is the default one, said in the console,
|
|
198
|
+
* never a form that will not draw.
|
|
199
|
+
*/
|
|
200
|
+
function glance(values) {
|
|
201
|
+
const parts = props.field.glance
|
|
202
|
+
if (parts && parts.length) {
|
|
203
|
+
try {
|
|
204
|
+
return resolved(parts, values).map((part) => ({ label: '', ...part }))
|
|
205
|
+
} catch (error) {
|
|
206
|
+
console.warn('[tela] The summary of "' + (props.field.label || props.field.name) + '" failed, so the default is shown.', error)
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return defaultGlance(props.field.fields || [], values, { registered: window.telaComponents })
|
|
144
210
|
}
|
|
145
211
|
|
|
146
212
|
/** Whether anything inside needs attention, so a closed group can say so. */
|
|
147
213
|
function rebuild() {
|
|
148
214
|
state.fields = shape()
|
|
149
|
-
state.
|
|
215
|
+
state.full = state.mode === 'full'
|
|
216
|
+
if (!state.full) {
|
|
217
|
+
const values = held()
|
|
218
|
+
state.peek = state.mode === 'minimal' ? peek(values) : []
|
|
219
|
+
state.glance = state.mode === 'summary' ? glance(values) : []
|
|
220
|
+
}
|
|
150
221
|
|
|
151
222
|
const all = issues.value || {}
|
|
152
|
-
const
|
|
223
|
+
const before = prefix()
|
|
153
224
|
|
|
154
225
|
state.toFix = dataFields(props.field.fields || []).filter((field) => {
|
|
155
|
-
const status = all[
|
|
226
|
+
const status = all[before.concat(field.name).join('.')]
|
|
156
227
|
return status && status.status === 'error'
|
|
157
228
|
}).length
|
|
158
229
|
state.invalid = state.toFix > 0
|
|
159
230
|
|
|
160
|
-
const worst = healthOf(props.field.fields || [],
|
|
231
|
+
const worst = healthOf(props.field.fields || [], before)
|
|
161
232
|
state.healthText = worst ? worst.text : ''
|
|
162
233
|
state.healthClass = worst ? HEALTH[worst.tone].badge : ''
|
|
163
234
|
state.healthIcon = worst ? HEALTH[worst.tone].icon : ''
|
|
@@ -165,7 +236,10 @@ function rebuild() {
|
|
|
165
236
|
// An error inside a closed group is an error you have to go looking for. As
|
|
166
237
|
// with a repeater row: only where nobody has decided, so a group somebody
|
|
167
238
|
// shut stays shut.
|
|
168
|
-
if (state.invalid && decided === false
|
|
239
|
+
if (state.invalid && decided === false && !state.full) {
|
|
240
|
+
state.mode = 'full'
|
|
241
|
+
state.full = true
|
|
242
|
+
}
|
|
169
243
|
}
|
|
170
244
|
|
|
171
245
|
const HEALTH = {
|
|
@@ -191,46 +265,77 @@ let decided = false
|
|
|
191
265
|
const issues = shared('entry:issues', {})
|
|
192
266
|
issues.subscribe(rebuild)
|
|
193
267
|
|
|
194
|
-
// The peek reads the children's cells, so it has to hear them change - an
|
|
195
|
-
// update callback runs when *this* component updates, and a sibling field
|
|
196
|
-
// writing a value is not that.
|
|
197
|
-
for (const field of dataFields(props.field.fields || [])) {
|
|
198
|
-
const prefix = props.path.split('.').slice(0, -1)
|
|
199
|
-
shared('entry:value:' + prefix.concat(field.name).join('.')).subscribe(rebuild)
|
|
200
|
-
}
|
|
201
|
-
|
|
202
268
|
// Any field inside may say how it is doing, layout fields included.
|
|
203
269
|
for (const field of props.field.fields || []) {
|
|
204
|
-
|
|
205
|
-
shared('entry:health:' + prefix.concat(field.name).join('.')).subscribe(rebuild)
|
|
270
|
+
shared('entry:health:' + prefix().concat(field.name).join('.')).subscribe(rebuild)
|
|
206
271
|
}
|
|
207
272
|
|
|
208
|
-
|
|
273
|
+
/**
|
|
274
|
+
* How closed sections rest on this page, and what this person last chose.
|
|
275
|
+
*
|
|
276
|
+
* The page's choice is one cell every group hears; a group's own state is
|
|
277
|
+
* remembered per person and per collection, in the browser.
|
|
278
|
+
*/
|
|
279
|
+
const pageRest = shared('groups:rest', '')
|
|
280
|
+
const everyGroup = shared('groups:all', null)
|
|
281
|
+
const route = (shared('route').value || {}).params || {}
|
|
282
|
+
const remembers = memoryKey(THIS_BROWSER, route.collection || '')
|
|
283
|
+
const storage = typeof localStorage === 'undefined' ? undefined : localStorage
|
|
284
|
+
|
|
285
|
+
const rest = () => pageRest.value || readMemory(storage, remembers).rest || props.field.rest || REST
|
|
286
|
+
|
|
287
|
+
function show(mode, remember = true) {
|
|
209
288
|
decided = true
|
|
210
|
-
state.
|
|
289
|
+
state.mode = mode
|
|
290
|
+
if (remember) {
|
|
291
|
+
const memory = readMemory(storage, remembers)
|
|
292
|
+
writeMemory(storage, remembers, { ...memory, modes: { ...memory.modes, [props.field.name]: mode } })
|
|
293
|
+
}
|
|
294
|
+
rebuild()
|
|
211
295
|
}
|
|
212
296
|
|
|
297
|
+
const toggle = () => show(state.full ? rest() : 'full')
|
|
298
|
+
|
|
299
|
+
state.mode = startingMode({
|
|
300
|
+
remembered: readMemory(storage, remembers).modes[props.field.name],
|
|
301
|
+
collapsed: props.field.collapsed === true,
|
|
302
|
+
existing: Boolean(route.id) && route.id !== 'new',
|
|
303
|
+
rest: rest(),
|
|
304
|
+
})
|
|
305
|
+
state.full = state.mode === 'full'
|
|
306
|
+
|
|
307
|
+
pageRest.subscribe(() => {
|
|
308
|
+
if (!state.full) show(rest(), false)
|
|
309
|
+
})
|
|
310
|
+
everyGroup.subscribe(() => {
|
|
311
|
+
const asked = everyGroup.value
|
|
312
|
+
if (asked) show(asked.to === 'full' ? 'full' : rest())
|
|
313
|
+
})
|
|
314
|
+
|
|
213
315
|
function holds(path) {
|
|
214
|
-
const
|
|
316
|
+
const before = prefix()
|
|
215
317
|
|
|
216
318
|
return dataFields(props.field.fields || []).some((field) => {
|
|
217
|
-
const mine =
|
|
319
|
+
const mine = before.concat(field.name).join('.')
|
|
218
320
|
return path === mine || path.startsWith(mine + '.')
|
|
219
321
|
})
|
|
220
322
|
}
|
|
221
323
|
|
|
222
324
|
function reveal(event) {
|
|
223
325
|
const path = (event.detail && event.detail.path) || ''
|
|
224
|
-
if (path === props.path || holds(path))
|
|
326
|
+
if (path === props.path || holds(path)) show('full', false)
|
|
225
327
|
}
|
|
226
328
|
|
|
227
|
-
onMounted(() =>
|
|
329
|
+
onMounted(() => {
|
|
330
|
+
window.addEventListener('tela:reveal', reveal)
|
|
331
|
+
rebuild()
|
|
332
|
+
})
|
|
228
333
|
onUnmounted(() => window.removeEventListener('tela:reveal', reveal))
|
|
229
334
|
|
|
230
335
|
onUpdate(rebuild)
|
|
231
336
|
</logic>
|
|
232
337
|
|
|
233
|
-
<style
|
|
338
|
+
<style>
|
|
234
339
|
.group {
|
|
235
340
|
border: 1px solid var(--border);
|
|
236
341
|
border-radius: var(--r-l);
|
|
@@ -241,44 +346,144 @@ onUpdate(rebuild)
|
|
|
241
346
|
border: 2px solid var(--danger);
|
|
242
347
|
}
|
|
243
348
|
|
|
244
|
-
.group-
|
|
349
|
+
.group-head {
|
|
245
350
|
display: flex;
|
|
246
351
|
align-items: center;
|
|
247
352
|
gap: var(--sp-3);
|
|
248
|
-
min-height:
|
|
249
|
-
padding:
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
353
|
+
min-height: 60px;
|
|
354
|
+
padding: 6px var(--sp-2) 6px 6px;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.group-toggle {
|
|
358
|
+
display: flex;
|
|
359
|
+
flex: 1;
|
|
360
|
+
align-items: center;
|
|
361
|
+
gap: var(--sp-3);
|
|
362
|
+
min-width: 0;
|
|
363
|
+
min-height: 48px;
|
|
364
|
+
padding: 0 var(--sp-3);
|
|
365
|
+
border: 0;
|
|
366
|
+
border-radius: var(--r-m);
|
|
367
|
+
background: transparent;
|
|
253
368
|
color: var(--text);
|
|
369
|
+
font: inherit;
|
|
370
|
+
text-align: left;
|
|
371
|
+
cursor: pointer;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.group-toggle:hover {
|
|
375
|
+
background: var(--surface-hover);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.group-toggle:focus-visible,
|
|
379
|
+
.group-density button:focus-visible {
|
|
380
|
+
outline: 3px solid var(--focus);
|
|
381
|
+
outline-offset: 2px;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/* Pointing right when shut, down when open: the direction people read as
|
|
385
|
+
"there is more this way". Two borders, so it takes the text's colour. */
|
|
386
|
+
.group-chevron {
|
|
387
|
+
flex: none;
|
|
388
|
+
width: 0.4rem;
|
|
389
|
+
height: 0.4rem;
|
|
390
|
+
border-right: 2px solid currentColor;
|
|
391
|
+
border-bottom: 2px solid currentColor;
|
|
392
|
+
transform: rotate(-45deg);
|
|
393
|
+
opacity: 0.45;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
.group.is-full .group-chevron {
|
|
397
|
+
transform: rotate(45deg);
|
|
254
398
|
}
|
|
255
399
|
|
|
256
400
|
.group-title {
|
|
257
401
|
flex: none;
|
|
402
|
+
font-weight: var(--fw-semibold);
|
|
403
|
+
white-space: nowrap;
|
|
258
404
|
}
|
|
259
405
|
|
|
260
|
-
|
|
261
|
-
.group-peek {
|
|
262
|
-
flex: 1;
|
|
406
|
+
.group-line {
|
|
263
407
|
display: flex;
|
|
264
|
-
flex-wrap: wrap;
|
|
265
|
-
justify-content: flex-end;
|
|
266
408
|
align-items: center;
|
|
267
409
|
gap: var(--sp-2);
|
|
410
|
+
overflow: hidden;
|
|
268
411
|
min-width: 0;
|
|
412
|
+
color: var(--text-2);
|
|
269
413
|
font-size: var(--fs-s);
|
|
270
414
|
font-weight: var(--fw-regular);
|
|
271
|
-
|
|
415
|
+
white-space: nowrap;
|
|
416
|
+
text-overflow: ellipsis;
|
|
272
417
|
}
|
|
273
418
|
|
|
274
419
|
.peek-part {
|
|
275
420
|
display: inline-flex;
|
|
276
421
|
align-items: center;
|
|
422
|
+
overflow: hidden;
|
|
423
|
+
min-width: 0;
|
|
424
|
+
text-overflow: ellipsis;
|
|
277
425
|
}
|
|
278
426
|
|
|
279
|
-
.
|
|
427
|
+
/* The parts of a line are told apart by a dot between them. */
|
|
428
|
+
.peek-part + .peek-part::before {
|
|
429
|
+
content: "·";
|
|
430
|
+
margin-right: var(--sp-2);
|
|
431
|
+
color: var(--text-3);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
.group-density {
|
|
435
|
+
display: inline-flex;
|
|
280
436
|
flex: none;
|
|
281
|
-
|
|
437
|
+
padding: 3px;
|
|
438
|
+
border: 1px solid var(--border);
|
|
439
|
+
border-radius: var(--r-m);
|
|
440
|
+
background: var(--surface-2);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
.group-density button {
|
|
444
|
+
display: grid;
|
|
445
|
+
place-items: center;
|
|
446
|
+
width: 36px;
|
|
447
|
+
height: 32px;
|
|
448
|
+
border: 0;
|
|
449
|
+
border-radius: var(--r-s);
|
|
450
|
+
background: transparent;
|
|
451
|
+
color: var(--text-3);
|
|
452
|
+
cursor: pointer;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
.group-density button[aria-pressed="true"] {
|
|
456
|
+
background: var(--surface);
|
|
457
|
+
color: var(--text);
|
|
458
|
+
box-shadow: var(--shadow-1);
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
.group-glance {
|
|
462
|
+
display: flex;
|
|
463
|
+
flex-direction: column;
|
|
464
|
+
gap: var(--sp-3);
|
|
465
|
+
padding: 0 var(--sp-4) var(--sp-4) calc(var(--sp-4) + var(--sp-3) + 0.4rem);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
.glance-row {
|
|
469
|
+
display: grid;
|
|
470
|
+
grid-template-columns: minmax(100px, 180px) minmax(0, 1fr);
|
|
471
|
+
align-items: baseline;
|
|
472
|
+
gap: var(--sp-2) var(--sp-4);
|
|
473
|
+
font-size: var(--fs-s);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
.glance-row.is-wide {
|
|
477
|
+
grid-template-columns: minmax(0, 1fr);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
.glance-label {
|
|
481
|
+
color: var(--text-3);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
.glance-text {
|
|
485
|
+
color: var(--text);
|
|
486
|
+
overflow-wrap: anywhere;
|
|
282
487
|
}
|
|
283
488
|
|
|
284
489
|
.group-fields {
|
|
@@ -287,4 +492,10 @@ onUpdate(rebuild)
|
|
|
287
492
|
gap: var(--sp-4);
|
|
288
493
|
padding: 0 var(--sp-4) var(--sp-4);
|
|
289
494
|
}
|
|
495
|
+
|
|
496
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
497
|
+
.group-chevron {
|
|
498
|
+
transition: transform 0.12s ease;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
290
501
|
</style>
|
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
<view>
|
|
2
|
-
<div class="
|
|
3
|
-
<div class="
|
|
4
|
-
<
|
|
5
|
-
<h1>Media</h1>
|
|
6
|
-
<p class="muted about">Pictures from the shared library. Words and crops you change here show everywhere a picture is used.</p>
|
|
7
|
-
</div>
|
|
8
|
-
</div>
|
|
2
|
+
<div class="library">
|
|
3
|
+
<div class="notices" $show="state.canUpload || state.error">
|
|
4
|
+
<MediaUpload $if="state.canUpload" $collection="'media'" />
|
|
9
5
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<p>{{ state.error }}</p>
|
|
6
|
+
<div class="callout callout-danger" role="alert" $show="state.error">
|
|
7
|
+
<span class="icon icon-alert tone-danger" aria-hidden="true"></span>
|
|
8
|
+
<p>{{ state.error }}</p>
|
|
9
|
+
</div>
|
|
15
10
|
</div>
|
|
16
11
|
|
|
17
|
-
<!-- The
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
<div class="
|
|
22
|
-
<
|
|
23
|
-
<AssetInspector />
|
|
12
|
+
<!-- The library's own frame: its bar, the pictures, and the editor that
|
|
13
|
+
opens over them. A field's picker shows the same pictures in a dialog;
|
|
14
|
+
somebody here is looking at the library, not answering a question
|
|
15
|
+
about one entry. -->
|
|
16
|
+
<div class="frame px" $show="state.ready">
|
|
17
|
+
<LibraryFrame />
|
|
24
18
|
</div>
|
|
25
19
|
</div>
|
|
26
20
|
</view>
|
|
@@ -85,35 +79,29 @@ uploaded.subscribe(() => {
|
|
|
85
79
|
</logic>
|
|
86
80
|
|
|
87
81
|
<style>
|
|
82
|
+
/* Edge to edge in the main area: the frame brings its own bar and gutters. */
|
|
88
83
|
.library {
|
|
89
|
-
|
|
84
|
+
flex: 1;
|
|
85
|
+
display: flex;
|
|
86
|
+
flex-direction: column;
|
|
87
|
+
min-width: 0;
|
|
90
88
|
}
|
|
91
89
|
|
|
92
|
-
.
|
|
93
|
-
|
|
94
|
-
|
|
90
|
+
.notices {
|
|
91
|
+
display: flex;
|
|
92
|
+
flex-direction: column;
|
|
93
|
+
gap: var(--sp-4);
|
|
94
|
+
padding: var(--sp-5) var(--sp-6) 0;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
gap: var(--sp-5);
|
|
103
|
-
align-items: start;
|
|
104
|
-
padding-top: var(--sp-4);
|
|
105
|
-
border-top: 1px solid var(--border);
|
|
97
|
+
.frame {
|
|
98
|
+
flex: 1;
|
|
99
|
+
display: flex;
|
|
100
|
+
flex-direction: column;
|
|
101
|
+
--px-frame-gutter: var(--sp-6);
|
|
106
102
|
}
|
|
107
103
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
grid-template-columns: minmax(0, 1fr) 22rem;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
.body > :last-child {
|
|
114
|
-
position: sticky;
|
|
115
|
-
top: var(--sp-5);
|
|
116
|
-
max-height: calc(100vh - 2 * var(--sp-5));
|
|
117
|
-
}
|
|
104
|
+
.frame > * {
|
|
105
|
+
flex: 1;
|
|
118
106
|
}
|
|
119
107
|
</style>
|