@museumwnf/viewer-core 1.16.0 → 2.0.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
@@ -452,8 +452,6 @@ under the main partner it belongs to.
452
452
 
453
453
  | Export | Meaning |
454
454
  | --- | --- |
455
- | `projectName(key, t)` / `useProjectName()` / `PROJECT_ENTRIES` ⚠️ deprecated | a project's name by its legacy key (`ISL`, `EPM`, `DBA`, `BAR`, `AWE`, `DCA`, `DGA`, `EXTHE`, `GALLERIES`), through `core.project.*`; an unknown key reads as itself |
456
- | `projectFamily(key)` / `PROJECT_FAMILIES` ⚠️ deprecated | a project's colour family by the same legacy key (ISL and EPM share `ISLandEPM`, every exhibition shares `EXH`, …) — legacy's own class names, so a site's CSS reads as the stylesheet it was copied from; an unknown key reads as itself |
457
455
  | `useSection()` | the `meta.section` of the current route — see Routing |
458
456
  | `useFeaturedRecord(entity, { withImage = true, seed })` | one record at random for a landing page's spotlight, among those with an image; null until the entity is loaded; `seed` pins the pick |
459
457
  | `sectionMeta(chrome = [])` | returns `meta(section, ...entities) => ({ section, entities: [...chrome, ...entities] })` — a route's `meta` in one call, `chrome` being the entities every page of the site loads regardless of which one it is |
@@ -461,26 +459,24 @@ under the main partner it belongs to.
461
459
 
462
460
  #### Projects, from the data package (epic metanull/inventory-app#1727)
463
461
 
464
- `manifest.projects` — a project UUID → `{ name: { <lang>: '…' }, site_url, related_database_url, artistic_introduction_url }` map, emitted by every exporter since #1727 phase 2 — is project data moved out of viewer-core and into the data package a project's own exporter writes. It is additive: a package built before phase 2 simply has no `projects` key, and every function below reads that exactly like an unknown project id — `null`, never a throw.
462
+ `manifest.projects` — a project UUID → `{ name: { <lang>: '…' }, site_url, related_database_url, artistic_introduction_url }` map, emitted by every exporter since #1727 phase 2 — is project data read from the data package a project's own exporter writes, not carried in viewer-core. It is additive: a package built before phase 2 simply has no `projects` key, and every function below reads that exactly like an unknown project id — `null`, never a throw.
465
463
 
466
464
  | Export | Meaning |
467
465
  | --- | --- |
468
466
  | `projectLabel(manifest, projectId, lang)` | `manifest.projects[projectId].name[…]`, with the same language fallback every translated field in this package follows (`resolveRecordLanguage`): `lang`, then this package's base language (`en`), then the entry's first carried language. `null` when the package has no `projects` section, `projectId` isn't a key of it, or the entry names nothing. |
469
467
  | `projectLinks(manifest, projectId)` | `{ siteUrl, relatedDatabaseUrl, artisticIntroductionUrl }` from the same entry (camelCased, individually nullable — a project may simply have no value for one). `null` for the whole result when the package predates the section or doesn't carry `projectId`. |
470
- | `useProjects()` | `{ label(projectId, lang?), links(projectId) }` bound to the installed data package and active language — the manifest-driven analogue of `useProjectName()`. |
468
+ | `useProjects()` | `{ label(projectId, lang?), links(projectId) }` bound to the installed data package and active language. |
471
469
 
472
- Migration mapping, from the epic's design comment (§B) — what each of the five usages moves to:
470
+ What each of the sites' former legacy-key usages reads now, from `manifest.projects` (see CHANGELOG.md 2.0.0 for the full removal/migration notes):
473
471
 
474
- | Today (deprecated) | Reads from `manifest.projects` instead |
472
+ | Formerly | Now reads |
475
473
  | --- | --- |
476
- | RecordView citation line (`projectName(record.project_key, t)`) | `projectLabel(manifest, record.project_id, lang)` / `useProjects().label(record.project_id)` — tracked on viewer-layout#81 |
477
- | ItemSheet "Source database" line + `mwnf-chip--<family>` colour | same `projectLabel`, plus a site-config map from project UUID to a CSS token (no more `projectFamily`) |
474
+ | RecordView citation line (`projectName(record.project_key, t)`) | `projectLabel(manifest, record.project_id, lang)` / `useProjects().label(record.project_id)` |
475
+ | ItemSheet "Source database" line + `mwnf-chip--<family>` colour | `projectLabel`, plus a site-config map from project UUID to a CSS token |
478
476
  | "Search related database" block | `projectLinks(manifest, projectId).relatedDatabaseUrl`, rendered iff non-null |
479
477
  | Artistic Introduction link | `projectLinks(manifest, projectId).artisticIntroductionUrl`, iff non-null |
