@museumwnf/viewer-layout 2.18.0 → 3.1.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.
@@ -0,0 +1,407 @@
1
+ import { l as e, y as t } from "./TimelineEventList-BhkWyY5-.js";
2
+ import { Fragment as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, createVNode as l, mergeProps as u, normalizeClass as d, openBlock as f, ref as p, renderList as m, renderSlot as h, resolveDynamicComponent as g, toDisplayString as _, unref as v, vModelSelect as y, vModelText as b, watch as x, withCtx as S, withDirectives as C, withKeys as w } from "vue";
3
+ import { useI18n as T } from "@museumwnf/viewer-core/i18n";
4
+ import { md as E, mdInline as D, searchGlossary as ee } from "@museumwnf/viewer-core";
5
+ import { useRouter as O } from "vue-router";
6
+ //#region src/content/BackLink.vue
7
+ var k = ["href"], A = {
8
+ class: "mwnf-back-bar__arrow",
9
+ "aria-hidden": "true"
10
+ }, te = {
11
+ key: 1,
12
+ class: "mwnf-back-link"
13
+ }, ne = {
14
+ __name: "BackLink",
15
+ props: {
16
+ label: {
17
+ type: String,
18
+ default: "core.action.back"
19
+ },
20
+ to: {
21
+ type: [String, Object],
22
+ default: null
23
+ },
24
+ href: {
25
+ type: String,
26
+ default: ""
27
+ },
28
+ variant: {
29
+ type: String,
30
+ default: "button",
31
+ validator: (e) => ["button", "bar"].includes(e)
32
+ },
33
+ arrow: {
34
+ type: String,
35
+ default: "←"
36
+ }
37
+ },
38
+ setup(e) {
39
+ let n = O(), a = e, l = r(() => !!(a.to || a.href));
40
+ function u() {
41
+ return window.history.state?.back != null || !l.value && window.history.length > 1;
42
+ }
43
+ function d() {
44
+ u() && n.back();
45
+ }
46
+ let p = r(() => a.to && n ? n.resolve(a.to).href : a.href || (typeof a.to == "string" ? a.to : "") || "#");
47
+ function m(e) {
48
+ e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || (u() ? (e.preventDefault(), n.back()) : a.to && n ? (e.preventDefault(), n.push(a.to)) : l.value || e.preventDefault());
49
+ }
50
+ return (n, r) => e.variant === "bar" ? (f(), o("a", {
51
+ key: 0,
52
+ href: p.value,
53
+ class: "mwnf-back-bar mwnf-back-bar--link",
54
+ onClick: m
55
+ }, [
56
+ s("span", A, _(e.arrow), 1),
57
+ r[0] ||= c(),
58
+ h(n.$slots, "default", {}, () => [c(_(n.$t(e.label)), 1)])
59
+ ], 8, k)) : (f(), o("div", te, [l.value && !u() ? (f(), i(t, {
60
+ key: 0,
61
+ to: e.to,
62
+ href: e.href,
63
+ class: "mwnf-back-link__button"
64
+ }, {
65
+ default: S(() => [c(" ↩ " + _(n.$t(e.label)), 1)]),
66
+ _: 1
67
+ }, 8, ["to", "href"])) : (f(), o("button", {
68
+ key: 1,
69
+ class: "mwnf-back-link__button",
70
+ onClick: d
71
+ }, " ↩ " + _(n.$t(e.label)), 1))]));
72
+ }
73
+ }, j = ["dir"], M = { class: "mwnf-glossary-tool__toggle" }, N = { class: "mwnf-glossary-tool__panel" }, P = { class: "mwnf-glossary-tool__heading" }, F = { class: "mwnf-glossary-tool__instructions" }, I = ["aria-expanded", "aria-label"], L = {
74
+ key: 0,
75
+ class: "mwnf-glossary-tool__hits",
76
+ role: "listbox"
77
+ }, R = [
78
+ "aria-selected",
79
+ "onClick",
80
+ "onKeydown"
81
+ ], z = {
82
+ key: 1,
83
+ class: "mwnf-glossary-tool__no-results"
84
+ }, B = {
85
+ key: 2,
86
+ class: "mwnf-glossary-tool__definition"
87
+ }, V = { class: "mwnf-glossary-tool__definition-label" }, H = ["innerHTML"], U = {
88
+ __name: "GlossaryTool",
89
+ props: {
90
+ language: {
91
+ type: String,
92
+ default: ""
93
+ },
94
+ entity: {
95
+ type: String,
96
+ default: "glossary"
97
+ },
98
+ labels: {
99
+ type: Object,
100
+ default: () => ({})
101
+ },
102
+ dir: {
103
+ type: String,
104
+ default: ""
105
+ }
106
+ },
107
+ setup(e) {
108
+ let t = e, i = {
109
+ tool: "record.glossary.tool",
110
+ heading: "record.glossary.heading",
111
+ instructions: "record.glossary.instructions",
112
+ definition: "record.glossary.definition",
113
+ close: "record.glossary.close",
114
+ ...t.labels
115
+ }, { t: c } = T(), l = p(""), u = p(null), h = p(-1), g = r(() => l.value.trim() ? ee(l.value, t.language, { entity: t.entity }) : []), y = r(() => g.value.length > 0 && !u.value), x = r(() => u.value ? E(u.value.definition) : ""), S = r(() => i.noResults ? c(i.noResults) : ""), D = r(() => !!S.value && l.value.trim() && !u.value && g.value.length === 0);
116
+ function O() {
117
+ u.value = null, h.value = -1;
118
+ }
119
+ function k(e) {
120
+ u.value = e, l.value = e.spelling, h.value = -1;
121
+ }
122
+ function A(e) {
123
+ y.value && (e.key === "ArrowDown" ? (e.preventDefault(), h.value = (h.value + 1) % g.value.length) : e.key === "ArrowUp" ? (e.preventDefault(), h.value = (h.value - 1 + g.value.length) % g.value.length) : e.key === "Enter" && h.value >= 0 ? (e.preventDefault(), k(g.value[h.value])) : e.key === "Escape" && (h.value = -1));
124
+ }
125
+ return (t, r) => (f(), o("details", {
126
+ class: "mwnf-glossary-tool",
127
+ dir: e.dir || void 0
128
+ }, [s("summary", M, _(v(c)(i.tool)), 1), s("div", N, [
129
+ s("p", P, _(v(c)(i.heading)), 1),
130
+ s("p", F, _(v(c)(i.instructions)), 1),
131
+ C(s("input", {
132
+ "onUpdate:modelValue": r[0] ||= (e) => l.value = e,
133
+ type: "text",
134
+ class: "mwnf-glossary-tool__input",
135
+ role: "combobox",
136
+ "aria-autocomplete": "list",
137
+ "aria-expanded": y.value,
138
+ "aria-label": v(c)(i.heading),
139
+ onInput: O,
140
+ onKeydown: A
141
+ }, null, 40, I), [[b, l.value]]),
142
+ y.value ? (f(), o("ul", L, [(f(!0), o(n, null, m(g.value, (e, t) => (f(), o("li", {
143
+ key: e.id,
144
+ role: "option",
145
+ "aria-selected": t === h.value,
146
+ tabindex: "0",
147
+ class: d(["mwnf-glossary-tool__hit", { "mwnf-glossary-tool__hit--active": t === h.value }]),
148
+ onClick: (t) => k(e),
149
+ onKeydown: w((t) => k(e), ["enter"])
150
+ }, _(e.spelling), 43, R))), 128))])) : D.value ? (f(), o("p", z, _(S.value), 1)) : a("", !0),
151
+ u.value ? (f(), o("div", B, [s("p", V, _(v(c)(i.definition)), 1), s("div", {
152
+ class: "mwnf-sheet__block",
153
+ innerHTML: x.value
154
+ }, null, 8, H)])) : a("", !0)
155
+ ])], 8, j));
156
+ }
157
+ }, W = ["dir"], G = ["innerHTML"], K = { class: "mwnf-dynasty__body" }, q = { class: "mwnf-dynasty__eyebrow" }, J = {
158
+ key: 0,
159
+ class: "mwnf-dynasty__field"
160
+ }, Y = { class: "mwnf-dynasty__label" }, X = {
161
+ key: 1,
162
+ class: "mwnf-dynasty__field"
163
+ }, Z = { class: "mwnf-dynasty__label" }, re = {
164
+ key: 2,
165
+ class: "mwnf-dynasty__dates"
166
+ }, ie = {
167
+ key: 3,
168
+ class: "mwnf-dynasty__history"
169
+ }, ae = { class: "mwnf-dynasty__label" }, oe = ["innerHTML"], Q = {
170
+ __name: "DynastyPopout",
171
+ props: {
172
+ dynasty: {
173
+ type: Object,
174
+ required: !0
175
+ },
176
+ text: {
177
+ type: Object,
178
+ default: () => ({})
179
+ },
180
+ dir: {
181
+ type: String,
182
+ default: ""
183
+ }
184
+ },
185
+ setup(e) {
186
+ let t = e, { t: n } = T(), i = r(() => {
187
+ let { from_ad: e, to_ad: n, from_ah: r, to_ah: i } = t.dynasty ?? {};
188
+ return e == null && n == null ? "" : `${r != null || i != null ? `AH ${r ?? "?"}–${i ?? "?"} / ` : ""}AD ${e ?? "?"}–${n ?? "?"}`;
189
+ });
190
+ return (t, r) => (f(), o("details", {
191
+ class: "mwnf-dynasty",
192
+ dir: e.dir || void 0
193
+ }, [s("summary", {
194
+ class: "mwnf-dynasty__summary",
195
+ innerHTML: v(D)(e.text.name || e.dynasty.id)
196
+ }, null, 8, G), s("div", K, [
197
+ s("p", q, _(v(n)("record.dynasty.heading")), 1),
198
+ e.text.also_known_as ? (f(), o("p", J, [s("span", Y, _(v(n)("sheet.field.alsoKnownAs")) + ":", 1), c(" " + _(e.text.also_known_as), 1)])) : a("", !0),
199
+ e.text.area ? (f(), o("p", X, [s("span", Z, _(v(n)("sheet.field.area")) + ":", 1), c(" " + _(e.text.area), 1)])) : a("", !0),
200
+ i.value ? (f(), o("p", re, _(i.value), 1)) : a("", !0),
201
+ e.text.history ? (f(), o("div", ie, [s("p", ae, _(v(n)("sheet.field.history")), 1), s("div", {
202
+ class: "mwnf-sheet__block",
203
+ innerHTML: v(E)(e.text.history)
204
+ }, null, 8, oe)])) : a("", !0)
205
+ ])], 8, W));
206
+ }
207
+ }, se = ["dir"], ce = {
208
+ key: 0,
209
+ class: "mwnf-dynasty-list__heading"
210
+ }, le = {
211
+ __name: "DynastyList",
212
+ props: {
213
+ heading: {
214
+ type: String,
215
+ default: ""
216
+ },
217
+ dynasties: {
218
+ type: Array,
219
+ default: () => []
220
+ },
221
+ tr: {
222
+ type: Function,
223
+ default: null
224
+ },
225
+ dir: {
226
+ type: String,
227
+ default: ""
228
+ }
229
+ },
230
+ setup(e) {
231
+ return (t, r) => e.dynasties.length ? (f(), o("section", {
232
+ key: 0,
233
+ class: "mwnf-dynasty-list",
234
+ dir: e.dir || void 0
235
+ }, [e.heading ? (f(), o("h2", ce, _(e.heading), 1)) : a("", !0), (f(!0), o(n, null, m(e.dynasties, (t) => (f(), i(Q, {
236
+ key: t.id,
237
+ dynasty: t,
238
+ text: e.tr ? e.tr(t) : t,
239
+ dir: e.dir
240
+ }, null, 8, [
241
+ "dynasty",
242
+ "text",
243
+ "dir"
244
+ ]))), 128))], 8, se)) : a("", !0);
245
+ }
246
+ }, ue = { class: "mwnf-sheet-timeline" }, de = {
247
+ key: 0,
248
+ class: "mwnf-sheet-timeline__popout",
249
+ dir: "ltr"
250
+ }, fe = ["aria-label"], pe = { class: "mwnf-sheet-timeline__title" }, me = { class: "mwnf-sheet-timeline__option" }, he = ["value"], ge = { class: "mwnf-sheet-timeline__scroll" }, _e = { class: "mwnf-sheet-timeline__subheader" }, ve = {
251
+ key: 0,
252
+ class: "mwnf-sheet-timeline__empty"
253
+ }, ye = { class: "mwnf-sheet-timeline__date" }, be = ["innerHTML"], $ = {
254
+ __name: "TimelineLookup",
255
+ props: { info: {
256
+ type: Object,
257
+ required: !0
258
+ } },
259
+ setup(e) {
260
+ let i = e, { t: u } = T(), d = p(!1), h = p(i.info.defaultCountry ? i.info.defaultCountry() : "all");
261
+ x(() => i.info, (e) => {
262
+ h.value = e.defaultCountry ? e.defaultCountry() : "all";
263
+ });
264
+ let g = r(() => i.info.range ?? [null, null]), b = r(() => i.info.events(h.value)), w = r(() => i.info.countries.find((e) => e.value === h.value)?.label ?? ""), D = (e) => i.info.era ? i.info.era(e) : String(e ?? "");
265
+ return (r, i) => (f(), o("div", ue, [s("p", {
266
+ class: "mwnf-sheet-timeline__trigger",
267
+ onClick: i[0] ||= (e) => d.value = !d.value
268
+ }, "➤ " + _(v(u)(e.info.trigger ?? "record.related.timelineForItem")), 1), d.value ? (f(), o("div", de, [
269
+ s("button", {
270
+ type: "button",
271
+ class: "mwnf-sheet-timeline__close",
272
+ "aria-label": v(u)("core.action.close"),
273
+ onClick: i[1] ||= (e) => d.value = !1
274
+ }, "✕", 8, fe),
275
+ s("p", pe, _(v(u)(e.info.heading)), 1),
276
+ s("div", me, [C(s("select", {
277
+ "onUpdate:modelValue": i[2] ||= (e) => h.value = e,
278
+ class: "mwnf-sheet-timeline__select"
279
+ }, [(f(!0), o(n, null, m(e.info.countries, (e) => (f(), o("option", {
280
+ key: e.value,
281
+ value: e.value
282
+ }, _(e.label), 9, he))), 128))], 512), [[y, h.value]]), l(t, {
283
+ class: "mwnf-sheet-timeline__link",
284
+ to: e.info.searchTo(h.value, g.value)
285
+ }, {
286
+ default: S(() => [c("➤ " + _(v(u)("timeline.action.beginFullSearch")), 1)]),
287
+ _: 1
288
+ }, 8, ["to"])]),
289
+ s("div", ge, [
290
+ s("p", _e, _(w.value) + ", " + _(D(g.value[0])) + " – " + _(D(g.value[1])), 1),
291
+ b.value.length ? a("", !0) : (f(), o("p", ve, _(v(u)("timeline.results.noEvents")), 1)),
292
+ (f(!0), o(n, null, m(b.value, (e, t) => (f(), o("div", {
293
+ key: e.id ?? t,
294
+ class: "mwnf-sheet-timeline__event"
295
+ }, [s("div", ye, _(D(e.year_from)), 1), s("div", {
296
+ class: "mwnf-sheet-timeline__description",
297
+ innerHTML: v(E)(e.text.description)
298
+ }, null, 8, be)]))), 128))
299
+ ])
300
+ ])) : a("", !0)]));
301
+ }
302
+ }, xe = ["href"], Se = {
303
+ key: 0,
304
+ class: "mwnf-related-media__description"
305
+ }, Ce = {
306
+ __name: "RelatedMedia",
307
+ props: {
308
+ media: {
309
+ type: Array,
310
+ default: () => []
311
+ },
312
+ language: {
313
+ type: String,
314
+ default: ""
315
+ },
316
+ descriptions: {
317
+ type: Boolean,
318
+ default: !0
319
+ },
320
+ heading: {
321
+ type: String,
322
+ default: "record.related.audioVideo"
323
+ },
324
+ dir: {
325
+ type: String,
326
+ default: ""
327
+ }
328
+ },
329
+ setup(t) {
330
+ let c = t, { t: l } = T(), u = r(() => {
331
+ let e = c.media.filter((e) => e?.url);
332
+ if (!c.language) return e;
333
+ let t = e.filter((e) => e.language === c.language);
334
+ return t.length ? t : e;
335
+ });
336
+ return (r, c) => u.value.length ? (f(), i(e, {
337
+ key: 0,
338
+ heading: t.heading ? v(l)(t.heading) : "",
339
+ dir: t.dir,
340
+ class: "mwnf-related-media"
341
+ }, {
342
+ default: S(() => [(f(!0), o(n, null, m(u.value, (e) => (f(), o("div", {
343
+ key: e.url,
344
+ class: "mwnf-related-media__entry"
345
+ }, [s("a", {
346
+ href: e.url,
347
+ target: "_blank",
348
+ rel: "noopener",
349
+ class: "mwnf-related-media__link"
350
+ }, "↗ " + _(e.title || e.url), 9, xe), t.descriptions && e.description ? (f(), o("p", Se, _(e.description), 1)) : a("", !0)]))), 128))]),
351
+ _: 1
352
+ }, 8, ["heading", "dir"])) : a("", !0);
353
+ }
354
+ }, we = {
355
+ key: 0,
356
+ class: "mwnf-on-display__subheading"
357
+ }, Te = { class: "mwnf-on-display__list" }, Ee = ["innerHTML"], De = ["innerHTML"], Oe = { class: "mwnf-on-display__pending" }, ke = {
358
+ __name: "OnDisplayIn",
359
+ props: {
360
+ groups: {
361
+ type: Array,
362
+ default: () => []
363
+ },
364
+ heading: {
365
+ type: String,
366
+ default: "record.related.onDisplayIn"
367
+ },
368
+ pendingLabel: {
369
+ type: String,
370
+ default: ""
371
+ },
372
+ dir: {
373
+ type: String,
374
+ default: ""
375
+ }
376
+ },
377
+ setup(l) {
378
+ let d = l, { t: p } = T(), h = r(() => d.groups.filter((e) => e.links?.length));
379
+ return (r, d) => h.value.length ? (f(), i(g(l.heading ? e : "div"), u({ key: 0 }, l.heading ? { heading: v(p)(l.heading) } : {}, {
380
+ dir: l.dir || void 0,
381
+ class: "mwnf-on-display"
382
+ }), {
383
+ default: S(() => [(f(!0), o(n, null, m(h.value, (e, r) => (f(), o("div", {
384
+ key: e.heading ?? r,
385
+ class: "mwnf-on-display__group"
386
+ }, [e.heading ? (f(), o("p", we, _(v(p)(e.heading)), 1)) : a("", !0), s("ul", Te, [(f(!0), o(n, null, m(e.links, (e, r) => (f(), o("li", {
387
+ key: e.id ?? r,
388
+ class: "mwnf-on-display__item"
389
+ }, [e.to || e.href ? (f(), i(t, {
390
+ key: 0,
391
+ to: e.to,
392
+ href: e.href,
393
+ external: !!e.external
394
+ }, {
395
+ default: S(() => [e.external ? (f(), o(n, { key: 0 }, [c("↗ ")], 64)) : a("", !0), s("span", { innerHTML: e.label }, null, 8, Ee)]),
396
+ _: 2
397
+ }, 1032, [
398
+ "to",
399
+ "href",
400
+ "external"
401
+ ])) : (f(), o(n, { key: 1 }, [s("span", { innerHTML: e.label }, null, 8, De), l.pendingLabel ? (f(), o(n, { key: 0 }, [d[0] ||= c(_(" "), -1), s("span", Oe, _(v(p)(l.pendingLabel)), 1)], 64)) : a("", !0)], 64))]))), 128))])]))), 128))]),
402
+ _: 1
403
+ }, 16, ["dir"])) : a("", !0);
404
+ }
405
+ };
406
+ //#endregion
407
+ export { Q as a, le as i, Ce as n, U as o, $ as r, ne as s, ke as t };