@museumwnf/viewer-layout 3.91.0 → 3.93.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 CHANGED
@@ -819,12 +819,12 @@ the banners may each be given once or per language (`{ en, ar }`).
819
819
  | --- | --- |
820
820
  | `StandaloneShell` | `SiteShell` with legacy's chrome: the logo per language, the inner pages' centred heading and "Portal \| Home" links, the home page's picture banner, the inner pages' titled band (`navigation.sectionTitles`), the menu above or below the banner, the band above the footer on the home page, the copyright line with the year, a print-only logo. The page gets `.mwnf-standalone`, the scope of the family stylesheet |
821
821
  | `StandaloneHome` | the home page's content: the side links and the record of the day, or a tile grid |
822
- | `TodayHighlight` | legacy's "Today's highlight": the record for the day of the year from the site's list (`highlight.list`: the records' inventory ids, or, for a site not moved yet, legacy's `home_items_img.txt` lines, found by legacy key), its picture and legacy's lines (`highlightRecord` in `standalone/chrome.js`) |
822
+ | `TodayHighlight` | legacy's "Today's highlight": the record for the day of the year from the site's list (`highlight.list`: the records' inventory ids, or `'random'`: one of the package's records with a picture of its own, the same all day, `recordWithPictureForDay`), its picture and legacy's lines (`highlightRecord` in `standalone/chrome.js`) |
823
823
  | `StandaloneItemSheet` | `RecordView` in legacy's three columns: the way back and the pictures; the sheet with its short-description toggle; the coloured Related Content column (`RelatedContent`), which takes the site's own blocks in its `sidebar` slot, then legacy's "See also" from the record's `travel_book` (Islamic Art's "Related MWNF Travel Book") and `exhibition_trails` (Baroque Art's trails), linked in the page's language (`related.seeAlso: false` leaves it out) |
824
824
  | `StandaloneTextPage` | a text page in legacy's centred column: a Markdown entry, an optional drop cap, a "→" link and Print |
825
825
  | `StandaloneSponsors` | the band above the footer, in columns of text, logos and links |
826
826
  | `StandaloneSubNav`, `StandaloneTileGrid`, `StandaloneSlider` | Sharing History's tab strip, picture tiles and slider |
827
- | `byLanguage`, `dayOfYear`, `pickForDay`, `legacyHomeItemKey` | the plain functions the chrome reads with |
827
+ | `byLanguage`, `dayOfYear`, `pickForDay`, `recordWithPictureForDay` | the plain functions the chrome reads with |
828
828
 
829
829
  Every rule of the family's stylesheet is scoped to `.mwnf-standalone`, and
830
830
  every value is a `--mwnf-standalone-*` token with a neutral fallback
