@museumwnf/viewer-layout 3.78.0 → 3.80.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/README.md +46 -0
- package/dist/dxa.js +818 -781
- package/dist/minisite.js +3 -3
- package/package.json +3 -3
- package/src/dxa/testing.js +65 -41
package/dist/minisite.js
CHANGED
|
@@ -803,7 +803,7 @@ var st = { class: "mwnf-minisite-download" }, ct = ["src"], lt = ["src"], ut = [
|
|
|
803
803
|
}, nn = { class: "mwnf-minisite-credits" }, rn = ["innerHTML"], an = {
|
|
804
804
|
__name: "Credits",
|
|
805
805
|
setup(e) {
|
|
806
|
-
let { data: t, root: n, text: r, title: a } = Ve(), o = i(() => n.value ? t.md(r(n.value.id).extra?.
|
|
806
|
+
let { data: t, root: n, text: r, title: a } = Ve(), o = i(() => n.value ? t.md(r(n.value.id).extra?.exhibition_credits) : "");
|
|
807
807
|
return (e, t) => (p(), s("div", nn, [c("h1", null, y(b(a)), 1), c("div", { innerHTML: o.value }, null, 8, rn)]));
|
|
808
808
|
}
|
|
809
809
|
}, on = { class: "mwnf-minisite-map" }, sn = { key: 0 }, cn = ["src"], ln = {
|
|
@@ -2461,7 +2461,7 @@ var ro = { class: "mwnf-baroqueart-home" }, io = { class: "mwnf-baroqueart-home_
|
|
|
2461
2461
|
partnerName: (e) => m.tr("partners", e, d.value).name,
|
|
2462
2462
|
partnerCountry: (e) => m.partnerById.value.get(e)?.country_id,
|
|
2463
2463
|
countryName: (e) => m.tr("countries", e, d.value).name
|
|
2464
|
-
}), F = (e) => Me(e, E.partnerHref), I = i(() => h.value ? x(h.value.id).extra?.
|
|
2464
|
+
}), F = (e) => Me(e, E.partnerHref), I = i(() => h.value ? x(h.value.id).extra?.exhibition_credits ?? "" : ""), L = i(() => E.design ?? null), R = i(() => D(E.banner)), z = i(() => D(d.value === "ar" ? "legacy/home_bg_ar.jpg" : "legacy/home_bg.jpg"));
|
|
2465
2465
|
return S([T, d], () => {
|
|
2466
2466
|
document.title = [t("identity.windowTitle"), T.value].filter(Boolean).join(" | ");
|
|
2467
2467
|
}, { immediate: !0 }), (e, i) => {
|
|
@@ -3027,7 +3027,7 @@ var Ts = ["innerHTML"], Es = ["innerHTML"], Ds = ["innerHTML"], Os = ["innerHTML
|
|
|
3027
3027
|
}, null, 8, Ds),
|
|
3028
3028
|
c("div", {
|
|
3029
3029
|
class: "mwnf-artintro-home__credits",
|
|
3030
|
-
innerHTML: b(a).mdInline(E.value.extra?.
|
|
3030
|
+
innerHTML: b(a).mdInline(E.value.extra?.exhibition_credits ?? "")
|
|
3031
3031
|
}, null, 8, Os),
|
|
3032
3032
|
c("div", ks, [(p(!0), s(n, null, g(k.value, ({ theme: e, number: t }) => (p(), s("div", { key: e.id }, [u(r, { to: {
|
|
3033
3033
|
name: "page",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@museumwnf/viewer-layout",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.80.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",
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"test": "vitest run"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@museumwnf/viewer-core": "^2.
|
|
49
|
+
"@museumwnf/viewer-core": "^2.24.0",
|
|
50
50
|
"vue": "^3.5.0",
|
|
51
51
|
"vue-router": "^4.5.0 || ^5.0.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@museumwnf/viewer-core": "^2.
|
|
54
|
+
"@museumwnf/viewer-core": "^2.24.0",
|
|
55
55
|
"@vitejs/plugin-vue": "^6.0.10",
|
|
56
56
|
"@vue/test-utils": "^2.5.1",
|
|
57
57
|
"jsdom": "^30.1.3",
|
package/src/dxa/testing.js
CHANGED
|
@@ -678,11 +678,16 @@ export function describeExhibitionSmoke({
|
|
|
678
678
|
}) {
|
|
679
679
|
const { messages, mountSite } = mounter(config, sharedTexts, ownTexts)
|
|
680
680
|
const loadItems = async () => (await loadEntities(['exhibition', 'items']))[1]
|
|
681
|
+
// The site's own hidden partners when its config lists them, else the
|
|
682
|
+
// package's (inventory-app#2727).
|
|
681
683
|
const visiblePartners = async () => {
|
|
682
684
|
const [exhibition, partners] = await loadEntities(['exhibition', 'partners'])
|
|
683
|
-
const hidden = new Set(exhibition.hidden_partner_ids ?? [])
|
|
685
|
+
const hidden = new Set(config.exhibition?.hiddenPartners ?? exhibition.hidden_partner_ids ?? [])
|
|
684
686
|
return partners.filter((p) => !hidden.has(p.id))
|
|
685
687
|
}
|
|
688
|
+
// A site that never had legacy addresses leaves the redirects out
|
|
689
|
+
// (`legacyRoutes: false`).
|
|
690
|
+
const hasLegacyRoutes = (config.legacyRoutes ?? []).length > 0
|
|
686
691
|
const datedItem = async () => (await loadItems()).find((i) => Number.isFinite(i.start_date) && i.country_id)
|
|
687
692
|
|
|
688
693
|
describe('exhibition smoke test', () => {
|
|
@@ -750,9 +755,11 @@ export function describeExhibitionSmoke({
|
|
|
750
755
|
expect(!!host.querySelector(`a[href="${drawnAs(project.related_database_url)}"]`)).toBe(!!project.related_database_url)
|
|
751
756
|
expect(!!host.querySelector(`a[href="${drawnAs(project.artistic_introduction_url)}"]`)).toBe(!!project.artistic_introduction_url)
|
|
752
757
|
expect(!!host.querySelector('.mwnf-sheet-notice')).toBe(noticeProjects.includes(item.project_id))
|
|
753
|
-
// Every project needs its chip colour, or the chip
|
|
754
|
-
// layout's default swatch.
|
|
755
|
-
|
|
758
|
+
// Every project the package places needs its chip colour, or the chip
|
|
759
|
+
// falls back to the layout's default swatch. A project the package
|
|
760
|
+
// cannot place (no `home_site`, inventory-app#2727) gets one only from
|
|
761
|
+
// the site's own `projectColors`.
|
|
762
|
+
if ('home_site' in project) expect(config.projectColors[item.project_id]).toBeTruthy()
|
|
756
763
|
app.unmount()
|
|
757
764
|
}
|
|
758
765
|
}, 120000)
|
|
@@ -784,13 +791,16 @@ export function describeExhibitionSmoke({
|
|
|
784
791
|
}, 30000)
|
|
785
792
|
|
|
786
793
|
it('renders a partner profile on the composed record view', async () => {
|
|
787
|
-
const
|
|
794
|
+
const museums = (await visiblePartners()).filter((p) => p.type !== 'institution' && partnerNames[p.id]?.name)
|
|
795
|
+
// The map needs the partner's coordinates: one that has them, if any.
|
|
796
|
+
const located = (p) => Number.isFinite(p.latitude) && Number.isFinite(p.longitude)
|
|
797
|
+
const partner = museums.find(located) ?? museums[0]
|
|
788
798
|
const { app, host } = await mountSite(`#/partner/${partner.id}`)
|
|
789
799
|
await vi.waitFor(() => expect(host.querySelector('.mwnf-record')).not.toBeNull(), WAIT)
|
|
790
800
|
await vi.waitFor(() => expect(host.querySelector('.mwnf-record').textContent.trim().length).toBeGreaterThan(0), WAIT)
|
|
791
801
|
// The tab strip and the map are the page's own slots.
|
|
792
802
|
expect(host.querySelector('[role="tablist"], .mwnf-dxa-profile-links')).not.toBeNull()
|
|
793
|
-
expect(host.querySelector('.mwnf-partner-map')).not.toBeNull()
|
|
803
|
+
if (located(partner)) expect(host.querySelector('.mwnf-partner-map')).not.toBeNull()
|
|
794
804
|
app.unmount()
|
|
795
805
|
}, 30000)
|
|
796
806
|
|
|
@@ -852,8 +862,13 @@ export function describeExhibitionSmoke({
|
|
|
852
862
|
app.unmount()
|
|
853
863
|
}, 30000)
|
|
854
864
|
|
|
865
|
+
// The first theme that has pictures, its sub-themes' or (a theme with no
|
|
866
|
+
// sub-themes) its own.
|
|
855
867
|
it("renders a theme's gallery on legacy's grid", async () => {
|
|
856
|
-
const
|
|
868
|
+
const [themes] = await loadEntities(['themes'])
|
|
869
|
+
const pictured = (node) => (node.sub_themes?.length ? node.sub_themes : [node]).some((sub) => sub.pictures?.length)
|
|
870
|
+
const theme = themes.filter((t) => t.display_order > 1).sort((a, b) => a.display_order - b.display_order).find(pictured)
|
|
871
|
+
const { app, host } = await mountSite(`#/theme-gallery/${theme ? theme.display_order - 1 : 1}`)
|
|
857
872
|
await vi.waitFor(() => expect(host.querySelector(TILE)).not.toBeNull(), WAIT)
|
|
858
873
|
expect(host.querySelector('.mwnf-dxa-theme-gallery-page')).not.toBeNull()
|
|
859
874
|
app.unmount()
|
|
@@ -952,49 +967,58 @@ export function describeExhibitionSmoke({
|
|
|
952
967
|
'institution', 'institution-monuments', 'related', 'timeline', 'timeline-results',
|
|
953
968
|
'timeline-gallery', 'credits',
|
|
954
969
|
],
|
|
955
|
-
legacyPaths:
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
970
|
+
legacyPaths: hasLegacyRoutes
|
|
971
|
+
? [
|
|
972
|
+
'/database-item/:uid(.*)/:language',
|
|
973
|
+
'/partner/:country/:id/:language',
|
|
974
|
+
'/partner-objects/:country/:id/:page',
|
|
975
|
+
'/institution/:country/:id/:language',
|
|
976
|
+
'/institution-monuments/:country/:id/:page',
|
|
977
|
+
'/timeline-gallery/:country/:start/:end/:page',
|
|
978
|
+
]
|
|
979
|
+
: [],
|
|
963
980
|
})
|
|
964
981
|
|
|
965
|
-
it('maps a legacy address onto the canonical route', async () => {
|
|
982
|
+
it.skipIf(!hasLegacyRoutes)('maps a legacy address onto the canonical route', async () => {
|
|
966
983
|
const [, items, partners] = await loadEntities(['exhibition', 'items', 'partners'])
|
|
967
984
|
const [itemFor, partnerFor, objectsFor, institutionFor, monumentsFor, galleryFor] = config.legacyRoutes
|
|
968
985
|
|
|
986
|
+
// A package built from the inventory's own data carries no legacy key
|
|
987
|
+
// (inventory-app#2727): the item and partner shapes are then proven on
|
|
988
|
+
// nothing, the timeline gallery's still are.
|
|
969
989
|
const item = items.find((i) => i.backward_compatibility)
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
990
|
+
if (item) {
|
|
991
|
+
expect(await itemFor.resolve({ uid: item.backward_compatibility.split(':').join('/') })).toEqual({
|
|
992
|
+
name: 'item',
|
|
993
|
+
params: { id: item.id },
|
|
994
|
+
})
|
|
995
|
+
}
|
|
974
996
|
expect(await itemFor.resolve({ uid: 'mwnf3/objects/NOPE/xx/Mus00/0' })).toBeNull()
|
|
975
997
|
|
|
976
998
|
const museum = partners.find((p) => p.type !== 'institution' && (p.backward_compatibility ?? '').split(':').length >= 4)
|
|
977
|
-
const [, , museumId, museumCountry] = museum
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
999
|
+
const [, , museumId, museumCountry] = museum?.backward_compatibility.split(':') ?? []
|
|
1000
|
+
if (museum) {
|
|
1001
|
+
expect(await partnerFor.resolve({ country: museumCountry, id: museumId })).toEqual({
|
|
1002
|
+
name: 'partner',
|
|
1003
|
+
params: { id: museum.id },
|
|
1004
|
+
})
|
|
1005
|
+
expect(await objectsFor.resolve({ country: museumCountry, id: museumId, page: '3' })).toEqual({
|
|
1006
|
+
name: 'partner-objects',
|
|
1007
|
+
params: { id: museum.id },
|
|
1008
|
+
query: { page: '3' },
|
|
1009
|
+
})
|
|
1010
|
+
// An institution reaches the institution pages, the same component
|
|
1011
|
+
// under another name.
|
|
1012
|
+
expect(await institutionFor.resolve({ country: museumCountry, id: museumId })).toEqual({
|
|
1013
|
+
name: 'institution',
|
|
1014
|
+
params: { id: museum.id },
|
|
1015
|
+
})
|
|
1016
|
+
expect(await monumentsFor.resolve({ country: museumCountry, id: museumId, page: '1' })).toEqual({
|
|
1017
|
+
name: 'institution-monuments',
|
|
1018
|
+
params: { id: museum.id },
|
|
1019
|
+
query: {},
|
|
1020
|
+
})
|
|
1021
|
+
}
|
|
998
1022
|
// The page number and the period leave the path for the query; an open
|
|
999
1023
|
// bound stops being the literal 'any', and `start` becomes `begin`.
|
|
1000
1024
|
expect(galleryFor.resolve({ country: 'uk', start: 'any', end: '1500', page: '2' })).toEqual({
|