@museumwnf/viewer-layout 3.67.1 → 3.68.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@museumwnf/viewer-layout",
3
- "version": "3.67.1",
3
+ "version": "3.68.0",
4
4
  "description": "Page structure for MWNF websites: PageShell composing seven optional, token-styled sections, the content components a page is made of, and the composed views a website names instead of writing a page.",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -167,26 +167,26 @@ function searchTests(mountSite, loadItems) {
167
167
  }, 30000)
168
168
  }
169
169
 
170
- // A record related to an item but outside this site's own package is listed
171
- // with its project, not as a bare legacy code. Nothing to check in a package
172
- // whose related records are all its own.
173
- function outsideReferenceTest(mountSite, manifest, sharedTexts) {
174
- it('names the project of a related record outside this site', async () => {
170
+ // Legacy's Related Objects: every related object a thumbnail under "Related
171
+ // Objects", those outside this site's package too (inventory-app#2491). One
172
+ // outside whose project has a site of its own links to it there.
173
+ function relatedObjectsTest(mountSite, manifest, sharedTexts) {
174
+ it('draws every related object as a thumbnail, those outside the gallery too', async () => {
175
175
  const [items] = await loadEntities(['items'])
176
176
  const item = items.find((i) => (i.related_items ?? []).some((ref) => ref.in_package === false))
177
+ ?? items.find((i) => (i.related_items ?? []).length)
177
178
  if (!item) return
178
- const projects = item.related_items
179
- .filter((ref) => ref.in_package === false)
180
- .map((ref) => manifest.projects[ref.project_id]?.name?.en)
181
- const notHere = sharedTexts.en['gallery.results.notInThisGallery']
182
- const { app, host } = await mountSite(`#/item/${item.id}`)
183
- const outsideRow = () => [...host.querySelectorAll('.mwnf-sheet-related__references li')]
184
- .find((li) => li.textContent.includes(notHere))
185
- await vi.waitFor(() => expect(outsideRow()).toBeTruthy(), WAIT)
186
- const row = outsideRow()
187
- expect(row.querySelector('.mwnf-chip')).not.toBeNull()
188
- expect(projects).toContain(row.textContent.replace(notHere, '').trim())
189
- expect(row.querySelector('code')).toBeNull()
179
+ const { app, host } = await mountSite(`#/item/${item.id}?lang=en`)
180
+ await vi.waitFor(() => expect(host.querySelector('.mwnf-related-objects__tile')).not.toBeNull(), WAIT)
181
+ const block = host.querySelector('.mwnf-related-objects')
182
+ expect(block.querySelector('.mwnf-related-objects__heading').textContent).toBe(sharedTexts.en['gallery.related.objects'])
183
+ expect(block.querySelectorAll('.mwnf-related-objects__tile')).toHaveLength(item.related_items.length)
184
+ const outside = item.related_items.find((ref) => ref.in_package === false && manifest.projects[ref.project_id]?.home_site)
185
+ if (outside) {
186
+ const hrefs = [...block.querySelectorAll('.mwnf-related-objects__link')].map((a) => a.getAttribute('href') ?? '')
187
+ expect(hrefs.some((href) => href.endsWith(`/item/${outside.id}`))).toBe(true)
188
+ }
189
+ expect(host.querySelector('.mwnf-sheet-related__references')).toBeNull()
190
190
  app.unmount()
191
191
  }, 60000)
192
192
  }
@@ -363,7 +363,7 @@ export function describeGallerySmoke({ config, sharedTexts, ownTexts, manifest,
363
363
  app.unmount()
364
364
  }, 60000)
365
365
 
366
- outsideReferenceTest(mountSite, manifest, sharedTexts)
366
+ relatedObjectsTest(mountSite, manifest, sharedTexts)
367
367
 
368
368
  // The Source box takes the colour `projectColors` gives the item's
369
369
  // project, and the citation its name from the manifest.
@@ -1,552 +0,0 @@
1
- import { i as e, n as t, o as n, r, s as i, t as a } from "./OnDisplayIn-BH3Bqope.js";
2
- import { c as o, r as s } from "./PartnerMap-DdyMLtgH.js";
3
- import { n as c } from "./TimelineEventList-CIkKxyQu.js";
4
- import { t as l } from "./RecordView-Bgd5mm_e.js";
5
- import { t as u } from "./chrome-Bv_mLlHM.js";
6
- import { Fragment as d, computed as f, createBlock as p, createCommentVNode as m, createElementBlock as h, createElementVNode as g, createSlots as _, createTextVNode as v, createVNode as y, guardReactiveProps as b, normalizeClass as x, normalizeProps as S, normalizeStyle as C, openBlock as w, renderList as T, renderSlot as E, toDisplayString as D, unref as O, useSlots as ee, withCtx as k } from "vue";
7
- import { NotFoundView as te, byId as A, loadEntities as ne, mdInline as j, mdStrip as re, mwnfLinks as M, partnerView as ie, renderInline as N, siblingSiteUrl as P, sourceUrl as F, useDataPackage as I, useI18n as ae, useProjects as L, useSiteConfig as R } from "@museumwnf/viewer-core";
8
- import { RouterLink as z, useRoute as B } from "vue-router";
9
- // src/dxa/ItemDetailView.vue
10
- var oe = {
11
- key: 0,
12
- class: "mwnf-sheet-source"
13
- }, se = {
14
- key: 0,
15
- class: "mwnf-sheet-source__line"
16
- }, ce = {
17
- key: 1,
18
- class: "mwnf-sheet-source__collection"
19
- }, le = ["href"], ue = {
20
- key: 1,
21
- class: "mwnf-sheet-notice"
22
- }, de = {
23
- key: "museum",
24
- class: "mwnf-sheet-museum"
25
- }, fe = ["innerHTML"], pe = {
26
- key: 0,
27
- class: "mwnf-sheet-related"
28
- }, me = {
29
- key: 0,
30
- class: "mwnf-sheet-related__heading mwnf-sheet-related__heading--caps"
31
- }, he = {
32
- key: 1,
33
- class: "mwnf-sheet-related__description"
34
- }, ge = {
35
- key: 0,
36
- class: "mwnf-sheet-related__references"
37
- }, _e = {
38
- key: 2,
39
- class: "mwnf-sheet-related__unresolved"
40
- }, ve = {
41
- key: 3,
42
- class: "mwnf-sheet-related__line"
43
- }, ye = ["href"], be = { class: "mwnf-sheet-related__heading" }, xe = ["href"], Se = { key: 9 }, Ce = { class: "mwnf-sheet-related__heading" }, we = { key: 10 }, Te = { class: "mwnf-sheet-related__heading" }, Ee = { class: "mwnf-sheet-related__line" }, De = ["href"], Oe = { key: 11 }, ke = { class: "mwnf-sheet-related__heading" }, Ae = { class: "mwnf-sheet-related__line" }, je = ["href"], Me = { key: 12 }, Ne = { class: "mwnf-sheet-related__heading" }, Pe = "sheet.field.", V = {
44
- __name: "ItemDetailView",
45
- props: {
46
- spec: {
47
- type: Object,
48
- required: !0
49
- },
50
- id: {
51
- type: String,
52
- required: !0
53
- },
54
- entity: {
55
- type: String,
56
- default: ""
57
- },
58
- dataGetter: {
59
- type: Function,
60
- default: null
61
- }
62
- },
63
- setup(i) {
64
- let o = i, N = ee(), P = /* @__PURE__ */ new Set([
65
- "before-sheet",
66
- "museum",
67
- "related",
68
- "aside"
69
- ]), F = f(() => Object.keys(N).filter((e) => !P.has(e))), z = f(() => !o.dataGetter || o.dataGetter(o.id) != null), { t: B } = ae();
70
- function V(e) {
71
- if (typeof e != "string" || !e.startsWith(Pe)) return e;
72
- let t = `sheet.dxa.${e.slice(12)}`;
73
- return B(t) === t ? e : t;
74
- }
75
- let H = f(() => Array.isArray(o.spec.fields) ? {
76
- ...o.spec,
77
- fields: o.spec.fields.map((e) => ({
78
- ...e,
79
- label: V(e.label)
80
- }))
81
- } : o.spec), U = L(), W = (e, t) => (e.name ?? "").localeCompare(t.name ?? ""), G = (e) => (e.gallery_references ?? []).filter((e) => e.kind === "gallery").sort(W), K = (e) => (e.gallery_references ?? []).filter((e) => e.kind === "exhibition").sort(W), q = (e) => U.links(e.project_id)?.artisticIntroductionUrl ?? null, J = (e) => U.links(e.project_id)?.relatedDatabaseUrl ?? null, Y = {
82
- "islamicart.museumwnf.org": "core.project.islamicArt",
83
- "baroqueart.museumwnf.org": "core.project.baroqueArt",
84
- "sharinghistory.museumwnf.org": "core.project.sharingHistory"
85
- };
86
- function X(e) {
87
- try {
88
- let t = Y[new URL(J(e)).host];
89
- if (t) return B(t);
90
- } catch {}
91
- return U.label(e.project_id);
92
- }
93
- function Z(e, t) {
94
- if (!e) return null;
95
- let n = H.value.sourceDatabase === !1 ? null : H.value.sourceDatabase ?? null, r = null;
96
- if (n) {
97
- let i = n.chipClass ? n.chipClass(e, t) : null, a = U.label(e.project_id);
98
- (i || a) && (r = {
99
- chipClass: i,
100
- name: a,
101
- label: B(n.label ?? "record.sheet.sourceDatabase")
102
- });
103
- }
104
- let i = n && n.addToCollection !== !1 ? B(n.addToCollection?.label ?? "record.action.addToCollection") : null, a = H.value.notice === !1 ? null : H.value.notice ?? null, o = a && a.show(e, t) ? B(a.label) : null;
105
- return {
106
- source: r,
107
- addToCollectionLabel: i,
108
- notice: o
109
- };
110
- }
111
- let Q = I(), $ = A("partners"), Fe = A("countries");
112
- ne(["partners", "countries"]), Q.loadTranslations("countries", "en");
113
- function Ie(e, t) {
114
- let n = Q.tr("countries", e, t, "en");
115
- return re(n.name ?? Fe.value?.get(e)?.internal_name ?? "");
116
- }
117
- function Le(e) {
118
- let t = e.text?.holder ? j(String(e.text.holder)) : "", n = H.value.museum === !1 ? null : H.value.museum ?? null, r = n ? $.value?.get(e.record?.partner_id) : null;
119
- return {
120
- holder: t,
121
- view: r ? ie(r, Q.tr("partners", r.id, e.language, "en"), {
122
- countryLabel: (t) => Ie(t, e.language),
123
- route: (t) => n.route ? n.route(t.id, e) : null
124
- }) : null
125
- };
126
- }
127
- function Re(e, t) {
128
- if (!e) return null;
129
- let n = H.value.related ?? {}, r = t.records ?? [], i = t.outside ?? [], a = o.dataGetter ? r.filter((e) => o.dataGetter(e.id) != null) : r, s = o.dataGetter ? r.filter((e) => o.dataGetter(e.id) == null).map((t) => (e.related_items ?? []).find((e) => e.id === t.id)).filter(Boolean) : [], c = [...i, ...s].map((e) => ({
130
- ...e,
131
- name: e.project_id ? U.label(e.project_id) : null,
132
- chipClass: n.outsideChip ? n.outsideChip(e, t) : null
133
- })), l = (t) => (n.onDisplayIn?.href ? n.onDisplayIn.href(t, e) : t.legacy_host) || "", u = (e) => ({
134
- id: e.id,
135
- label: j(e.name ?? ""),
136
- href: l(e),
137
- external: !!l(e)
138
- }), d = n.onDisplayIn && n.onDisplayIn !== !1 ? {
139
- pendingLabel: n.onDisplayIn.linkPendingLabel ?? "",
140
- groups: [n.onDisplayIn.exhibitions ? {
141
- heading: n.onDisplayIn.exhibitionsHeading ?? "record.related.exhibitions",
142
- sections: n.onDisplayIn.exhibitions(e, t)
143
- } : {
144
- heading: n.onDisplayIn.exhibitionsHeading ?? "record.related.exhibitions",
145
- links: K(e).map(u)
146
- }, {
147
- heading: n.onDisplayIn.galleriesHeading ?? "record.related.galleries",
148
- links: G(e).map(u)
149
- }].filter((e) => (e.sections ?? [e]).some((e) => e.links?.length))
150
- } : null, f = n.databaseLabel && J(e) ? {
151
- url: J(e),
152
- label: B(n.databaseLabel),
153
- name: X(e)
154
- } : null, p = n.overallDatabase && n.overallDatabase !== !1 ? {
155
- label: B(n.overallDatabase.label),
156
- linkLabel: B(n.overallDatabase.linkLabel)
157
- } : null;
158
- return {
159
- title: n.title ? B(n.title) : "",
160
- description: n.description ? B(n.description) : "",
161
- heading: B(n.heading ?? "record.related.items"),
162
- variant: n.variant ?? "grid",
163
- actionLabel: n.actionLabel ? B(n.actionLabel) : "",
164
- inPackage: a,
165
- references: c,
166
- notInPackageLabel: n.notInPackageLabel ? B(n.notInPackageLabel) : "",
167
- artisticIntroduction: n.artisticIntroductionLabel && q(e) ? {
168
- url: q(e),
169
- label: B(n.artisticIntroductionLabel)
170
- } : null,
171
- timeline: n.timeline ? n.timeline(e, t) : null,
172
- glossary: n.glossary !== !1,
173
- glossaryLabels: n.glossaryLabels ?? {},
174
- dynasties: n.dynasties ? n.dynasties(e, t.language, t) : null,
175
- dynastiesHeading: B(n.dynastiesHeading ?? "record.dynasty.list"),
176
- media: n.media === !1 ? [] : e.media ?? [],
177
- mediaGroups: n.mediaHeadings && n.media !== !1 ? ["audio", "video"].map((r) => ({
178
- type: r,
179
- heading: B(n.mediaHeadings[r]),
180
- entries: (e.media ?? []).filter((e) => e?.url && e.type === r && (!e.language || !t.language || e.language === t.language))
181
- })).filter((e) => e.entries.length) : null,
182
- onDisplayIn: d,
183
- database: f,
184
- overallDatabase: p,
185
- download: n.download === !1 ? null : {
186
- label: B("record.action.download"),
187
- pdfLabel: B("record.action.downloadPdf")
188
- }
189
- };
190
- }
191
- let ze = R(), Be = f(() => {
192
- let e = u(ze.chrome, "world.png");
193
- return e ? { "--mwnf-dxa-glossary-image": `url("${e}")` } : null;
194
- });
195
- function Ve() {
196
- window.print();
197
- }
198
- return (o, u) => z.value ? (w(), p(l, {
199
- key: 0,
200
- spec: H.value,
201
- id: i.id,
202
- entity: i.entity,
203
- style: C(Be.value)
204
- }, _({
205
- "before-sheet": k((e) => [E(o.$slots, "before-sheet", S(b(e)), () => [(w(!0), h(d, null, T([Z(e.record, e)], (t) => (w(), h(d, { key: "before-sheet" }, [t?.source || t?.addToCollectionLabel ? (w(), h("div", oe, [t.source ? (w(), h("p", se, [t.source.chipClass ? (w(), h("span", {
206
- key: 0,
207
- class: x(["mwnf-chip", t.source.chipClass]),
208
- "aria-hidden": "true"
209
- }, null, 2)) : m("", !0), t.source.name ? (w(), h(d, { key: 1 }, [v(D(t.source.label) + ": " + D(t.source.name), 1)], 64)) : m("", !0)])) : m("", !0), t.addToCollectionLabel ? (w(), h("p", ce, [g("a", {
210
- href: O(M).myCollection,
211
- target: "_blank",
212
- rel: "noopener"
213
- }, "↗ " + D(t.addToCollectionLabel), 9, le)])) : m("", !0)])) : m("", !0), t?.notice ? (w(), h("div", ue, [v(D(t.notice) + " ", 1), g("strong", null, [g("em", null, D(e.languages.map((e) => e.label).join(", ")), 1)])])) : m("", !0)], 64))), 128))])]),
214
- museum: k((e) => [E(o.$slots, "museum", S(b(e)), () => [(w(!0), h(d, null, T([Le(e)], (t) => (w(), h("div", de, [t.holder ? (w(), h("p", {
215
- key: 0,
216
- class: "mwnf-sheet-museum__holder",
217
- innerHTML: t.holder
218
- }, null, 8, fe)) : m("", !0), t.view ? (w(), p(c, {
219
- key: 1,
220
- variant: "summary",
221
- partner: t.view,
222
- label: "partner.info.about",
223
- dir: e.dir
224
- }, null, 8, ["partner", "dir"])) : m("", !0)]))), 128))])]),
225
- related: k(() => []),
226
- aside: k((i) => [E(o.$slots, "related", S(b(i)), () => [(w(!0), h(d, null, T([Re(i.record, i)], (o) => (w(), h(d, { key: i.record?.id ?? "related" }, [o ? (w(), h("div", pe, [
227
- o.title ? (w(), h("p", me, D(o.title), 1)) : m("", !0),
228
- o.description ? (w(), h("p", he, D(o.description), 1)) : m("", !0),
229
- o.inPackage.length || o.references.length ? (w(), p(s, {
230
- key: 2,
231
- heading: o.heading,
232
- records: o.inPackage,
233
- variant: o.variant,
234
- "action-label": o.actionLabel
235
- }, {
236
- default: k(() => [o.references.length ? (w(), h("ul", ge, [(w(!0), h(d, null, T(o.references, (e) => (w(), h("li", { key: e.id }, [
237
- e.chipClass ? (w(), h("span", {
238
- key: 0,
239
- class: x(["mwnf-chip", e.chipClass]),
240
- "aria-hidden": "true"
241
- }, null, 2)) : m("", !0),
242
- e.name ? (w(), h(d, { key: 1 }, [v(D(e.name), 1)], 64)) : m("", !0),
243
- o.notInPackageLabel ? (w(), h("span", _e, D(o.notInPackageLabel), 1)) : m("", !0)
244
- ]))), 128))])) : m("", !0)]),
245
- _: 2
246
- }, 1032, [
247
- "heading",
248
- "records",
249
- "variant",
250
- "action-label"
251
- ])) : m("", !0),
252
- o.artisticIntroduction ? (w(), h("p", ve, [g("a", {
253
- href: o.artisticIntroduction.url,
254
- target: "_blank",
255
- rel: "noopener"
256
- }, "↗ " + D(o.artisticIntroduction.label), 9, ye)])) : m("", !0),
257
- o.timeline ? (w(), p(r, {
258
- key: i.record.id,
259
- info: o.timeline
260
- }, null, 8, ["info"])) : m("", !0),
261
- o.glossary ? (w(), p(n, {
262
- key: 5,
263
- language: i.language,
264
- labels: o.glossaryLabels,
265
- dir: i.dir
266
- }, null, 8, [
267
- "language",
268
- "labels",
269
- "dir"
270
- ])) : m("", !0),
271
- o.dynasties?.records?.length ? (w(), p(e, {
272
- key: 6,
273
- heading: o.dynastiesHeading,
274
- dynasties: o.dynasties.records,
275
- tr: o.dynasties.tr,
276
- dir: i.dir
277
- }, null, 8, [
278
- "heading",
279
- "dynasties",
280
- "tr",
281
- "dir"
282
- ])) : m("", !0),
283
- o.mediaGroups ? (w(!0), h(d, { key: 7 }, T(o.mediaGroups, (e) => (w(), h("div", {
284
- key: e.type,
285
- class: x(["mwnf-sheet-related__media", `mwnf-sheet-related__media--${e.type}`])
286
- }, [g("p", be, D(e.heading), 1), (w(!0), h(d, null, T(e.entries, (e) => (w(), h("p", {
287
- key: e.url,
288
- class: "mwnf-sheet-related__line"
289
- }, [g("a", {
290
- href: e.url,
291
- target: "_blank",
292
- rel: "noopener"
293
- }, "↗ " + D(e.title || e.url), 9, xe)]))), 128))], 2))), 128)) : (w(), p(t, {
294
- key: 8,
295
- media: o.media,
296
- language: i.language,
297
- descriptions: !1,
298
- dir: i.dir
299
- }, null, 8, [
300
- "media",
301
- "language",
302
- "dir"
303
- ])),
304
- o.onDisplayIn?.groups.length ? (w(), h("div", Se, [g("p", Ce, D(O(B)("record.related.onDisplayIn")), 1), y(a, {
305
- heading: "",
306
- groups: o.onDisplayIn.groups,
307
- "pending-label": o.onDisplayIn.pendingLabel,
308
- dir: i.dir
309
- }, null, 8, [
310
- "groups",
311
- "pending-label",
312
- "dir"
313
- ])])) : m("", !0),
314
- o.database ? (w(), h("div", we, [g("p", Te, D(o.database.label), 1), g("p", Ee, [g("a", {
315
- href: o.database.url,
316
- target: "_blank",
317
- rel: "noopener"
318
- }, "↗ " + D(o.database.name), 9, De)])])) : m("", !0),
319
- o.overallDatabase ? (w(), h("div", Oe, [g("p", ke, D(o.overallDatabase.label), 1), g("p", Ae, [g("a", {
320
- href: O(M).overallDatabase,
321
- target: "_blank",
322
- rel: "noopener"
323
- }, "↗ " + D(o.overallDatabase.linkLabel), 9, je)])])) : m("", !0),
324
- o.download ? (w(), h("div", Me, [g("p", Ne, D(o.download.label), 1), g("p", {
325
- class: "mwnf-sheet-related__line mwnf-sheet-related__line--action",
326
- onClick: Ve
327
- }, "➤ " + D(o.download.pdfLabel), 1)])) : m("", !0)
328
- ])) : m("", !0)], 64))), 128))])]),
329
- _: 2
330
- }, [T(F.value, (e) => ({
331
- name: e,
332
- fn: k((t) => [E(o.$slots, e, S(b(t)))])
333
- }))]), 1032, [
334
- "spec",
335
- "id",
336
- "entity",
337
- "style"
338
- ])) : (w(), p(O(te), { key: 1 }));
339
- }
340
- }, H = "mwnf-on-display__theme", U = (e) => N(e ?? ""), W = (e) => e?.titles?.en ?? Object.values(e?.titles ?? {})[0] ?? "", G = (e) => `<span class="${H}">${e}</span>`;
341
- function K(e, t, n) {
342
- return n && e.site === n ? {
343
- id: e.path,
344
- label: t,
345
- to: e.path
346
- } : {
347
- id: `${e.site}${e.path}`,
348
- label: t,
349
- href: P(e.site, e.path),
350
- external: !0
351
- };
352
- }
353
- function q(e) {
354
- return e.toLowerCase().split(" ").filter((e) => ![
355
- "a",
356
- "an",
357
- "the"
358
- ].includes(e)).join(" ");
359
- }
360
- function J(e, t, n = null) {
361
- let r = e?.exhibition_references ?? [], i = [], a = r.filter((e) => e.list === "virtual" || e.list === "sharing_history");
362
- a.length && i.push({
363
- caption: a[0].project ? U(a[0].project.name) : "",
364
- links: a.map((e) => K(e, [
365
- U(W(e.exhibition)),
366
- G(U(W(e.theme))),
367
- ...e.subtheme ? [G(U(W(e.subtheme)))] : []
368
- ].join(" | "), n))
369
- });
370
- let o = r.filter((e) => e.list === "exhibition"), s = o.filter((e) => e.exhibition?.titles?.[t]), c = s.length ? {
371
- refs: s,
372
- lang: t
373
- } : {
374
- refs: o.filter((e) => e.exhibition?.titles?.en),
375
- lang: "en"
376
- }, l = (e) => e?.titles?.[c.lang] ?? e?.titles?.en ?? "", u = [...c.refs].sort((e, t) => q(l(e.exhibition)).localeCompare(q(l(t.exhibition)), "en", { sensitivity: "base" }) || (e.legacy_order?.[0] ?? 0) - (t.legacy_order?.[0] ?? 0));
377
- for (let e of u) {
378
- let t = U(l(e.exhibition)), r = K(e, `${U(l(e.theme))} | ${G(U(l(e.subtheme)))}`, n), a = i[i.length - 1];
379
- a?.exhibition === e.exhibition.id ? a.links.push(r) : i.push({
380
- exhibition: e.exhibition.id,
381
- caption: t,
382
- links: [r]
383
- });
384
- }
385
- return i;
386
- }
387
- // src/dxa/LegacyItemSheet.vue
388
- var Y = { class: "mwnf-dxa-item__languages" }, X = ["dir"], Z = ["href"], Q = ["href"], $ = ["innerHTML"], Fe = ["innerHTML"], Ie = ["dir"], Le = { class: "mwnf-dxa-gallery-item__label" }, Re = {
389
- key: "citation",
390
- class: "mwnf-dxa-gallery-item__citation"
391
- }, ze = { class: "mwnf-dxa-gallery-item__project" }, Be = { class: "mwnf-dxa-gallery-item__address" }, Ve = { class: "mwnf-dxa-gallery-item__credit-label" }, He = {
392
- key: 1,
393
- class: "mwnf-dxa-gallery-item__number"
394
- }, Ue = { class: "mwnf-dxa-gallery-item__number-label" }, We = ["href"], Ge = {
395
- __name: "LegacyItemSheet",
396
- props: {
397
- id: {
398
- type: String,
399
- required: !0
400
- },
401
- itemDetail: {
402
- type: Object,
403
- required: !0
404
- },
405
- dataGetter: {
406
- type: Function,
407
- default: null
408
- },
409
- words: {
410
- type: Object,
411
- required: !0
412
- }
413
- },
414
- setup(e) {
415
- let t = e, { t: n } = ae(), r = B(), a = L(), s = I(), c = R(), l = f(() => ({
416
- ...t.itemDetail,
417
- sourceDatabase: !1,
418
- sourceCredit: !1,
419
- mediaThumbsFrom: 1,
420
- mediaCreditCaption: !1,
421
- shortDescriptionLabels: {
422
- view: t.words.viewShortDescription,
423
- hide: t.words.hideShortDescription
424
- },
425
- related: {
426
- ...t.itemDetail.related,
427
- glossaryLabels: { tool: t.words.glossary },
428
- dynastiesHeading: t.words.dynasties,
429
- mediaHeadings: {
430
- audio: t.words.relatedAudio,
431
- video: t.words.relatedVideos
432
- },
433
- onDisplayIn: {
434
- ...t.itemDetail.related?.onDisplayIn,
435
- exhibitionsHeading: t.words.exhibitions,
436
- galleriesHeading: "core.project.galleries",
437
- href: (e, t) => e.site ? P(e.site, `/item/${t.id}`) : e.legacy_host,
438
- exhibitions: (e, t) => J(e, t.language, s.manifest?.site?.key)
439
- }
440
- }
441
- }));
442
- function u(e) {
443
- let t = a.links(e?.project_id)?.homeSite;
444
- return (t && t !== s.manifest?.site?.key ? P(t, `/item/${e.id}`) : null) ?? F(r);
445
- }
446
- function _(e) {
447
- try {
448
- let { host: t, pathname: n } = new URL(e), r = n.split("/").find(Boolean);
449
- return r ? `${t}/${r}` : t;
450
- } catch {
451
- return e;
452
- }
453
- }
454
- let b = (e) => c.projectColors?.[e?.project_id] ?? "";
455
- function S(e, t) {
456
- let n = a.label(t?.project_id) ?? "", r = n ? e.indexOf(` ${n},`) : -1;
457
- return r < 0 ? {
458
- before: e,
459
- project: "",
460
- after: ""
461
- } : {
462
- before: e.slice(0, r + 1),
463
- project: n,
464
- after: e.slice(r + 1 + n.length)
465
- };
466
- }
467
- function C(e) {
468
- return {
469
- to: t.itemDetail.museum?.route?.(e.record?.partner_id) ?? null,
470
- holder: e.text?.holder ? j(String(e.text.holder)) : ""
471
- };
472
- }
473
- return (t, r) => (w(), p(V, {
474
- spec: l.value,
475
- id: e.id,
476
- "data-getter": e.dataGetter,
477
- class: "mwnf-dxa-item mwnf-dxa-gallery-item"
478
- }, {
479
- header: k(({ languages: e, language: t, select: n }) => [g("div", Y, [y(o, {
480
- languages: e,
481
- language: t,
482
- from: 1,
483
- onSelect: n
484
- }, null, 8, [
485
- "languages",
486
- "language",
487
- "onSelect"
488
- ])]), y(i)]),
489
- "after-media": k(({ record: e, dir: t }) => [e ? (w(), h("div", {
490
- key: 0,
491
- class: "mwnf-dxa-gallery-item__links",
492
- dir: t || void 0
493
- }, [g("p", null, [g("a", {
494
- href: u(e),
495
- target: "_blank",
496
- rel: "noopener"
497
- }, [r[0] ||= g("span", {
498
- class: "mwnf-dxa-gallery-item__icon",
499
- "aria-hidden": "true"
500
- }, "↗", -1), g("bdi", null, [v(D(O(n)("record.source.label")) + " ", 1), g("span", null, "(" + D(_(u(e))) + ")", 1)])], 8, Z)]), g("p", null, [g("a", {
501
- href: O(M).myCollection,
502
- target: "_blank",
503
- rel: "noopener"
504
- }, [r[1] ||= g("span", {
505
- class: "mwnf-dxa-gallery-item__icon",
506
- "aria-hidden": "true"
507
- }, "↗", -1), v(D(O(n)("record.action.addToCollection")), 1)], 8, Q)])], 8, X)) : m("", !0)]),
508
- museum: k((e) => [(w(!0), h(d, null, T([C(e)], (e) => (w(), h(d, { key: "museum" }, [e.to && e.holder ? (w(), p(O(z), {
509
- key: 0,
510
- to: e.to,
511
- class: "mwnf-dxa-gallery-item__museum"
512
- }, {
513
- default: k(() => [r[2] ||= g("span", {
514
- class: "mwnf-dxa-gallery-item__icon",
515
- "aria-hidden": "true"
516
- }, "↗", -1), g("span", { innerHTML: e.holder }, null, 8, $)]),
517
- _: 2
518
- }, 1032, ["to"])) : e.holder ? (w(), h("span", {
519
- key: 1,
520
- innerHTML: e.holder
521
- }, null, 8, Fe)) : m("", !0)], 64))), 128))]),
522
- credits: k(({ record: t, credits: r, workingNumber: i, citation: a, dir: o }) => [t ? (w(), h("div", {
523
- key: 0,
524
- class: "mwnf-dxa-gallery-item__credits",
525
- dir: o || void 0
526
- }, [
527
- a ? (w(), h(d, { key: 0 }, [g("p", Le, D(O(n)("record.citation.ofThisPage")), 1), (w(!0), h(d, null, T([S(a, t)], (e) => (w(), h("p", Re, [
528
- v(D(e.before), 1),
529
- g("span", ze, D(e.project), 1),
530
- v(D(e.after) + " ", 1),
531
- g("span", Be, D(u(t)), 1)
532
- ]))), 128))], 64)) : m("", !0),
533
- (w(!0), h(d, null, T(r, (e) => (w(), h("p", {
534
- key: e.label,
535
- class: "mwnf-dxa-gallery-item__credit"
536
- }, [g("span", Ve, D(e.label), 1), g("span", null, D(e.value), 1)]))), 128)),
537
- i ? (w(), h("p", He, [g("span", Ue, D(O(n)(e.words.workingNumber)), 1), v(D(" ") + D(i), 1)])) : m("", !0),
538
- g("div", { class: x(["mwnf-dxa-gallery-item__source", b(t)]) }, [g("p", null, D(O(n)("record.source.label")), 1), g("p", null, [g("a", {
539
- href: u(t),
540
- target: "_blank",
541
- rel: "noopener"
542
- }, D(u(t)), 9, We)])], 2)
543
- ], 8, Ie)) : m("", !0)]),
544
- _: 1
545
- }, 8, [
546
- "spec",
547
- "id",
548
- "data-getter"
549
- ]));
550
- }
551
- };
552
- export { V as n, Ge as t };