@@ -873,9 +873,10 @@ export default minisiteConfig({
873
873
  The factory reads `minisite.json` (`menuSecondColumnFrom`, `curators`, `maps`,
874
874
  and for the other families `social`, `design`, `banner`, `logos`), points the frame's links at the parent product next to the
875
875
  site's own address (`parentSite(origin, 'islamicart')`), and gives the
876
- family's no-country rule (`ISLAMICART_NO_COUNTRY`, `BAROQUEART_NO_COUNTRY`) and
877
- Word document title unless `minisite.json` sets `noCountry` or
878
- `documentTitle` itself. The pieces it assembles — `MinisiteShell`,
876
+ family's Word document title, and Discover Islamic Art's no-country rule
877
+ (`ISLAMICART_NO_COUNTRY`), unless `minisite.json` sets `noCountry` or
878
+ `documentTitle` itself. A Discover Baroque Art mini-site prints the country as
879
+ its package says (`show_country`). The pieces it assembles — `MinisiteShell`,
879
880
  `minisiteNavigation`, `minisiteSettings`, `minisiteRoutes`, `MinisiteHome` and
880
881
  each family's own — stay exported for a site that needs to assemble them
881
882
  differently.
@@ -925,7 +926,7 @@ and their sites are created from `baroqueart-minisite-template`.
925
926
 
926
927
  ```js
927
928
  import {
928
- BAROQUEART_NO_COUNTRY, BaroqueartHome, baroqueartNavigation, baroqueartRoutes, baroqueartSettings, BaroqueartShell,
929
+ BaroqueartHome, baroqueartNavigation, baroqueartRoutes, baroqueartSettings, BaroqueartShell,
929
930
  } from '@museumwnf/viewer-layout/minisite'
930
931
 
931
932
  const parent = 'https://museumwithnofrontiers.github.io/baroqueart'
@@ -940,7 +941,6 @@ export default {
940
941
  curators: [{ partner: '<uuid>', place: 'Brno', country: 'cze', logo: 'legacy/CZ-46.png', space: 35 }],
941
942
  design: { name: 'Yasar University Izmir, Turkey', logo: 'legacy/yasar.png', href: 'http://www.yasar.edu.tr/en/' },
942
943
  banner: 'legacy/banner.png',
943
- noCountry: BAROQUEART_NO_COUNTRY,
944
944
  documentTitle: 'MWNF DISCOVER BAROQUE ART - Exhibition',
945
945
  }),
946
946
  views: { home: BaroqueartHome },
@@ -0,0 +1,262 @@
1
+ // src/search/globalDatabase.js
2
+ var e = [
3
+ "object",
4
+ "monument",
5
+ "detail"
6
+ ], t = Object.freeze({
7
+ keyword: null,
8
+ name: ["name", "names"],
9
+ location: ["location", "country"],
10
+ provenance: ["provenance"],
11
+ dynasty: ["dynasty"],
12
+ patron: ["patron"],
13
+ artist: ["artist"],
14
+ material: ["materials"],
15
+ other: [
16
+ "description",
17
+ "short_description",
18
+ "history",
19
+ "type",
20
+ "holder",
21
+ "dates",
22
+ "production_place",
23
+ "tags"
24
+ ]
25
+ }), n = Object.freeze({
26
+ keyword: "catalogue.field.keywords",
27
+ name: "catalogue.field.name",
28
+ location: "catalogue.field.location",
29
+ provenance: "catalogue.field.provenance",
30
+ dynasty: "catalogue.facet.periodDynasty",
31
+ patron: "catalogue.field.patron",
32
+ artist: "catalogue.field.artist",
33
+ material: "catalogue.field.material",
34
+ other: "catalogue.field.other"
35
+ }), r = [
36
+ "keyword",
37
+ "material",
38
+ "type",
39
+ "artist",
40
+ "dynasty",
41
+ "subject",
42
+ "theme"
43
+ ], i = 3, a = 1e3, o = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/, s = /^[a-z]{3}$/, c = /^[a-z0-9]+(-[a-z0-9]+)*$/, l = /^[a-z]{2}$/, u = /^-?\d{1,6}$/, d = /^[a-z0-9-]{1,40}$/, f = (e) => Array.isArray(e) ? e[0] : e, p = (e) => typeof f(e) == "string" ? f(e) : "", m = (e) => {
44
+ let t = p(e).trim();
45
+ return u.test(t) ? String(Number(t) || 0) : "";
46
+ }, h = (e) => (Array.isArray(e) ? e : typeof e == "string" && e ? e.split(",") : []).filter((e) => typeof e == "string");
47
+ function g(n = {}, { languages: r = [], sites: i, options: a = [] } = {}) {
48
+ let u = [];
49
+ for (let e = 1; e <= 3; e++) {
50
+ let r = e === 1 ? "" : String(e), i = p(n[`in${r}`]);
51
+ u.push({
52
+ q: p(n[`q${r}`]).slice(0, 200),
53
+ field: Object.hasOwn(t, i) ? i : "keyword",
54
+ op: e === 1 ? "AND" : p(n[`op${r}`]) === "OR" ? "OR" : "AND"
55
+ });
56
+ }
57
+ let f = m(n.since), g = m(n.until);
58
+ f && g && Number(f) > Number(g) && ([f, g] = [g, f]);
59
+ let _ = p(n.searchlang), v = p(n.site), y = p(n.type), b = p(n.country), x = p(n.partner), S = p(n.dynasty);
60
+ return {
61
+ rows: u,
62
+ since: f,
63
+ until: g,
64
+ searchlang: l.test(_) && r.includes(_) ? _ : "",
65
+ site: c.test(v) && (!i || i.has(v)) ? v : "",
66
+ type: e.includes(y) ? y : "",
67
+ country: s.test(b) ? b : "",
68
+ partner: o.test(x) ? x : "",
69
+ dynasty: o.test(S) ? S : "",
70
+ tags: [...new Set(h(n.tags).filter((e) => o.test(e)))].slice(0, 10),
71
+ all: p(n.all) === "1",
72
+ options: [...new Set(h(n.opt).filter((e) => d.test(e) && a.includes(e)))]
73
+ };
74
+ }
75
+ function _(e) {
76
+ let t = {};
77
+ e.rows.forEach((e, n) => {
78
+ let r = n === 0 ? "" : String(n + 1);
79
+ e.q && (t[`q${r}`] = e.q, e.field !== "keyword" && (t[`in${r}`] = e.field), n > 0 && e.op === "OR" && (t[`op${r}`] = "OR"));
80
+ });
81
+ for (let n of [
82
+ "since",
83
+ "until",
84
+ "searchlang",
85
+ "site",
86
+ "type",
87
+ "country",
88
+ "partner",
89
+ "dynasty"
90
+ ]) e[n] && (t[n] = e[n]);
91
+ return e.tags.length && (t.tags = e.tags.join(",")), e.all && (t.all = "1"), e.options.length && (t.opt = e.options.join(",")), t;
92
+ }
93
+ function v(e) {
94
+ return e.rows.some((e) => e.q) || !!(e.country || e.partner || e.dynasty || e.tags.length || e.since || e.until || e.type || e.site);
95
+ }
96
+ function y(e, t = {}) {
97
+ let n = [];
98
+ if (!e.all && t.site && (n.push(`sites.site = "${t.site}"`), t.subset)) {
99
+ let r = (t.options ?? []).filter((t) => e.options.includes(t.key)).map((e) => e.filter);
100
+ n.push(r.length ? [t.subset, ...r] : t.subset);
101
+ }
102
+ e.searchlang && n.push(`languages = "${e.searchlang}"`), e.site && n.push(`sites.site = "${e.site}"`), e.type && n.push(`type = "${e.type}"`), e.since && n.push(`date_to >= ${e.since}`), e.until && n.push(`start_date <= ${e.until}`), e.country && n.push(`country_id = "${e.country}"`), e.partner && n.push(`partner_id = "${e.partner}"`), e.dynasty && n.push(`dynasty_ids = "${e.dynasty}"`);
103
+ for (let t of e.tags) n.push(`tag_ids = "${t}"`);
104
+ return n;
105
+ }
106
+ function b(e, n) {
107
+ let r = t[e];
108
+ return r ? n.flatMap((e) => r.map((t) => `texts.${e}.${t}`)) : null;
109
+ }
110
+ async function x(e, t, { fetch: n = fetch, signal: r } = {}) {
111
+ let i = await n(`${e}/indexes/items/search`, {
112
+ method: "POST",
113
+ headers: { "Content-Type": "application/json" },
114
+ body: JSON.stringify(t),
115
+ signal: r
116
+ });
117
+ if (!i.ok) throw Error(`search answered ${i.status}`);
118
+ return i.json();
119
+ }
120
+ async function S(e, t, n, { languages: r, locale: i, ...o }) {
121
+ let s = await Promise.all(t.map((t) => {
122
+ let s = b(t.field, r);
123
+ return x(e, {
124
+ q: t.q,
125
+ limit: a,
126
+ matchingStrategy: "all",
127
+ attributesToRetrieve: ["id"],
128
+ showRankingScore: !0,
129
+ filter: n,
130
+ ...s ? { attributesToSearchOn: s } : {},
131
+ ...i ? { locales: [i] } : {}
132
+ }, o);
133
+ })), c = /* @__PURE__ */ new Map(), l = null;
134
+ return s.forEach((e, n) => {
135
+ let r = /* @__PURE__ */ new Set();
136
+ for (let t of Array.isArray(e?.hits) ? e.hits : []) typeof t?.id == "string" && (r.add(t.id), c.set(t.id, Math.max(c.get(t.id) ?? 0, Number(t._rankingScore) || 0)));
137
+ l = l === null ? r : t[n].op === "OR" ? /* @__PURE__ */ new Set([...l, ...r]) : new Set([...l].filter((e) => r.has(e)));
138
+ }), [...l ?? []].sort((e, t) => c.get(t) - c.get(e) || (e < t ? -1 : +(e > t)));
139
+ }
140
+ async function C(e, t, { offset: n = 0, limit: r = 20, scope: i = {}, languages: a = [], locales: o = {}, fetch: s, signal: c, cache: l } = {}) {
141
+ let u = {
142
+ fetch: s,
143
+ signal: c
144
+ }, d = y(t, i), f = t.rows.filter((e) => e.q), p = t.searchlang ? o[t.searchlang] : void 0;
145
+ if (f.length <= 1) {
146
+ let t = f[0] ?? {
147
+ q: "",
148
+ field: "keyword"
149
+ }, i = b(t.field, a), o = await x(e, {
150
+ q: t.q,
151
+ offset: n,
152
+ limit: r,
153
+ matchingStrategy: "all",
154
+ filter: d,
155
+ ...i ? { attributesToSearchOn: i } : {},
156
+ ...p ? { locales: [p] } : {}
157
+ }, u);
158
+ return {
159
+ hits: Array.isArray(o?.hits) ? o.hits : [],
160
+ total: Number(o?.estimatedTotalHits ?? 0)
161
+ };
162
+ }
163
+ f[0] = {
164
+ ...f[0],
165
+ op: "AND"
166
+ };
167
+ let m = JSON.stringify([f, d]), h = l?.get(m);
168
+ h || (h = await S(e, f, d, {
169
+ languages: a,
170
+ locale: p,
171
+ ...u
172
+ }), l?.clear(), l?.set(m, h));
173
+ let g = h.slice(n, n + r);
174
+ if (g.length === 0) return {
175
+ hits: [],
176
+ total: h.length
177
+ };
178
+ let _ = await x(e, {
179
+ q: "",
180
+ limit: g.length,
181
+ filter: [`id IN [${g.map((e) => `"${e}"`).join(", ")}]`]
182
+ }, u), v = new Map((Array.isArray(_?.hits) ? _.hits : []).map((e) => [e.id, e]));
183
+ return {
184
+ hits: g.map((e) => v.get(e)).filter(Boolean),
185
+ total: h.length
186
+ };
187
+ }
188
+ function w(e, t) {
189
+ let n = e?.texts ?? {}, r = n[t]?.name ? t : n.en?.name ? "en" : (e?.languages ?? []).find((e) => n[e]?.name), i = r ? n[r] : null;
190
+ return {
191
+ language: r ?? t,
192
+ name: i?.name ?? "",
193
+ partner: i?.partner?.[0] ?? "",
194
+ dates: i?.dates?.[0] ?? "",
195
+ country: i?.country ?? ""
196
+ };
197
+ }
198
+ function T(e, t) {
199
+ let n = e?.labels ?? {};
200
+ return n[t] ?? n.en ?? Object.values(n)[0] ?? "";
201
+ }
202
+ function E(e) {
203
+ return String(e ?? "").normalize("NFD").replace(/[̀-ًͯ-ٰٟـ]/g, "").replace(/[آأإٱ]/g, "ا").replace(/ى/g, "ي").replace(/ة/g, "ه").toLowerCase().trim();
204
+ }
205
+ function D(e, t, n = 10) {
206
+ let r = E(t);
207
+ if (!r) return [];
208
+ let i = [];
209
+ for (let t of e) {
210
+ let e = E(t.label), n = e.indexOf(r);
211
+ if (n < 0) continue;
212
+ let a = n === 0 ? 0 : /[\s\-/(،,]/.test(e.charAt(n - 1)) ? 1 : 2;
213
+ i.push({
214
+ option: t,
215
+ rank: a
216
+ });
217
+ }
218
+ return i.sort((e, t) => e.rank - t.rank || t.option.count - e.option.count || e.option.label.localeCompare(t.option.label)), i.slice(0, n).map((e) => e.option);
219
+ }
220
+ var O = "https://search.metanull.eu", k = "https://museumwithnofrontiers.github.io/search/data/";
221
+ function A(e, t, { fetch: n = fetch, cache: r = j } = {}) {
222
+ let i = `${e}${t}`;
223
+ return r.has(i) || r.set(i, n(i).then((e) => {
224
+ if (!e.ok) throw Error(`${t}: ${e.status}`);
225
+ return e.json();
226
+ }).catch((e) => {
227
+ throw r.delete(i), e;
228
+ })), r.get(i);
229
+ }
230
+ var j = /* @__PURE__ */ new Map();
231
+ function M(e, t) {
232
+ return l.test(e) && r.includes(t) ? `filters/tags-${e}-${t}.json` : null;
233
+ }
234
+ function N(e, t, n) {
235
+ let r = [];
236
+ for (let i of Array.isArray(e?.sites) ? e.sites : []) {
237
+ if (typeof i?.site != "string" || typeof i.path != "string" || !i.path.startsWith("/") || i.path.startsWith("//")) continue;
238
+ let e = t.get(i.site), a = typeof i.name == "string" && i.name ? i.name : e?.name ?? i.site;
239
+ if (n && i.site === n) r.unshift({
240
+ site: i.site,
241
+ name: a,
242
+ route: i.path,
243
+ href: null
244
+ });
245
+ else if (e) {
246
+ let t = `${e.origin}/#${i.path}`;
247
+ (i.url === void 0 || i.url === t) && r.push({
248
+ site: i.site,
249
+ name: a,
250
+ route: null,
251
+ href: t
252
+ });
253
+ }
254
+ }
255
+ return r;
256
+ }
257
+ function P(e) {
258
+ let t = /* @__PURE__ */ new Map();
259
+ for (let n of Array.isArray(e?.sites) ? e.sites : []) typeof n?.slug == "string" && c.test(n.slug) && typeof n.origin == "string" && /^https:\/\/[^/?#@\s]+(\/[^/?#\s]+)*$/.test(n.origin) && t.set(n.slug, n);
260
+ return t;
261
+ }
262
+ export { _ as S, A as _, i as a, D as b, r as c, E as d, v as f, w as g, N as h, k as i, y as l, g as m, n, a as o, T as p, O as r, e as s, t, b as u, C as v, M as x, P as y };
package/dist/index.js CHANGED
@@ -6,4 +6,5 @@ import { a as E, i as D, n as O, o as k, r as A, t as j } from "./TimelineEventL
6
6
  import { t as M } from "./GlossaryPopover-DbQKXhx9.js";
7
7
  import { a as N, i as P, n as F, o as I, r as L, s as R, t as z } from "./OnDisplayIn-Ct8xxMwQ.js";
8
8
  import { t as B } from "./content-B1458eb-.js";
9
- export { i as AppBanner, c as AppContent, a as AppFooter, u as AppHeader, o as AppHyperlinks, t as AppNavigation, e as AppSponsors, R as BackLink, P as DynastyList, N as DynastyPopout, E as FacetSelect, h as FeaturedRecord, D as FilterPanel, n as GlobalSearchBox, M as GlossaryPopover, I as GlossaryTool, b as MediaGallery, z as OnDisplayIn, l as PageShell, k as Pagination, w as PartnerMap, O as PartnerPanel, g as RecordCredits, y as RecordGrid, _ as RecordLanguages, T as RecordList, C as RecordSheet, F as RelatedMedia, S as RelatedRecords, A as ResultsSummary, m as SectionCards, x as SheetSection, s as SocialLinks, v as SourceCredit, B as SpecialFeatures, j as TimelineEventList, L as TimelineLookup, p as chromeAsset, d as chromePicture, f as chromeSource, r as mwnfSocialLinks };
9
+ import { S as V, _ as H, a as U, b as W, c as G, d as K, f as q, g as J, h as Y, i as X, l as Z, m as Q, n as $, o as ee, p as te, r as ne, s as re, t as ie, u as ae, v as oe, x as se, y as ce } from "./globalDatabase-DwTGcqXU.js";
10
+ export { i as AppBanner, c as AppContent, a as AppFooter, u as AppHeader, o as AppHyperlinks, t as AppNavigation, e as AppSponsors, R as BackLink, ie as DATABASE_FIELDS, $ as DATABASE_FIELD_LABELS, P as DynastyList, N as DynastyPopout, E as FacetSelect, h as FeaturedRecord, D as FilterPanel, ne as GLOBAL_SEARCH_API, X as GLOBAL_SEARCH_DATA_URL, n as GlobalSearchBox, M as GlossaryPopover, I as GlossaryTool, b as MediaGallery, z as OnDisplayIn, l as PageShell, k as Pagination, w as PartnerMap, O as PartnerPanel, U as ROW_COUNT, ee as ROW_LIMIT, g as RecordCredits, y as RecordGrid, _ as RecordLanguages, T as RecordList, C as RecordSheet, F as RelatedMedia, S as RelatedRecords, A as ResultsSummary, re as SEARCH_TYPES, m as SectionCards, x as SheetSection, s as SocialLinks, v as SourceCredit, B as SpecialFeatures, G as TAG_CATEGORIES, j as TimelineEventList, L as TimelineLookup, p as chromeAsset, d as chromePicture, f as chromeSource, Z as databaseFilter, ae as fieldAttributes, K as foldText, q as isDatabaseSearch, te as labelOf, r as mwnfSocialLinks, Q as parseDatabaseQuery, Y as resultLinks, J as resultTexts, H as searchDataFile, oe as searchDatabase, ce as sitesBySlug, W as suggest, se as tagListFile, V as toDatabaseQuery };