@glossarist/concept-browser 0.3.7 → 0.4.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 (54) hide show
  1. package/README.md +3 -2
  2. package/cli/index.mjs +2 -1
  3. package/env.d.ts +5 -0
  4. package/package.json +4 -3
  5. package/scripts/build-edges.js +78 -10
  6. package/scripts/generate-data.mjs +152 -20
  7. package/scripts/generate-ontology-data.mjs +184 -0
  8. package/scripts/generate-ontology-schema.mjs +315 -0
  9. package/src/__tests__/concept-card.test.ts +1 -1
  10. package/src/__tests__/concept-detail-interaction.test.ts +40 -18
  11. package/src/__tests__/concept-formats.test.ts +32 -30
  12. package/src/__tests__/concept-timeline.test.ts +108 -83
  13. package/src/__tests__/concept-view.test.ts +15 -2
  14. package/src/__tests__/dataset-adapter.test.ts +172 -23
  15. package/src/__tests__/dataset-view.test.ts +6 -5
  16. package/src/__tests__/designation-registry.test.ts +161 -0
  17. package/src/__tests__/graph.test.ts +62 -0
  18. package/src/__tests__/language-detail.test.ts +117 -60
  19. package/src/__tests__/ontology-registry.test.ts +109 -0
  20. package/src/__tests__/relationship-categories.test.ts +62 -0
  21. package/src/__tests__/test-helpers.ts +11 -8
  22. package/src/adapters/DatasetAdapter.ts +171 -48
  23. package/src/adapters/model-bridge.ts +277 -0
  24. package/src/adapters/ontology-registry.ts +75 -0
  25. package/src/adapters/ontology-schema.ts +100 -0
  26. package/src/adapters/types.ts +52 -77
  27. package/src/components/AppSidebar.vue +1 -1
  28. package/src/components/CitationDisplay.vue +35 -0
  29. package/src/components/ConceptDetail.vue +334 -93
  30. package/src/components/ConceptRdfView.vue +397 -0
  31. package/src/components/ConceptTimeline.vue +56 -52
  32. package/src/components/GraphPanel.vue +96 -31
  33. package/src/components/LanguageDetail.vue +45 -37
  34. package/src/components/NavIcon.vue +1 -0
  35. package/src/components/NonVerbalRepDisplay.vue +38 -0
  36. package/src/components/RelationshipList.vue +99 -0
  37. package/src/config/use-site-config.ts +3 -0
  38. package/src/data/ontology-schema.json +1551 -0
  39. package/src/data/taxonomies.json +543 -0
  40. package/src/graph/GraphEngine.ts +7 -4
  41. package/src/router/index.ts +5 -0
  42. package/src/shims/empty.ts +1 -0
  43. package/src/shims/node-crypto.ts +6 -0
  44. package/src/shims/node-path.ts +10 -0
  45. package/src/stores/vocabulary.ts +75 -25
  46. package/src/style.css +74 -20
  47. package/src/utils/concept-formats.ts +22 -20
  48. package/src/utils/concept-helpers.ts +43 -23
  49. package/src/utils/designation-registry.ts +124 -0
  50. package/src/utils/relationship-categories.ts +84 -0
  51. package/src/views/OntologySchemaView.vue +302 -0
  52. package/src/views/PageView.vue +28 -17
  53. package/src/views/StatsView.vue +34 -12
  54. package/vite.config.ts +8 -0