480
- | Search-scope include-EPM checkbox | unchanged by this phase — stays the site's own `dataset.config.js` scope list (epic decision 5) |
481
- | Partner Museums/Institutions split | unchanged by this phase — `partner.project_uuids` matched against a site-config list (epic decision 5) |
482
-
483
- `PROJECT_ENTRIES`, `PROJECT_FAMILIES` and `projectFamily` are deprecated as of this phase and will be removed in the cleanup wave once every site has migrated (phase 4); `projectName()`/`useProjectName()` are unaffected for now — they still resolve a *legacy key* through the installed texts for whatever hasn't migrated yet.
478
+ | Search-scope include-EPM checkbox | the site's own `dataset.config.js` scope list (epic decision 5) |
479
+ | Partner Museums/Institutions split | `partner.project_uuids` matched against a site-config list (epic decision 5) |
484
480
 
485
481
  ### `@museumwnf/viewer-core/legacy`
486
482
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@museumwnf/viewer-core",
3
- "version": "1.16.0",
3
+ "version": "2.0.0",
4
4
  "description": "Application engine for MWNF websites: turns a dataset.config.js into a mounted Vue application.",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -7,88 +7,11 @@ import { resolveRecordLanguage } from './composables/useRecordLanguage.js'
7
7
 
8
8
  // Three small conventions each website had written for itself.
9
9
 
10
- // ── Project names ──────────────────────────────────────────────────────────
11
- //
12
- // `mwnf3.projectnames`, the whole table rather than the projects a website
13
- // happens to borrow from, since that set moves with every reimport. The key
14
- // on the left is data; the entry on the right is a shared text
15
- // (`core.project.*` in viewer-i18n), written out so a reader can see the
16
- // eight this asks for. A key that is not here reads as itself.
17
- //
18
- // @deprecated Project data belongs in the data package, not in viewer-core.
19
- // Read a project's name from `manifest.projects` via `projectLabel()` /
20
- // `useProjects()` instead (epic metanull/inventory-app#1727, phase 3) — see
21
- // the migration table below. Kept only for sites that have not migrated yet
22
- // (phase 4); removed in the cleanup wave.
23
- export const PROJECT_ENTRIES = Object.freeze({
24
- ISL: 'core.project.islamicArt',
25
- EPM: 'core.project.explorePartners',
26
- DBA: 'core.project.baroqueArt',
27
- BAR: 'core.project.baroqueArt',
28
- AWE: 'core.project.sharingHistory',
29
- awe: 'core.project.sharingHistory',
30
- DCA: 'core.project.carpetArt',
31
- DGA: 'core.project.glassArt',
32
- EXTHE: 'core.project.tableIsSet',
33
- GALLERIES: 'core.project.galleries',
34
- })
35
-
36
- /** The name of a project by its legacy key, through `t`; the key itself when unknown. */
37
- export function projectName(key, t) {
38
- const entry = PROJECT_ENTRIES[key]
39
- return entry ? t(entry) : (key ?? '')
40
- }
41
-
42
- /** `projectName` bound to the installed texts, for a component. */
43
- export function useProjectName() {
44
- const { t } = useI18n()
45
- return (key) => projectName(key, t)
46
- }
47
-
48
- // A member is borrowed from the MWNF project that originally published it,
49
- // and legacy names and colours that project on the item sheet and in the
50
- // results grid — two separate mappings, because legacy keeps them separate:
51
- // the name is per project key (`PROJECT_ENTRIES` above), the colour is per
52
- // project *family*, so ISL and EPM share a swatch and every exhibition
53
- // shares another. The two exhibition sites re-hard-coded this table as
54
- // English literals next to their own copy of the name table, which is why a
55
- // project name translates on the galleries and not on the exhibitions.
56
- //
57
- // @deprecated Chip colour is a per-project site-config map keyed by the
58
- // project UUID (epic #1727 decision 1: no family/parent relation is modeled
59
- // anywhere, this table was always a frontend invention). Removed in the
60
- // cleanup wave alongside `PROJECT_ENTRIES`.
61
- export const PROJECT_FAMILIES = Object.freeze({
62
- ISL: 'ISLandEPM',
63
- EPM: 'ISLandEPM',
64
- DBA: 'DBA',
65
- BAR: 'DBA',
66
- AWE: 'AWE',
67
- awe: 'AWE',
68
- DCA: 'DCA',
69
- DGA: 'DGA',
70
- EXTHE: 'EXH',
71
- GALLERIES: 'Galleries',
72
- })
73
-
74
- /**
75
- * A project's family by its legacy key — legacy's own class names, so a
76
- * site's CSS reads as the stylesheet it was copied from. A key with no
77
- * entry falls back to itself, the same rule `projectName` applies.
78
- *
79
- * @deprecated See `PROJECT_FAMILIES`.
80
- */
81
- export function projectFamily(key) {
82
- return PROJECT_FAMILIES[key] ?? (key ?? '')
83
- }
84
-
85
10
  // ── Projects, from the data package ─────────────────────────────────────────
86
11
  //
87
- // `manifest.projects` (epic metanull/inventory-app#1727, phase 2 —
88
- // `scripts/exporters`) is what `PROJECT_ENTRIES`/`PROJECT_FAMILIES` above
89
- // should have been: project data belongs in the data package a project's own
90
- // exporter writes, not in a table viewer-core carries for every website. Its
91
- // shape, one entry per project UUID:
12
+ // `manifest.projects` (epic metanull/inventory-app#1727 — `scripts/exporters`)
13
+ // is project data from the data package a project's own exporter writes.
14
+ // Its shape, one entry per project UUID:
92
15
  //
