@glossarist/concept-browser 0.4.1 → 0.4.2
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glossarist/concept-browser",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Vue SPA for browsing Glossarist terminology datasets with cross-reference resolution, graph visualization, and multi-language support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -123,9 +123,13 @@ function sourcesToJsonLd(sources) {
|
|
|
123
123
|
if (s.origin.ref) {
|
|
124
124
|
const ref = s.origin.ref;
|
|
125
125
|
const refObj = { '@type': 'gl:Ref' };
|
|
126
|
-
if (ref
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
if (typeof ref === 'string') {
|
|
127
|
+
refObj['gl:source'] = ref;
|
|
128
|
+
} else {
|
|
129
|
+
if (ref.source) refObj['gl:source'] = ref.source;
|
|
130
|
+
if (ref.id) refObj['gl:id'] = ref.id;
|
|
131
|
+
if (ref.version) refObj['gl:version'] = ref.version;
|
|
132
|
+
}
|
|
129
133
|
origin['gl:ref'] = refObj;
|
|
130
134
|
}
|
|
131
135
|
if (s.origin.locality) {
|
|
@@ -119,15 +119,19 @@ function mapSourceFromJsonLd(s: any): Record<string, unknown> {
|
|
|
119
119
|
const o = s['gl:origin'];
|
|
120
120
|
if (o['gl:ref']) {
|
|
121
121
|
const rawRef = o['gl:ref'];
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
122
|
+
if (typeof rawRef === 'string') {
|
|
123
|
+
// Legacy format: gl:ref is a plain string (e.g. "ISO/TS 14812:2022")
|
|
124
|
+
origin.ref = { source: rawRef };
|
|
125
|
+
} else {
|
|
126
|
+
const refObj: Record<string, unknown> = {};
|
|
127
|
+
if (rawRef['gl:source']) refObj.source = rawRef['gl:source'];
|
|
128
|
+
if (rawRef['gl:id']) refObj.id = rawRef['gl:id'];
|
|
129
|
+
if (rawRef['gl:version']) refObj.version = rawRef['gl:version'];
|
|
130
|
+
if (rawRef['source']) refObj.source = rawRef['source'];
|
|
131
|
+
if (rawRef['id']) refObj.id = rawRef['id'];
|
|
132
|
+
if (rawRef['version']) refObj.version = rawRef['version'];
|
|
133
|
+
if (Object.keys(refObj).length > 0) origin.ref = refObj;
|
|
134
|
+
}
|
|
131
135
|
}
|
|
132
136
|
if (o['gl:locality']) {
|
|
133
137
|
const loc: Record<string, unknown> = {};
|
|
@@ -176,13 +176,14 @@ function buildSimulation(width: number, height: number) {
|
|
|
176
176
|
const renderNodes = capped ? allVisible.slice(0, MAX_RENDER_NODES) : allVisible;
|
|
177
177
|
|
|
178
178
|
const simNodes: SimNode[] = renderNodes.map(n => {
|
|
179
|
-
const
|
|
179
|
+
const lang = uiStore.selectedLang;
|
|
180
|
+
const desig = n.designations[lang] || Object.values(n.designations)[0] || '';
|
|
180
181
|
return {
|
|
181
182
|
uri: n.uri,
|
|
182
183
|
register: n.register,
|
|
183
184
|
conceptId: n.conceptId,
|
|
184
185
|
designation: desig,
|
|
185
|
-
hasDesignation: !!
|
|
186
|
+
hasDesignation: !!n.designations[lang],
|
|
186
187
|
loaded: n.loaded,
|
|
187
188
|
nodeType: n.nodeType,
|
|
188
189
|
x: width / 2 + (Math.random() - 0.5) * 200,
|
|
@@ -392,6 +393,11 @@ watch(registerEnabled, () => {
|
|
|
392
393
|
nextTick(rebuildGraph);
|
|
393
394
|
});
|
|
394
395
|
|
|
396
|
+
// Rebuild when language changes (designation labels depend on language)
|
|
397
|
+
watch(() => uiStore.selectedLang, () => {
|
|
398
|
+
nextTick(rebuildGraph);
|
|
399
|
+
});
|
|
400
|
+
|
|
395
401
|
onMounted(() => {
|
|
396
402
|
nextTick(() => {
|
|
397
403
|
if (props.nodes.length > 0) {
|
|
@@ -555,7 +561,7 @@ function selectedNodeColor(): string {
|
|
|
555
561
|
<div class="flex items-start justify-between gap-3">
|
|
556
562
|
<div class="min-w-0">
|
|
557
563
|
<h3 class="font-serif text-base text-ink-800 leading-snug truncate">
|
|
558
|
-
{{ Object.values(selectedNode.designations)[0] || selectedNode.conceptId }}
|
|
564
|
+
{{ selectedNode.designations[uiStore.selectedLang] || Object.values(selectedNode.designations)[0] || selectedNode.conceptId }}
|
|
559
565
|
</h3>
|
|
560
566
|
<p class="text-xs text-ink-300 font-mono mt-0.5">{{ selectedNode.conceptId }}</p>
|
|
561
567
|
<div class="flex items-center gap-1.5 mt-2">
|