@@ -0,0 +1,84 @@
1
+ import { ontology } from '../adapters/ontology-registry';
2
+
3
+ export interface RelationshipCategory {
4
+ id: string;
5
+ label: string;
6
+ types: string[];
7
+ color: string;
8
+ }
9
+
10
+ export const RELATIONSHIP_CATEGORIES: RelationshipCategory[] = [
11
+ {
12
+ id: 'hierarchical',
13
+ label: 'Hierarchy',
14
+ types: ['broader', 'narrower', 'broader_generic', 'narrower_generic',
15
+ 'broader_partitive', 'narrower_partitive', 'broader_instantial', 'narrower_instantial'],
16
+ color: 'text-blue-600 bg-blue-50',
17
+ },
18
+ {
19
+ id: 'mapping',
20
+ label: 'Equivalence',
21
+ types: ['equivalent', 'close_match', 'broad_match', 'narrow_match', 'related_match'],
22
+ color: 'text-emerald-600 bg-emerald-50',
23
+ },
24
+ {
25
+ id: 'associative',
26
+ label: 'Associative',
27
+ types: ['see', 'related_concept', 'related_concept_broader', 'related_concept_narrower', 'references'],
28
+ color: 'text-violet-600 bg-violet-50',
29
+ },
30
+ {
31
+ id: 'lifecycle',
32
+ label: 'Lifecycle',
33
+ types: ['deprecates', 'supersedes', 'superseded_by', 'replaces'],
34
+ color: 'text-red-600 bg-red-50',
35
+ },
36
+ {
37
+ id: 'comparative',
38
+ label: 'Comparison',
39
+ types: ['compare', 'contrast'],
40
+ color: 'text-amber-600 bg-amber-50',
41
+ },
42
+ {
43
+ id: 'spatiotemporal',
44
+ label: 'Spatiotemporal',
45
+ types: ['sequentially_related', 'spatially_related', 'temporally_related'],
46
+ color: 'text-teal-600 bg-teal-50',
47
+ },
48
+ {
49
+ id: 'lexical',
50
+ label: 'Lexical',
51
+ types: ['homograph', 'false_friend'],
52
+ color: 'text-pink-600 bg-pink-50',
53
+ },
54
+ {
55
+ id: 'designation',
56
+ label: 'Designation',
57
+ types: ['abbreviated_form_for', 'short_form_for'],
58
+ color: 'text-gray-600 bg-gray-50',
59
+ },
60
+ ];
61
+
62
+ const CATEGORY_MAP = new Map<string, RelationshipCategory>();
63
+ for (const cat of RELATIONSHIP_CATEGORIES) {
64
+ for (const t of cat.types) {
65
+ CATEGORY_MAP.set(t, cat);
66
+ }
67
+ }
68
+
69
+ export function categorizeRelationship(type: string): RelationshipCategory {
70
+ return CATEGORY_MAP.get(type) ?? { id: 'other', label: 'Other', types: [type], color: 'text-gray-600 bg-gray-50' };
71
+ }
72
+
73
+ export function relationshipLabel(type: string): string {
74
+ // Check the ontology taxonomy first (for glossarist-specific types)
75
+ const concept = ontology.getConcept('relationshipType', type);
76
+ if (concept?.prefLabel) return concept.prefLabel;
77
+
78
+ // Fallback: humanize the type string
79
+ return type.replace(/_/g, ' ').replace(/\b\w/g, c => c.toUpperCase());
80
+ }
81
+
82
+ export function relationshipDefinition(type: string): string | null {
83
+ return ontology.getDefinition('relationshipType', type);
84
+ }
@@ -0,0 +1,302 @@
1
+ <script setup lang="ts">
2
+ import { ref, computed } from 'vue';
3
+ import {
4
+ getClass,
5
+ getAllClasses,
6
+ getClassTree,
7
+ getAllPropertiesForClass,
8
+ getStats,
9
+ type OwlClass,
10
+ } from '../adapters/ontology-schema';
11
+ import { ontology, type TaxonomyConcept } from '../adapters/ontology-registry';
12
+
13
+ const stats = getStats();
14
+ const allClasses = getAllClasses();
15
+ const treeRoots = getClassTree();
16
+
17
+ const taxonomyKeys = [
18
+ 'conceptStatus', 'entryStatus', 'normativeStatus', 'sourceType', 'sourceStatus',
19
+ 'relationshipType', 'designationType', 'termType', 'grammarGender', 'grammarNumber',
20
+ ];
21
+
22
+ const taxonomyLabels: Record<string, string> = {
23
+ conceptStatus: 'Concept Status',
24
+ entryStatus: 'Entry Status',
25
+ normativeStatus: 'Normative Status',
26
+ sourceType: 'Source Type',
27
+ sourceStatus: 'Source Status',
28
+ relationshipType: 'Relationship Type',
29
+ designationType: 'Designation Type',
30
+ termType: 'Term Type',
31
+ grammarGender: 'Grammar Gender',
32
+ grammarNumber: 'Grammar Number',
33
+ };
34
+
35
+ const activeClassId = ref('gloss:Concept');
36
+ const showTaxonomies = ref(false);
37
+ const activeTaxonomy = ref<string | null>(null);
38
+
39
+ const activeClass = computed(() => getClass(activeClassId.value));
40
+ const activeProperties = computed(() => getAllPropertiesForClass(activeClassId.value));
41
+
42
+ function activeTaxonomyData() {
43
+ if (!activeTaxonomy.value) return null;
44
+ const key = activeTaxonomy.value as Parameters<typeof ontology.getAll>[0];
45
+ const all = ontology.getAll(key);
46
+ const top = all.filter(c => !c.broader);
47
+ return { scheme: ontology.getScheme(key), concepts: all, top };
48
+ }
49
+
50
+ function childClasses(parentId: string): OwlClass[] {
51
+ const cls = getClass(parentId);
52
+ if (!cls) return [];
53
+ return cls.children.map(id => getClass(id)).filter((c): c is OwlClass => !!c);
54
+ }
55
+
56
+ function hasChildren(cls: OwlClass): boolean {
57
+ return cls.children.length > 0;
58
+ }
59
+
60
+ const expandedClasses = ref(new Set<string>(['gloss:Concept', 'gloss:Designation']));
61
+
62
+ function toggleExpand(cls: OwlClass) {
63
+ const s = new Set(expandedClasses.value);
64
+ if (s.has(cls.compact)) s.delete(cls.compact);
65
+ else s.add(cls.compact);
66
+ expandedClasses.value = s;
67
+ }
68
+
69
+ const allNavItems = computed(() => {
70
+ const items: { id: string; label: string; depth: number }[] = [];
71
+ function walk(classes: OwlClass[], depth: number) {
72
+ for (const cls of classes) {
73
+ items.push({ id: cls.compact, label: cls.label, depth });
74
+ if (expandedClasses.value.has(cls.compact)) {
75
+ walk(childClasses(cls.compact), depth + 1);
76
+ }
77
+ }
78
+ }
79
+ walk(treeRoots, 0);
80
+ return items;
81
+ });
82
+ </script>
83
+
84
+ <template>
85
+ <div class="max-w-5xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
86
+ <!-- Header -->
87
+ <div class="mb-8">
88
+ <h1 class="text-2xl sm:text-3xl font-semibold text-ink-800">Glossarist Ontology</h1>
89
+ <p class="text-sm text-ink-400 mt-1">
90
+ OWL ontology for terminology management (ISO 10241-1, 30042, 12620, 25964/SKOS)
91
+ </p>
92
+ <div class="max-w-2xl mt-3 text-sm text-ink-500 leading-relaxed space-y-2">
93
+ <p>The Glossarist ontology defines the RDF/OWL vocabulary for describing structured terminology data. It models <strong>concepts</strong> with multilingual <strong>localizations</strong> (definitions, notes, examples) and typed <strong>designations</strong> (expressions, abbreviations, symbols) using the SKOS-XL pattern for reified lexical labels.</p>
94
+ <p>It aligns with <strong>SKOS</strong> (concepts and relationships), <strong>SKOS-XL</strong> (designations as labels), <strong>ISO 25964</strong> (hierarchical relationship subtypes — generic, partitive, instantial), <strong>PROV-O</strong> (source provenance), and <strong>Dublin Core Terms</strong> (language, citation). Enumeration values use SKOS ConceptSchemes (10 taxonomies).</p>
95
+ </div>
96
+ <div class="flex flex-wrap gap-2 mt-4">
97
+ <span class="badge badge-blue text-[10px]">{{ stats.classCount }} classes</span>
98
+ <span class="badge text-[10px] bg-emerald-50 text-emerald-700">{{ stats.objectPropertyCount }} object properties</span>
99
+ <span class="badge text-[10px] bg-amber-50 text-amber-700">{{ stats.datatypePropertyCount }} datatype properties</span>
100
+ <span class="badge text-[10px] bg-purple-50 text-purple-700">{{ taxonomyKeys.length }} SKOS taxonomies</span>
101
+ </div>
102
+ <code class="block text-xs text-ink-400 mt-2">https://www.glossarist.org/ontologies/glossarist</code>
103
+ </div>
104
+
105
+ <!-- Sticky mobile chips -->
106
+ <div class="lg:hidden sticky top-14 z-10 bg-surface -mx-4 px-4 py-2 border-b border-ink-100/60 mb-4">
107
+ <div class="flex gap-2 overflow-x-auto scrollbar-none">
108
+ <button v-for="item in allNavItems" :key="item.id"
109
+ @click="activeClassId = item.id; activeTaxonomy = null"
110
+ class="flex-shrink-0 px-3 py-2.5 rounded-lg text-xs font-medium whitespace-nowrap transition-colors min-h-[44px] flex items-center gap-1.5"
111
+ :class="activeClassId === item.id && !activeTaxonomy
112
+ ? 'bg-ink-800 text-white'
113
+ : 'bg-surface-raised border border-ink-100 text-ink-600 hover:bg-ink-50'"
114
+ >
115
+ <span v-if="item.depth > 0" class="text-ink-300">{{ ' '.repeat(item.depth * 2) }}</span>
116
+ {{ item.label }}
117
+ </button>
118
+ <button @click="activeTaxonomy = activeTaxonomy ? null : taxonomyKeys[0]; showTaxonomies = true"
119
+ class="flex-shrink-0 px-3 py-2.5 rounded-lg text-xs font-medium whitespace-nowrap transition-colors min-h-[44px] flex items-center gap-1.5"
120
+ :class="activeTaxonomy
121
+ ? 'bg-ink-800 text-white'
122
+ : 'bg-surface-raised border border-ink-100 text-ink-600 hover:bg-ink-50'"
123
+ >Taxonomies</button>
124
+ </div>
125
+ </div>
126
+
127
+ <!-- Two-column layout -->
128
+ <div class="lg:grid lg:grid-cols-[220px_1fr] lg:gap-6">
129
+ <!-- Left: tree sidebar (desktop only) -->
130
+ <nav class="hidden lg:block border-r border-ink-100/60 pr-4">
131
+ <div class="section-label mb-2">Classes</div>
132
+
133
+ <!-- Tree roots with recursive children -->
134
+ <template v-for="root in treeRoots" :key="root.compact">
135
+ <div>
136
+ <button @click="activeClassId = root.compact; activeTaxonomy = null; toggleExpand(root)"
137
+ class="w-full flex items-center gap-1.5 px-2 py-2 rounded-lg text-sm transition-colors"
138
+ :class="activeClassId === root.compact && !activeTaxonomy ? 'bg-ink-800/8 text-blue-700 font-medium' : 'text-ink-600 hover:bg-ink-50'"
139
+ >
140
+ <span v-if="hasChildren(root)" class="text-[10px] text-ink-300 w-3">{{ expandedClasses.has(root.compact) ? '▾' : '▸' }}</span>
141
+ <span v-else class="w-3"></span>
142
+ <span class="flex-1 text-left">{{ root.label }}</span>
143
+ </button>
144
+
145
+ <!-- Children -->
146
+ <div v-if="expandedClasses.has(root.compact) && hasChildren(root)" class="ml-4">
147
+ <template v-for="child in childClasses(root.compact)" :key="child.compact">
148
+ <button @click="activeClassId = child.compact; activeTaxonomy = null; toggleExpand(child)"
149
+ class="w-full flex items-center gap-1.5 px-2 py-1.5 rounded-lg text-xs transition-colors"
150
+ :class="activeClassId === child.compact && !activeTaxonomy ? 'bg-ink-800/8 text-blue-700 font-medium' : 'text-ink-500 hover:bg-ink-50'"
151
+ >
152
+ <span v-if="hasChildren(child)" class="text-[10px] text-ink-300 w-3">{{ expandedClasses.has(child.compact) ? '▾' : '▸' }}</span>
153
+ <span v-else class="w-3 text-ink-200">·</span>
154
+ <span class="flex-1 text-left">{{ child.label }}</span>
155
+ </button>
156
+ <!-- Grandchildren -->
157
+ <div v-if="expandedClasses.has(child.compact) && hasChildren(child)" class="ml-4">
158
+ <button v-for="gc in childClasses(child.compact)" :key="gc.compact"
159
+ @click="activeClassId = gc.compact; activeTaxonomy = null"
160
+ class="w-full flex items-center gap-1.5 px-2 py-1.5 rounded-lg text-xs transition-colors"
161
+ :class="activeClassId === gc.compact && !activeTaxonomy ? 'bg-ink-800/8 text-blue-700 font-medium' : 'text-ink-400 hover:bg-ink-50'"
162
+ >
163
+ <span class="w-3 text-ink-200">·</span>
164
+ <span class="flex-1 text-left">{{ gc.label }}</span>
165
+ </button>
166
+ </div>
167
+ </template>
168
+ </div>
169
+ </div>
170
+ </template>
171
+
172
+ <!-- Remaining classes not in tree (supporting) -->
173
+ <div class="mt-4 pt-3 border-t border-ink-100/40">
174
+ <div class="text-[10px] uppercase tracking-wide text-ink-300 mb-1.5">Supporting</div>
175
+ <button v-for="cls in allClasses.filter(c => c.children.length === 0 && !c.subClassOf?.startsWith('gloss:') && c.compact !== 'gloss:Concept' && c.compact !== 'gloss:ConceptCollection')" :key="cls.compact"
176
+ @click="activeClassId = cls.compact; activeTaxonomy = null"
177
+ class="w-full flex items-center gap-1.5 px-2 py-1.5 rounded-lg text-xs transition-colors"
178
+ :class="activeClassId === cls.compact && !activeTaxonomy ? 'bg-ink-800/8 text-blue-700 font-medium' : 'text-ink-400 hover:bg-ink-50'"
179
+ >
180
+ <span class="w-3 text-ink-200">·</span>
181
+ <span class="flex-1 text-left">{{ cls.label }}</span>
182
+ </button>
183
+ </div>
184
+
185
+ <!-- Taxonomies -->
186
+ <div class="mt-4 pt-3 border-t border-ink-100/40">
187
+ <div class="text-[10px] uppercase tracking-wide text-ink-300 mb-1.5">SKOS Taxonomies</div>
188
+ <button v-for="tk in taxonomyKeys" :key="tk"
189
+ @click="activeTaxonomy = tk; showTaxonomies = true"
190
+ class="w-full flex items-center gap-1.5 px-2 py-1.5 rounded-lg text-xs transition-colors"
191
+ :class="activeTaxonomy === tk ? 'bg-ink-800/8 text-blue-700 font-medium' : 'text-ink-400 hover:bg-ink-50'"
192
+ >
193
+ <span class="w-3 text-ink-200">·</span>
194
+ <span class="flex-1 text-left">{{ taxonomyLabels[tk] }}</span>
195
+ </button>
196
+ </div>
197
+ </nav>
198
+
199
+ <!-- Right: detail panel -->
200
+ <div class="mt-4 lg:mt-0">
201
+ <!-- Class detail -->
202
+ <template v-if="!activeTaxonomy && activeClass">
203
+ <div class="pb-4 border-b border-ink-100/60 mb-4">
204
+ <h2 class="text-lg font-semibold text-ink-800">{{ activeClass.label }}</h2>
205
+ <code class="block text-xs text-ink-400 mt-1">{{ activeClass.iri }}</code>
206
+ <div v-if="activeClass.subClassOf" class="flex items-center gap-2 mt-2 text-sm">
207
+ <span class="text-ink-400 text-xs">subClassOf</span>
208
+ <code class="text-xs text-ink-600 bg-ink-50 px-2 py-0.5 rounded">{{ activeClass.subClassOf }}</code>
209
+ <template v-if="activeClass.ancestors.length > 1">
210
+ <span class="text-ink-300 text-xs">→</span>
211
+ <code class="text-xs text-ink-500">{{ activeClass.ancestors.slice(1).join(' → ') }}</code>
212
+ </template>
213
+ </div>
214
+ <p v-if="activeClass.comment" class="text-sm text-ink-500 mt-3 leading-relaxed">{{ activeClass.comment }}</p>
215
+ </div>
216
+
217
+ <!-- Object Properties -->
218
+ <div v-if="activeProperties.object.length" class="mb-6">
219
+ <h3 class="text-xs uppercase tracking-wide text-ink-300 font-medium mb-2">
220
+ Object Properties ({{ activeProperties.object.length }})
221
+ </h3>
222
+ <table class="w-full text-sm border-collapse">
223
+ <thead>
224
+ <tr class="border-b border-ink-100/60">
225
+ <th class="text-left text-[11px] font-medium text-ink-400 uppercase tracking-wide py-2 px-3">Property</th>
226
+ <th class="text-left text-[11px] font-medium text-ink-400 uppercase tracking-wide py-2 px-3">Range</th>
227
+ <th class="text-left text-[11px] font-medium text-ink-400 uppercase tracking-wide py-2 px-3">Description</th>
228
+ </tr>
229
+ </thead>
230
+ <tbody>
231
+ <tr v-for="p in activeProperties.object" :key="p.compact" class="border-b border-ink-100/30">
232
+ <td class="py-2 px-3 align-top">
233
+ <code class="text-xs text-blue-600 bg-blue-50 px-1.5 py-0.5 rounded">{{ p.compact }}</code>
234
+ <div v-if="p.inverseOf" class="text-[10px] text-ink-300 mt-0.5">↔ {{ p.inverseOf }}</div>
235
+ </td>
236
+ <td class="py-2 px-3 align-top">
237
+ <code class="text-xs text-ink-500">{{ p.range || p.rangeUnion?.join(' | ') || '—' }}</code>
238
+ </td>
239
+ <td class="py-2 px-3 text-xs text-ink-400 align-top">{{ p.comment || '' }}</td>
240
+ </tr>
241
+ </tbody>
242
+ </table>
243
+ </div>
244
+
245
+ <!-- Datatype Properties -->
246
+ <div v-if="activeProperties.datatype.length">
247
+ <h3 class="text-xs uppercase tracking-wide text-ink-300 font-medium mb-2">
248
+ Datatype Properties ({{ activeProperties.datatype.length }})
249
+ </h3>
250
+ <table class="w-full text-sm border-collapse">
251
+ <thead>
252
+ <tr class="border-b border-ink-100/60">
253
+ <th class="text-left text-[11px] font-medium text-ink-400 uppercase tracking-wide py-2 px-3">Property</th>
254
+ <th class="text-left text-[11px] font-medium text-ink-400 uppercase tracking-wide py-2 px-3">Datatype</th>
255
+ <th class="text-left text-[11px] font-medium text-ink-400 uppercase tracking-wide py-2 px-3">Description</th>
256
+ </tr>
257
+ </thead>
258
+ <tbody>
259
+ <tr v-for="p in activeProperties.datatype" :key="p.compact" class="border-b border-ink-100/30">
260
+ <td class="py-2 px-3 align-top">
261
+ <code class="text-xs text-blue-600 bg-blue-50 px-1.5 py-0.5 rounded">{{ p.compact }}</code>
262
+ </td>
263
+ <td class="py-2 px-3 align-top">
264
+ <code class="text-xs text-ink-500">{{ p.range || '—' }}</code>
265
+ </td>
266
+ <td class="py-2 px-3 text-xs text-ink-400 align-top">{{ p.comment || '' }}</td>
267
+ </tr>
268
+ </tbody>
269
+ </table>
270
+ </div>
271
+
272
+ <div v-if="!activeProperties.object.length && !activeProperties.datatype.length" class="text-sm text-ink-300 italic">
273
+ No properties defined directly on this class.
274
+ </div>
275
+ </template>
276
+
277
+ <!-- Taxonomy detail -->
278
+ <template v-if="activeTaxonomy && activeTaxonomyData()">
279
+ <div class="pb-4 border-b border-ink-100/60 mb-4">
280
+ <h2 class="text-lg font-semibold text-ink-800">{{ taxonomyLabels[activeTaxonomy] }}</h2>
281
+ <code class="block text-xs text-ink-400 mt-1">{{ activeTaxonomyData()!.scheme }}</code>
282
+ </div>
283
+
284
+ <div class="space-y-2">
285
+ <div v-for="concept in activeTaxonomyData()!.concepts" :key="concept.id"
286
+ class="border border-ink-100/60 rounded-lg p-3">
287
+ <div class="flex items-center gap-2">
288
+ <code class="text-xs font-semibold text-ink-700">{{ concept.id }}</code>
289
+ <span class="text-sm text-ink-600">{{ concept.prefLabel }}</span>
290
+ <span v-if="concept.altLabel" class="text-xs text-ink-400">({{ concept.altLabel }})</span>
291
+ </div>
292
+ <p v-if="concept.definition" class="text-xs text-ink-400 mt-1 leading-relaxed">{{ concept.definition }}</p>
293
+ <div v-if="concept.broader" class="text-[10px] text-ink-300 mt-1">
294
+ broader: <code class="text-ink-400">{{ concept.broader }}</code>
295
+ </div>
296
+ </div>
297
+ </div>
298
+ </template>
299
+ </div>
300
+ </div>
301
+ </div>
302
+ </template>
@@ -8,29 +8,36 @@ interface PageData {
8
8
  }