93
16
  // manifest.projects[projectId] = {
94
17
  // name: { <lang>: '…' }, // per-language title
@@ -99,21 +22,8 @@ export function projectFamily(key) {
99
22
  //
100
23
  // A data package built before this phase simply has no `projects` key at
101
24
  // all; `projectLabel`/`projectLinks` answer `null` for that case exactly as
102
- // they do for an unknown `projectId` — a site notices nothing until it
103
- // migrates. Migration mapping, from the epic's design comment (§B):
104
- //
105
- // RecordView citation line → projectLabel(manifest, record.project_id, lang) (viewer-layout#81)
106
- // ItemSheet "Source database" line → same, plus a site-config colour map keyed by project UUID (no more `projectFamily`)
107
- // "Search related database" block → projectLinks(manifest, id).relatedDatabaseUrl, rendered iff non-null
108
- // Artistic Introduction link → projectLinks(manifest, id).artisticIntroductionUrl, iff non-null
109
- // search-scope include-EPM checkbox → stays the site's own dataset.config.js scope list (not modeled here — decision 5)
110
- // partner Museums/Institutions split → partner.project_uuids matched against a site-config list (decision 5)
111
- //
112
- // `PROJECT_ENTRIES`, `PROJECT_FAMILIES` and `projectFamily` are deprecated by
113
- // this section and removed in the cleanup wave once every site has moved
114
- // (phase 4). `projectName()`/`useProjectName()` are unaffected — they still
115
- // resolve a *legacy key* through the installed texts, for whatever has not
116
- // migrated yet.
25
+ // they do for an unknown `projectId`. See CHANGELOG.md 2.0.0 for the
26
+ // migration notes from this package's former legacy-key conventions.
117
27
 
118
28
  /** One entry of `manifest.projects`, or `null` when the package predates
119
29
  * the section or does not carry `projectId`. */
@@ -156,9 +66,8 @@ export function projectLinks(manifest, projectId) {
156
66
 
157
67
  /**
158
68
  * `projectLabel`/`projectLinks` bound to the installed data package and
159
- * texts, for a component — the manifest-driven analogue of
160
- * `useProjectName()`. `label(projectId)` reads the site's active language;
161
- * pass a language explicitly to read another.
69
+ * texts, for a component. `label(projectId)` reads the site's active
70
+ * language; pass a language explicitly to read another.
162
71
  */
163
72
  export function useProjects() {
164
73
  const { manifest } = useDataPackage()
@@ -168,9 +168,8 @@ export function useExhibitionData(config = {}) {
168
168
  // A member is borrowed from the MWNF project that originally published
169
169
  // it. The name is the data package's own `manifest.projects` entry
170
170
  // (populated by the importer/exporter), keyed by this record's
171
- // `project_id` (a UUID) — not viewer-core's deprecated, legacy-key-keyed
172
- // `projectName()`/`projectFamily()`, and not an exhibition's own
173
- // project-key comparisons either. The manifest already names an
171
+ // `project_id` (a UUID) — not a legacy-key lookup, and not an exhibition's
172
+ // own project-key comparisons either. The manifest already names an
174
173
  // exhibition's own native project under its own uuid (the sibling
175
174
  // `Collection` the importer creates alongside every `Project` carries the
176
175
  // same title), so there is no special case here for a native member any
@@ -44,7 +44,7 @@ export function useExhibitionTimeline(data, collection, config = {}) {
44
44
 
45
45
  /** True when the Timeline section is the exhibition's own chronology. */
46
46
  const usesLocalTimeline = computed(
47
- () => !exhibition.has_country_timeline && Boolean(localTimeline.value),
47
+ () => !exhibition.value?.has_country_timeline && Boolean(localTimeline.value),
48
48
  )
49
49
 
50
50
  /**
@@ -58,7 +58,7 @@ export function useExhibitionTimeline(data, collection, config = {}) {
58
58
  * introduction. Only the links into it are withheld.
59
59
  */
60
60
  const hasTimeline = computed(
61
- () => Boolean(exhibition.has_timeline || exhibition.has_country_timeline),
61
+ () => Boolean(exhibition.value?.has_timeline || exhibition.value?.has_country_timeline),
62
62
  )
63
63
 
64
64
  /** The events this site's manual Timeline reads (ItemSheet's own popout). */
package/src/index.js CHANGED
@@ -39,8 +39,7 @@ export { groupByCountry, partnerHierarchy } from './record/partners.js'
39
39
 
40
40
  // Conventions every website had written for itself.
41
41
  export {
42
- PROJECT_ENTRIES, PROJECT_FAMILIES, mwnfLinks, projectFamily, projectLabel,
43
- projectLinks, projectName, sectionMeta, useFeaturedRecord, useProjectName,
42
+ mwnfLinks, projectLabel, projectLinks, sectionMeta, useFeaturedRecord,
44
43
  useProjects, useSection,
45
44
  } from './conventions.js'
46
45