@museumwnf/viewer-layout 3.26.1 → 3.28.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/dist/views.js CHANGED
@@ -1,7 +1,7 @@
1
- import { t as e } from "./FeaturedRecord-BINuFBnk.js";
2
- import { s as t } from "./TimelineEventList-B-XUnWiG.js";
3
- import { a as n, i as r, n as i, o as a, r as o, s, t as c } from "./TimelineResultsView-CMLvGzPD.js";
4
- import { t as l } from "./RecordView-D5q5LNvv.js";
1
+ import { t as e } from "./FeaturedRecord-CTqnQFox.js";
2
+ import { s as t } from "./TimelineEventList-CTJJOWGh.js";
3
+ import { a as n, i as r, n as i, o as a, r as o, s, t as c } from "./TimelineResultsView-D15BMWZM.js";
4
+ import { t as l } from "./RecordView-kkpYLtL_.js";
5
5
  import { computed as u, createBlock as d, createCommentVNode as f, createElementBlock as p, createVNode as m, mergeProps as h, normalizeClass as g, openBlock as _, renderSlot as v, toDisplayString as y, unref as b } from "vue";
6
6
  import { I18nText as x, renderInline as S, renderPlain as C, useDataPackage as w, useFeaturedRecord as T, useI18n as E, useSiteConfig as D } from "@museumwnf/viewer-core";
7
7
  //#region src/views/HomeView.vue
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@museumwnf/viewer-layout",
3
- "version": "3.26.1",
3
+ "version": "3.28.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",
@@ -43,12 +43,12 @@
43
43
  "test": "vitest run"
44
44
  },
45
45
  "peerDependencies": {
46
- "@museumwnf/viewer-core": "^2.13.0",
46
+ "@museumwnf/viewer-core": "^2.14.0",
47
47
  "vue": "^3.5.0",
48
48
  "vue-router": "^4.5.0 || ^5.0.0"
49
49
  },
