@museumwnf/viewer-core 1.14.0 → 1.15.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.
Files changed (43) hide show
  1. package/LICENSE.md +44 -44
  2. package/README.md +658 -635
  3. package/package.json +50 -50
  4. package/src/AppRoot.vue +58 -58
  5. package/src/catalogue/dates.js +209 -209
  6. package/src/catalogue/facets.js +61 -61
  7. package/src/catalogue/keywordIndex.js +289 -289
  8. package/src/catalogue/listQuery.js +100 -100
  9. package/src/catalogue/pagination.js +57 -57
  10. package/src/catalogue/searchLanguage.js +32 -32
  11. package/src/catalogue/timeline.js +220 -220
  12. package/src/composables/useCatalogueData.js +141 -141
  13. package/src/composables/useDataPackage.js +98 -98
  14. package/src/composables/useEntities.js +100 -100
  15. package/src/composables/useRecordLanguage.js +71 -71
  16. package/src/conventions.js +252 -148
  17. package/src/createViewer.js +29 -29
  18. package/src/i18n/I18nText.vue +17 -17
  19. package/src/i18n/I18nTextInline.vue +17 -17
  20. package/src/i18n/index.js +88 -88
  21. package/src/i18n/language.js +127 -127
  22. package/src/i18n/markdown.js +265 -265
  23. package/src/index.js +51 -50
  24. package/src/injectionKeys.js +1 -1
  25. package/src/languages.js +49 -49
  26. package/src/legacy/index.js +58 -58
  27. package/src/record/collectionTree.js +307 -307
  28. package/src/record/derivations.js +154 -154
  29. package/src/record/partners.js +87 -87
  30. package/src/record/recordSheet.js +231 -231
  31. package/src/rights.js +53 -53
  32. package/src/router/index.js +138 -138
  33. package/src/siteConfig.js +37 -37
  34. package/src/styles/base.css +49 -49
  35. package/src/testing/checkOfferedLanguages.js +67 -67
  36. package/src/testing/index.js +3 -3
  37. package/src/testing/smoke.js +103 -103
  38. package/src/testing/viteConfig.js +90 -90
  39. package/src/views/DetailView.vue +53 -53
  40. package/src/views/HomeView.vue +20 -20
  41. package/src/views/ListView.vue +61 -61
  42. package/src/views/NotFoundView.vue +8 -8
  43. package/src/vite.js +8 -8