9
9
 
10
10
  const route = useRoute();
11
- const slug = computed(() => {
12
- if (route.params.slug) return route.params.slug as string;
11
+ const registerId = computed(() => route.params.registerId as string | undefined);
12
+ const pageName = computed(() => {
13
13
  if (route.params.page) return route.params.page as string;
14
- if (route.name === 'about' || route.name === 'about-global') return 'about';
15
- const path = route.path.replace(/^\//, '').replace(/\/$/, '');
16
- const lastSegment = path.split('/').pop() || '';
17
- return lastSegment;
14
+ if (route.params.slug) return route.params.slug as string;
15
+ return 'about';
18
16
  });
17
+
19
18
  const data = ref<PageData | null>(null);
20
19
  const loading = ref(true);
21
20
  const notFound = ref(false);
22
21
 
23
22
  onMounted(async () => {
24
- try {
25
- const resp = await fetch(`/pages/${slug.value}.json`);
26
- if (resp.ok) {
27
- data.value = await resp.json();
28
- } else {
29
- notFound.value = true;
30
- }
31
- } catch {
32
- notFound.value = true;
23
+ const page = pageName.value;
24
+ const dsId = registerId.value;
25
+
26
+ const urls = dsId
27
+ ? [`/pages/${dsId}-${page}.json`, `/pages/${page}.json`]
28
+ : [`/pages/${page}.json`];
29
+
30
+ for (const url of urls) {
31
+ try {
32
+ const resp = await fetch(url);
33
+ if (resp.ok) {
34
+ data.value = await resp.json();
35
+ loading.value = false;
36
+ return;
37
+ }
38
+ } catch { /* try next */ }
33
39
  }
40
+ notFound.value = true;
34
41
  loading.value = false;
35
42
  });
36
43
  </script>
@@ -39,8 +46,12 @@ onMounted(async () => {
39
46
  <div class="max-w-3xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
40
47
  <nav aria-label="Breadcrumb" class="flex items-center gap-1.5 text-sm text-ink-400 mb-6">
41
48
  <router-link :to="{ name: 'home' }" class="hover:text-ink-700 transition-colors">Home</router-link>
49
+ <template v-if="registerId">
50
+ <span class="text-ink-200">/</span>
51
+ <router-link :to="{ name: 'dataset', params: { registerId } }" class="hover:text-ink-700 transition-colors">{{ registerId }}</router-link>
52
+ </template>
42
53
  <span class="text-ink-200">/</span>
43
- <span class="text-ink-700">{{ data?.title || slug }}</span>
54
+ <span class="text-ink-700">{{ data?.title || pageName }}</span>
44
55
  </nav>
45
56
 
46
57
  <template v-if="loading">
@@ -55,7 +66,7 @@ onMounted(async () => {
55
66
  <template v-else-if="notFound">
56
67
  <div class="card p-8 text-center">
57
68
  <h1 class="font-serif text-2xl text-ink-800 mb-2">Page Not Found</h1>
58
- <p class="text-ink-500 mb-4">The page "{{ slug }}" does not exist.</p>
69
+ <p class="text-ink-500 mb-4">The page "{{ pageName }}" does not exist.</p>
59
70
  <router-link :to="{ name: 'home' }" class="btn-primary">Go Home</router-link>
60
71
  </div>
61
72
  </template>
@@ -23,11 +23,28 @@ const stats = computed(() => {
23
23
  const m = manifest.value;
24
24
  if (!m) return { langs: [], total: 0 };
25
25
 
26
+ // Scan the index for actual language coverage
27
+ const adapter = store.datasets.get(resolvedId.value);
28
+ const conceptCounts: Record<string, number> = {};
29
+
30
+ if (adapter) {
31
+ const concepts = adapter.getConcepts();
32
+ for (const c of concepts) {
33
+ if (!c) continue;
34
+ for (const lang of Object.keys(c.designations)) {
35
+ conceptCounts[lang] = (conceptCounts[lang] || 0) + 1;
36
+ }
37
+ }
38
+ }
39
+
40
+ // Merge with manifest languageStats (for definition counts)
26
41
  const ls = m.languageStats || {};
27
- const langs: LangStat[] = m.languages.map(lang => ({
42
+ const allLangs = new Set([...Object.keys(conceptCounts), ...m.languages]);
43
+
44
+ const langs: LangStat[] = [...allLangs].map(lang => ({
28
45
  lang,
29
- terms: ls[lang]?.terms ?? 0,
30
- definitions: ls[lang]?.definitions ?? 0,
46
+ terms: conceptCounts[lang] ?? ls[lang]?.terms ?? 0,
47
+ definitions: ls[lang]?.definitions ?? conceptCounts[lang] ?? 0,
31
48
  }));
32
49
 
33
50
  // Sort: eng first, then by term count descending
@@ -41,6 +58,13 @@ const stats = computed(() => {
41
58
  });
42
59
 
43
60
  const maxTerms = computed(() => Math.max(...stats.value.langs.map(l => l.terms), 1));
61
+
62
+ function coverageColor(ratio: number): string {
63
+ if (ratio >= 0.8) return 'bg-emerald-500';
64
+ if (ratio >= 0.5) return 'bg-blue-500';
65
+ if (ratio >= 0.25) return 'bg-amber-500';
66
+ return 'bg-red-400';
67
+ }
44
68
  </script>
45
69
 
46
70
  <template>
@@ -80,11 +104,11 @@ const maxTerms = computed(() => Math.max(...stats.value.langs.map(l => l.terms),
80
104
  <div class="card -mx-4 sm:mx-0 overflow-x-auto">
81
105
  <table class="w-full text-sm">
82
106
  <thead>
83
- <tr class="border-b border-ink-100/60 bg-ink-50/50">
84
- <th class="text-left px-5 py-3 text-ink-500 font-medium">Language</th>
85
- <th class="text-right px-5 py-3 text-ink-500 font-medium">Terms</th>
86
- <th class="text-right px-5 py-3 text-ink-500 font-medium">Definitions</th>
87
- <th class="px-5 py-3 text-ink-500 font-medium w-40"></th>
107
+ <tr class="border-b border-ink-100/60 bg-ink-50">
108
+ <th class="text-left px-5 py-3 text-ink-600 font-medium text-xs uppercase tracking-wide">Language</th>
109
+ <th class="text-right px-5 py-3 text-ink-600 font-medium text-xs uppercase tracking-wide">Terms</th>
110
+ <th class="text-right px-5 py-3 text-ink-600 font-medium text-xs uppercase tracking-wide">Definitions</th>
111
+ <th class="px-5 py-3 text-ink-600 font-medium w-40"></th>
88
112
  </tr>
89
113
  </thead>
90
114
  <tbody>
@@ -103,10 +127,8 @@ const maxTerms = computed(() => Math.max(...stats.value.langs.map(l => l.terms),
103
127
  <div class="h-2 rounded-full bg-ink-50 overflow-hidden flex-1">
104
128
  <div
105
129
  class="h-full rounded-full transition-all duration-500"
106
- :style="{
107
- width: (s.terms / maxTerms * 100) + '%',
108
- backgroundColor: getColor(resolvedId),
109
- }"
130
+ :class="coverageColor(s.terms / maxTerms)"
131
+ :style="{ width: (s.terms / maxTerms * 100) + '%' }"
110
132
  ></div>
111
133
  </div>
112
134
  <span class="text-xs text-ink-300 w-10 text-right tabular-nums">{{ Math.round(s.terms / maxTerms * 100) }}%</span>
package/vite.config.ts CHANGED
@@ -6,6 +6,8 @@ import { fileURLToPath } from 'url'
6
6
  const __dirname = dirname(fileURLToPath(import.meta.url))
7
7
  const cwd = process.cwd()
8
8
 
9
+ const isTest = process.env.VITEST !== undefined
10
+
9
11
  export default defineConfig({
10
12
  base: process.env.BASE_PATH || '/',
11
13
  root: __dirname,
@@ -18,6 +20,12 @@ export default defineConfig({
18
20
  resolve: {
19
21
  alias: {
20
22
  '@': resolve(__dirname, 'src'),
23
+ // Shim Node.js built-ins used by glossarist-js (not needed in browser, only for build)
24
+ ...(!isTest ? {
25
+ crypto: resolve(__dirname, 'src/shims/node-crypto.ts'),
26
+ fs: resolve(__dirname, 'src/shims/empty.ts'),
27
+ path: resolve(__dirname, 'src/shims/node-path.ts'),
28
+ } : {}),
21
29
  },
22
30
  },
23
31
  test: {