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