@@ -1,61 +1,61 @@
1
- <script setup>
2
- import { computed, ref, watchEffect } from 'vue'
3
- import { useRoute } from 'vue-router'
4
- import { useDataPackage } from '../composables/useDataPackage.js'
5
- import { paginate } from '../catalogue/pagination.js'
6
-
7
- const props = defineProps({
8
- entity: { type: String, required: true },
9
- pageSize: { type: Number, default: 20 },
10
- })
11
-
12
- const route = useRoute()
13
- const { loadEntity } = useDataPackage()
14
-
15
- const records = ref(null)
16
- watchEffect(async () => {
17
- records.value = await loadEntity(props.entity)
18
- })
19
-
20
- // The same page arithmetic every website's lists use, so this generic list
21
- // and a site's results page cannot disagree on where page 3 starts.
22
- const paged = computed(() => paginate(records.value ?? [], route.query.page, props.pageSize))
23
- const page = computed(() => paged.value.currentPage)
24
- const totalPages = computed(() => paged.value.lastPage)
25
- const pageRecords = computed(() => paged.value.rows)
26
-
27
- function labelOf(record) {
28
- return record.title ?? record.name ?? record.label ?? record.id
29
- }
30
- </script>
31
-
32
- <template>
33
- <section class="vc-list">
34
- <h1>{{ entity }}</h1>
35
- <p v-if="records === null">{{ $t('core.status.loading') }}</p>
36
- <p v-else-if="records.length === 0">{{ $t('core.list.empty') }}</p>
37
- <template v-else>
38
- <ul>
39
- <li v-for="record in pageRecords" :key="record.id">
40
- <router-link :to="`/${entity}/${record.id}`">{{ labelOf(record) }}</router-link>
41
- </li>
42
- </ul>
43
- <nav v-if="totalPages > 1" class="vc-pagination">
44
- <router-link v-if="page > 1" :to="{ query: { page: page - 1 } }">
45
- {{ $t('core.pagination.previous') }}
46
- </router-link>
47
- <!-- The position is rendered here, next to the texts, rather than
48
- inserted into one: a text that has to carry a number cannot be
49
- translated without carrying the number's place in the sentence
50
- too, and that is the one thing this system does not do. -->
51
- <span class="vc-pagination__position">{{ page }} / {{ totalPages }}</span>
52
- <router-link v-if="page < totalPages" :to="{ query: { page: page + 1 } }">
53
- {{ $t('core.pagination.next') }}
54
- </router-link>
55
- </nav>
56
- </template>
57
- <p>
58
- <router-link to="/">{{ $t('core.nav.home') }}</router-link>
59
- </p>
60
- </section>
61
- </template>
1
+ <script setup>
2
+ import { computed, ref, watchEffect } from 'vue'
3
+ import { useRoute } from 'vue-router'
4
+ import { useDataPackage } from '../composables/useDataPackage.js'
5
+ import { paginate } from '../catalogue/pagination.js'
6
+
7
+ const props = defineProps({
8
+ entity: { type: String, required: true },
9
+ pageSize: { type: Number, default: 20 },
10
+ })
11
+
12
+ const route = useRoute()
13
+ const { loadEntity } = useDataPackage()
14
+
15
+ const records = ref(null)
16
+ watchEffect(async () => {
17
+ records.value = await loadEntity(props.entity)
18
+ })
19
+
20
+ // The same page arithmetic every website's lists use, so this generic list
21
+ // and a site's results page cannot disagree on where page 3 starts.
22
+ const paged = computed(() => paginate(records.value ?? [], route.query.page, props.pageSize))
23
+ const page = computed(() => paged.value.currentPage)
24
+ const totalPages = computed(() => paged.value.lastPage)
25
+ const pageRecords = computed(() => paged.value.rows)
26
+
27
+ function labelOf(record) {
28
+ return record.title ?? record.name ?? record.label ?? record.id
29
+ }
30
+ </script>
31
+
32
+ <template>
33
+ <section class="vc-list">
34
+ <h1>{{ entity }}</h1>
35
+ <p v-if="records === null">{{ $t('core.status.loading') }}</p>
36
+ <p v-else-if="records.length === 0">{{ $t('core.list.empty') }}</p>
37
+ <template v-else>
38
+ <ul>
39
+ <li v-for="record in pageRecords" :key="record.id">
40
+ <router-link :to="`/${entity}/${record.id}`">{{ labelOf(record) }}</router-link>
41
+ </li>
42
+ </ul>
43
+ <nav v-if="totalPages > 1" class="vc-pagination">
44
+ <router-link v-if="page > 1" :to="{ query: { page: page - 1 } }">
45
+ {{ $t('core.pagination.previous') }}
46
+ </router-link>
47
+ <!-- The position is rendered here, next to the texts, rather than
48
+ inserted into one: a text that has to carry a number cannot be
49
+ translated without carrying the number's place in the sentence
50
+ too, and that is the one thing this system does not do. -->
51
+ <span class="vc-pagination__position">{{ page }} / {{ totalPages }}</span>
52
+ <router-link v-if="page < totalPages" :to="{ query: { page: page + 1 } }">
53
+ {{ $t('core.pagination.next') }}
54
+ </router-link>
55
+ </nav>
56
+ </template>
57
+ <p>
58
+ <router-link to="/">{{ $t('core.nav.home') }}</router-link>
59
+ </p>
60
+ </section>
61
+ </template>
@@ -1,8 +1,8 @@
1
- <template>
2
- <section class="vc-not-found">
3
- <p>{{ $t('core.notFound.page') }}</p>
4
- <p>
5
- <router-link to="/">{{ $t('core.nav.home') }}</router-link>
6
- </p>
7
- </section>
8
- </template>
1
+ <template>
2
+ <section class="vc-not-found">
3
+ <p>{{ $t('core.notFound.page') }}</p>
4
+ <p>
5
+ <router-link to="/">{{ $t('core.nav.home') }}</router-link>
6
+ </p>
7
+ </section>
8
+ </template>
package/src/vite.js CHANGED
@@ -1,8 +1,8 @@
1
- /**
2
- * Vite configuration helper for viewer websites.
3
- * This is a separate entry point because Vite's config loader runs under Node.js,
4
- * which cannot parse .vue files. The ./testing barrel re-exports mountSite and
5
- * other test utilities that import createViewer → AppRoot.vue, making it unsafe
6
- * to import from a vite.config.js. This entry avoids that chain.
7
- */
8
- export { defineViewerConfig } from './testing/viteConfig.js'
1
+ /**
2
+ * Vite configuration helper for viewer websites.
3
+ * This is a separate entry point because Vite's config loader runs under Node.js,
4
+ * which cannot parse .vue files. The ./testing barrel re-exports mountSite and
5
+ * other test utilities that import createViewer → AppRoot.vue, making it unsafe
6
+ * to import from a vite.config.js. This entry avoids that chain.
7
+ */
8
+ export { defineViewerConfig } from './testing/viteConfig.js'