50
50
  "devDependencies": {
51
- "@museumwnf/viewer-core": "^2.13.0",
51
+ "@museumwnf/viewer-core": "^2.14.0",
52
52
  "@vitejs/plugin-vue": "^6.0.8",
53
53
  "@vue/test-utils": "^2.4.11",
54
54
  "jsdom": "^30.0.1",
@@ -897,6 +897,7 @@
897
897
  /* --mwnf-standalone-related-background: transparent; Related Content column */
898
898
  /* --mwnf-standalone-related-text: inherit; Its text */
899
899
  /* --mwnf-standalone-related-link: inherit; Its links */
900
+ /* --mwnf-standalone-related-bullet: var(--mwnf-standalone-bullet); The arrow before its links (a url()) */
900
901
  /* --mwnf-standalone-sheet-label-color: #000; The item sheet's labels, a section's heading included */
901
902
  /* --mwnf-standalone-sheet-value-color: #222; The item sheet's values, prose and credits */
902
903
  /* --mwnf-standalone-sheet-link-color: rgb(1 141 206); Their links */
@@ -1,343 +0,0 @@
1
- import { a as e, c as t, d as n, i as r, n as i, o as ee, r as te, s as ne } from "./PartnerMap-CyuhYm1j.js";
2
- import { t as re } from "./GlossaryPopover-B7E6BsjS.js";
3
- import { Fragment as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createSlots as ie, createTextVNode as ae, createVNode as d, guardReactiveProps as f, normalizeClass as oe, normalizeProps as p, openBlock as m, ref as h, renderList as g, renderSlot as _, toDisplayString as v, unref as y, useSlots as se, watch as b, withCtx as x } from "vue";
4
- import { useI18n as S } from "@museumwnf/viewer-core/i18n";
5
- import { NotFoundView as ce, byId as le, citation as ue, creditLine as de, entityRef as fe, languageLabels as pe, loadEntities as me, pictureCredits as he, picturesInLanguage as ge, renderBlock as _e, renderInline as C, renderPlain as w, sheetRows as T, sourceUrl as ve, useDataPackage as ye, useGlossaryPopup as be, useI18n as xe, useProjects as Se, useRecordSheet as Ce, useRelatedRecords as we } from "@museumwnf/viewer-core";
6
- import { useRoute as Te } from "vue-router";
7
- //#region src/content/ShortDescription.vue
8
- var Ee = ["dir"], E = ["aria-expanded"], D = ["innerHTML"], De = {
9
- __name: "ShortDescription",
10
- props: {
11
- html: {
12
- type: String,
13
- required: !0
14
- },
15
- dir: {
16
- type: String,
17
- default: void 0
18
- }
19
- },
20
- setup(e) {
21
- let t = e, { t: n } = S(), r = h(!1);
22
- return b(() => t.html, () => {
23
- r.value = !1;
24
- }), (t, i) => (m(), l("div", {
25
- class: "mwnf-sheet__short",
26
- dir: e.dir
27
- }, [u("button", {
28
- type: "button",
29
- class: "mwnf-sheet__toggle",
30
- "aria-expanded": r.value ? "true" : "false",
31
- onClick: i[0] ||= (e) => r.value = !r.value
32
- }, v(r.value ? y(n)("record.action.hideShortDescription") : y(n)("record.action.viewShortDescription")), 9, E), r.value ? (m(), l("div", {
33
- key: 0,
34
- class: "mwnf-sheet__block",
35
- innerHTML: e.html
36
- }, null, 8, D)) : c("", !0)], 8, Ee));
37
- }
38
- };
39
- //#endregion
40
- //#region src/views/pictureLimit.js
41
- function O(e, t, n) {
42
- let r = typeof t == "function" ? t(n) : t;
43
- return Number.isInteger(r) && r > 0 ? e.slice(0, r) : e;
44
- }
45
- //#endregion
46
- //#region src/views/RecordView.vue
47
- var Oe = ["dir", "innerHTML"], ke = { class: "mwnf-record__body" }, Ae = { class: "mwnf-record__main" }, je = {
48
- key: 1,
49
- class: "mwnf-record__status"
50
- }, Me = {
51
- key: 0,
52
- class: "mwnf-record__aside"
53
- }, Ne = {
54
- key: 2,
55
- class: "mwnf-record__status"
56
- }, k = {
57
- __name: "RecordView",
58
- props: {
59
- spec: {
60
- type: Object,
61
- required: !0
62
- },
63
- id: {
64
- type: String,
65
- required: !0
66
- },
67
- entity: {
68
- type: String,
69
- default: ""
70
- }
71
- },
72
- setup(h) {
73
- let b = h, { t: S, locale: Ee } = xe(), E = ye(), D = Se(), k = se(), Pe = Te(), A = b.spec.entity ?? b.entity, j = o(() => b.spec), Fe = fe(A), Ie = le(A), M = o(() => Ie.value.get(b.id) ?? null), Le = o(() => Fe.value !== null), N = b.spec.creditPeople ? b.spec.creditPeople.entity ?? "authors" : null;
74
- N && me([N]).catch(() => {});
75
- let P = N ? le(N) : null, { language: F, languages: Re, dir: I, select: L, text: R, ready: z, terms: ze, glossary: B, attribution: V } = Ce(M, {
76
- entity: A,
77
- translations: [...b.spec.translations ?? [], ...N ? [N] : []],
78
- attribution: b.spec.attribution ?? []
79
- }), H = o(() => pe(Re.value)), { active: U, onClick: W, close: Be } = be(ze), Ve = o(() => U.value ? _e(U.value.definition, { breaks: !0 }) : ""), G = (e, t) => E.tr(e, t, F.value, "en"), K = (e) => E.translations(e, F.value), q = o(() => ({
80
- record: M.value,
81
- text: R.value,
82
- language: F.value,
83
- languages: H.value,
84
- select: L,
85
- dir: I.value,
86
- glossary: B.value,
87
- ready: z.value,
88
- attribution: V.value,
89
- t: S,
90
- tr: G,
91
- translations: K
92
- }));
93
- function He(e) {
94
- return ((typeof e == "function" ? e(q.value) : e) ?? []).map((e) => ({
95
- ...e,
96
- label: e.label ? S(e.label) : ""
97
- }));
98
- }
99
- let Ue = o(() => M.value ? T(He(j.value.fields), q.value) : []), We = o(() => M.value ? T(He(j.value.sections).map((e) => ({
100
- render: "block",
101
- ...e
102
- })), q.value) : []), J = o(() => j.value.shortDescriptionAfter ?? "description"), Ge = o(() => !Ue.value.some((e) => e.key === J.value) && We.value.some((e) => e.key === J.value)), Ke = o(() => j.value.shortDescription === !1 ? "" : j.value.shortDescription ?? "short_description"), Y = o(() => {
103
- let e = Ke.value ? R.value[Ke.value] : "";
104
- return e ? { html: _e(String(e), {
105
- breaks: !0,
106
- glossary: B.value
107
- }) } : null;
108
- }), qe = o(() => {
109
- if (!M.value) return "";
110
- if (j.value.title) return j.value.title(q.value);
111
- let e = R.value.name ?? M.value.internal_name ?? M.value.id;
112
- return C(String(e), { glossary: B.value });
113
- }), Je = o(() => M.value ? O(Ye(), j.value.pictureLimit, q.value) : []);
114
- function Ye() {
115
- if (j.value.media) return j.value.media(M.value, q.value);
116
- let e = w(String(R.value.name ?? M.value.internal_name ?? ""));
117
- return ge(M.value.images, F.value).map((t) => ({
118
- url: t.url,
119
- alt: t.captions?.[F.value] ?? e,
120
- caption: t.captions?.[F.value] ?? "",
121
- ...he(t, F.value)
122
- }));
123
- }
124
- let Xe = [
125
- {
126
- field: "author",
127
- label: "sheet.field.preparedBy"
128
- },
129
- {
130
- field: "copy_editor",
131
- label: "sheet.field.copyeditedBy"
132
- },
133
- {
134
- field: "translator",
135
- label: "sheet.field.translationBy"
136
- },
137
- {
138
- field: "translation_copy_editor",
139
- label: "sheet.field.translationCopyeditedBy"
140
- }
141
- ];
142
- function Ze(e) {
143
- let t = j.value.creditNames ? R.value.credit_names?.[e] : null;
144
- return t?.length ? de(t) : R.value[e] ?? V.value[e] ?? "";
145
- }
146
- function Qe(e) {
147
- let t = P ? R.value.credit_ids?.[e] : null;
148
- if (!t?.length) return null;
149
- let n = K(N), r = t.map((e) => {
150
- let t = P.value.get(e);
151
- if (!t) return null;
152
- let r = t.name ?? "";
153
- return {
154
- name: F.value === "ar" && t.originalname ? t.originalname : r,
155
- heading: [t.firstname, t.lastname].filter(Boolean).join(" ") || r,
156
- biography: n?.[e]?.curriculum ?? ""
157
- };
158
- });
159
- return r.every(Boolean) ? r : null;
160
- }
161
- let $e = o(() => (j.value.credits ?? Xe).map(({ field: e, label: t }) => ({
162
- label: S(t),
163
- value: Ze(e),
164
- people: Qe(e)
165
- })).filter((e) => e.value)), et = o(() => String(M.value?.[j.value.workingNumber ?? "mwnf_reference"] ?? ""));
166
- function X(e) {
167
- if (e?.permalink !== !1) return typeof e?.permalink == "string" ? e.permalink : ve(Pe) ?? void 0;
168
- }
169
- let tt = o(() => {
170
- let e = j.value.citation;
171
- return !M.value || typeof e?.format != "function" ? "" : e.format(q.value, {
172
- permalink: X(e),
173
- year: (/* @__PURE__ */ new Date()).getFullYear()
174
- });
175
- }), nt = o(() => {
176
- let e = j.value.citation;
177
- if (!M.value || e === !1 || typeof e?.format == "function") return "";
178
- let t = typeof e?.project == "function" ? null : e?.project ?? M.value.project_id, n = typeof e?.project == "function" ? e.project(M.value, q.value) : D.label(t);
179
- return ue({
180
- author: Ze("author") || void 0,
181
- name: R.value.name ?? M.value.internal_name ?? "",
182
- project: n,
183
- permalink: X(e),
184
- inWord: S("record.citation.in")
185
- });
186
- }), Z = we(M, {
187
- entity: A,
188
- language: F
189
- }), Q = o(() => j.value.related === !1 ? null : j.value.related ?? {}), $ = o(() => {
190
- if (!Q.value) return [];
191
- let e = Q.value.record ?? rt;
192
- return Z.value.inPackage.map((t) => e(t, q.value));
193
- });
194
- function rt({ record: e, justification: t }) {
195
- let n = G(A, e.id).name ?? e.internal_name ?? e.id;
196
- return {
197
- id: e.id,
198
- image: e.images?.[0]?.url ?? "",
199
- imageAlt: w(String(n)),
200
- name: C(String(n)),
201
- meta: t ? [t] : [],
202
- badge: e.type ?? "",
203
- to: {
204
- name: j.value.route ?? (b.entity ? `${b.entity}-detail` : "item"),
205
- params: { id: e.id }
206
- }
207
- };
208
- }
209
- let it = /* @__PURE__ */ new Set([
210
- "header",
211
- "before-sheet",
212
- "after-sheet",
213
- "aside",
214
- "source",
215
- "related",
216
- "after",
217
- "default"
218
- ]), at = o(() => Object.keys(k).filter((e) => !it.has(e)));
219
- return (o, h) => Le.value && !M.value ? (m(), s(y(ce), { key: 0 })) : M.value ? (m(), l("article", {
220
- key: 1,
221
- class: oe(["mwnf-record", { "mwnf-record--spaced": j.value.spaced }]),
222
- onClick: h[0] ||= (...e) => y(W) && y(W)(...e)
223
- }, [
224
- _(o.$slots, "header", p(f(q.value)), () => [
225
- j.value.back ? (m(), s(n, {
226
- key: 0,
227
- class: "mwnf-record__back",
228
- to: j.value.back.to,
229
- href: j.value.back.href
230
- }, {
231
- default: x(() => [ae("← " + v(y(S)(j.value.back.label)), 1)]),
232
- _: 1
233
- }, 8, ["to", "href"])) : c("", !0),
234
- d(t, {
235
- languages: H.value,
236
- language: y(F),
237
- onSelect: y(L)
238
- }, null, 8, [
239
- "languages",
240
- "language",
241
- "onSelect"
242
- ]),
243
- u("h1", {
244
- class: "mwnf-record__title",
245
- dir: y(I) || void 0,
246
- innerHTML: qe.value
247
- }, null, 8, Oe)
248
- ]),
249
- u("div", ke, [u("div", Ae, [
250
- Je.value.length ? (m(), s(i, {
251
- key: 0,
252
- images: Je.value,
253
- variant: j.value.mediaVariant ?? ""
254
- }, null, 8, ["images", "variant"])) : c("", !0),
255
- y(z) ? c("", !0) : (m(), l("p", je, v(y(S)("core.status.loading")), 1)),
256
- _(o.$slots, "before-sheet", p(f(q.value))),
257
- d(ne, {
258
- rows: Ue.value,
259
- layout: j.value.layout ?? "table",
260
- dir: y(I),
261
- "short-description": Y.value,
262
- "short-description-after": J.value
263
- }, ie({ _: 2 }, [g(at.value, (e) => ({
264
- name: e,
265
- fn: x((t) => [_(o.$slots, e, p(f({
266
- ...t,
267
- ...q.value
268
- })))])
269
- }))]), 1032, [
270
- "rows",
271
- "layout",
272
- "dir",
273
- "short-description",
274
- "short-description-after"
275
- ]),
276
- (m(!0), l(a, null, g(We.value, (e) => (m(), l(a, { key: e.key }, [d(ee, {
277
- heading: e.label,
278
- html: e.html,
279
- dir: y(I)
280
- }, null, 8, [
281
- "heading",
282
- "html",
283
- "dir"
284
- ]), Y.value && Ge.value && e.key === J.value ? (m(), s(De, {
285
- key: 0,
286
- html: Y.value.html,
287
- dir: y(I)
288
- }, null, 8, ["html", "dir"])) : c("", !0)], 64))), 128)),
289
- _(o.$slots, "after-sheet", p(f(q.value))),
290
- d(e, {
291
- credits: $e.value,
292
- "working-number": et.value,
293
- "working-number-label": y(S)(j.value.workingNumberLabel ?? "sheet.field.workingNumber"),
294
- citation: nt.value,
295
- "citation-html": tt.value,
296
- "citation-heading": j.value.citation?.heading ? y(S)(j.value.citation.heading) : ""
297
- }, null, 8, [
298
- "credits",
299
- "working-number",
300
- "working-number-label",
301
- "citation",
302
- "citation-html",
303
- "citation-heading"
304
- ]),
305
- _(o.$slots, "source", p(f(q.value)), () => [d(r)]),
306
- _(o.$slots, "related", p(f({
307
- ...q.value,
308
- records: $.value,
309
- outside: y(Z).outside
310
- })), () => [Q.value ? (m(), s(te, {
311
- key: 0,
312
- heading: y(S)(Q.value.heading ?? "record.related.items"),
313
- records: $.value,
314
- variant: Q.value.variant ?? "list",
315
- "action-label": Q.value.actionLabel ? y(S)(Q.value.actionLabel) : ""
316
- }, null, 8, [
317
- "heading",
318
- "records",
319
- "variant",
320
- "action-label"
321
- ])) : c("", !0)])
322
- ]), o.$slots.aside ? (m(), l("aside", Me, [_(o.$slots, "aside", p(f({
323
- ...q.value,
324
- records: $.value,
325
- outside: y(Z).outside
326
- })))])) : c("", !0)]),
327
- _(o.$slots, "after", p(f(q.value))),
328
- d(re, {
329
- term: y(U),
330
- html: Ve.value,
331
- dir: y(I),
332
- onClose: y(Be)
333
- }, null, 8, [
334
- "term",
335
- "html",
336
- "dir",
337
- "onClose"
338
- ])
339
- ], 2)) : (m(), l("p", Ne, v(y(S)("core.status.loading")), 1));
340
- }
341
- };
342
- //#endregion
343
- export { O as n, k as t };