@glossarist/concept-browser 0.7.100 → 0.7.102

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 (58) hide show
  1. package/cli/index.mjs +14 -251
  2. package/cli/index.ts +289 -0
  3. package/package.json +3 -2
  4. package/src/__tests__/__fixtures__/concepts.ts +3 -3
  5. package/src/__tests__/components/learn/learn-card-dimension-card.test.ts +112 -0
  6. package/src/__tests__/composables/use-concept-edges-v2.test.ts +1 -0
  7. package/src/__tests__/designation-relationship.test.ts +2 -2
  8. package/src/__tests__/perf/serialization-perf.test.ts +1 -0
  9. package/src/__tests__/use-rdf-document.test.ts +1 -0
  10. package/src/__tests__/views/learn/learn-designations-view.test.ts +84 -0
  11. package/src/__tests__/views/learn/learn-index-view.test.ts +45 -0
  12. package/src/__tests__/views/learn/learn-relationships-view.test.ts +83 -0
  13. package/src/__tests__/views/learn/learn-statuses-view.test.ts +60 -0
  14. package/src/adapters/bibliography-adapter.ts +1 -1
  15. package/src/adapters/model-bridge.ts +15 -15
  16. package/src/adapters/non-verbal/figure-bridge.ts +2 -2
  17. package/src/adapters/non-verbal/formula-bridge.ts +2 -2
  18. package/src/adapters/non-verbal/table-bridge.ts +2 -2
  19. package/src/components/CitationDisplay.vue +1 -1
  20. package/src/components/ConceptDetail.vue +2 -2
  21. package/src/components/ConceptDiffModal.vue +2 -2
  22. package/src/components/ConceptDiffView.vue +1 -1
  23. package/src/components/DesignationList.vue +4 -4
  24. package/src/components/NavIcon.vue +1 -0
  25. package/src/components/RelationSphere.vue +1 -1
  26. package/src/components/figure/FigureDisplay.vue +5 -5
  27. package/src/components/formula/FormulaDisplay.vue +4 -4
  28. package/src/components/learn/DimensionCard.vue +71 -0
  29. package/src/components/learn/LearnCard.vue +59 -0
  30. package/src/components/table/TableDisplay.vue +3 -3
  31. package/src/components/use-rdf-document.ts +16 -7
  32. package/src/composables/use-concept-content.ts +3 -3
  33. package/src/composables/use-concept-diff.ts +2 -2
  34. package/src/composables/use-concept-edges.ts +3 -3
  35. package/src/config/page-types.ts +1 -1
  36. package/src/i18n/locales/eng.yml +114 -9
  37. package/src/i18n/locales/fra.yml +114 -9
  38. package/src/layouts/Default.astro +32 -2
  39. package/src/router/index.ts +21 -2
  40. package/src/utils/content-renderer.ts +1 -1
  41. package/src/utils/partitive-multiplicity.ts +3 -2
  42. package/src/views/ConceptView.vue +3 -3
  43. package/src/views/learn/LearnDesignationsView.vue +190 -0
  44. package/src/views/learn/LearnIndexView.vue +75 -0
  45. package/src/views/learn/LearnRelationshipsView.vue +317 -0
  46. package/src/views/learn/LearnStatusesView.vue +114 -0
  47. package/tailwind.config.js +3 -3
  48. package/tsconfig.json +1 -1
  49. package/src/__tests__/views/relation-types-view.test.ts +0 -85
  50. package/src/adapters/model-bridge/bridges.ts +0 -159
  51. package/src/adapters/model-bridge/concept.ts +0 -97
  52. package/src/adapters/model-bridge/entity-refs.ts +0 -49
  53. package/src/adapters/model-bridge/hyperedge.ts +0 -103
  54. package/src/adapters/model-bridge/index.ts +0 -46
  55. package/src/adapters/model-bridge/mappers.ts +0 -277
  56. package/src/adapters/model-bridge/partitive.ts +0 -79
  57. package/src/adapters/non-verbal/glossarist-augment.d.ts +0 -339
  58. /package/src/adapters/{model-bridge/jsonld-types.ts → jsonld-types.ts} +0 -0
@@ -1,277 +0,0 @@
1
- /**
2
- * JSON-LD → Glossarist native mapping functions.
3
- *
4
- * Each mapper reads the wire-format JSON-LD (gl:-prefixed keys, see
5
- * src/adapters/wire-keys.ts for the SSOT) and emits the snake_case
6
- * dict that glossarist-js's Model.fromJSON constructors expect.
7
- *
8
- * Mappers are pure functions — no side effects, no global state.
9
- * Bridge machinery (WeakMaps) lives in bridges.ts.
10
- */
11
- import { GL } from '../wire-keys';
12
- import { DESIGNATION_REL_TYPES } from './bridges';
13
- import type {
14
- JsonLdDesignation,
15
- JsonLdRef,
16
- JsonLdLocality,
17
- JsonLdOrigin,
18
- JsonLdSource,
19
- JsonLdRelated,
20
- JsonLdLocalizedConcept,
21
- JsonLdConcept,
22
- } from './jsonld-types';
23
-
24
- export function isJsonLd(doc: Record<string, unknown>): boolean {
25
- return '@type' in doc && GL.LOCALIZED_CONCEPT in doc;
26
- }
27
-
28
- export function mapDesignationFromJsonLd(d: JsonLdDesignation): Record<string, unknown> {
29
- const result: Record<string, unknown> = {};
30
- const rawType = d['@type'] || '';
31
-
32
- if (rawType.includes('Abbreviation')) result.type = 'abbreviation';
33
- else if (rawType.includes('LetterSymbol')) result.type = 'letter_symbol';
34
- else if (rawType.includes('GraphicalSymbol')) result.type = 'graphical_symbol';
35
- else if (rawType.includes('Symbol')) result.type = 'symbol';
36
- else result.type = 'expression';
37
-
38
- result.designation = d[GL.TERM] ?? '';
39
- result.normative_status = d[GL.NORMATIVE_STATUS] ?? null;
40
-
41
- if (d[GL.ABSENT] != null) result.absent = d[GL.ABSENT];
42
- if (d[GL.FIELD_OF_APPLICATION]) result.field_of_application = d[GL.FIELD_OF_APPLICATION];
43
- if (d[GL.USAGE_INFO]) result.usage_info = d[GL.USAGE_INFO];
44
- if (d[GL.GEOGRAPHICAL_AREA]) result.geographical_area = d[GL.GEOGRAPHICAL_AREA];
45
- if (d[GL.LANGUAGE]) result.language = d[GL.LANGUAGE];
46
- if (d[GL.SCRIPT]) result.script = d[GL.SCRIPT];
47
- if (d[GL.SYSTEM]) result.system = d[GL.SYSTEM];
48
- if (d[GL.INTERNATIONAL] != null) result.international = d[GL.INTERNATIONAL];
49
- if (d[GL.TERM_TYPE]) result.term_type = d[GL.TERM_TYPE];
50
-
51
- const pronunciation = d[GL.PRONUNCIATION];
52
- if (pronunciation?.length) {
53
- result.pronunciation = pronunciation.map(p => ({
54
- content: p[GL.CONTENT] ?? null,
55
- language: p[GL.LANGUAGE] ?? null,
56
- script: p[GL.SCRIPT] ?? null,
57
- system: p[GL.SYSTEM] ?? null,
58
- country: p[GL.COUNTRY] ?? null,
59
- }));
60
- }
61
-
62
- const sources = d[GL.SOURCE];
63
- if (sources?.length) {
64
- result.sources = sources.map(mapSourceFromJsonLd);
65
- }
66
-
67
- const related = d[GL.RELATED];
68
- if (related?.length) {
69
- result.related = related.map(r => {
70
- const relType = r[GL.RELATIONSHIP_TYPE] ?? 'references';
71
- if (DESIGNATION_REL_TYPES.has(relType) && r[GL.TARGET]) {
72
- return { type: relType, target: r[GL.TARGET] };
73
- }
74
- return mapRelatedFromJsonLd(r);
75
- });
76
- }
77
-
78
- if (d[GL.PREFIX] != null) result.prefix = d[GL.PREFIX];
79
- if (d[GL.GENDER]) {
80
- result.grammar_info = [{ gender: d[GL.GENDER] }];
81
- }
82
- const grammarInfo = d[GL.GRAMMAR_INFO];
83
- if (grammarInfo?.length) {
84
- result.grammar_info = grammarInfo.map(gi => ({
85
- gender: gi[GL.GENDER] ?? null,
86
- number: gi[GL.NUMBER] ?? null,
87
- part_of_speech: gi[GL.PART_OF_SPEECH] ?? null,
88
- noun: gi[GL.NOUN] ?? false,
89
- verb: gi[GL.VERB] ?? false,
90
- adj: gi[GL.ADJ] ?? false,
91
- adverb: gi[GL.ADVERB] ?? false,
92
- preposition: gi[GL.PREPOSITION] ?? false,
93
- participle: gi[GL.PARTICIPLE] ?? false,
94
- }));
95
- }
96
-
97
- return result;
98
- }
99
-
100
- export function mapRefFromJsonLd(rawRef: JsonLdRef | string | undefined): Record<string, unknown> | null {
101
- if (!rawRef) return null;
102
- if (typeof rawRef === 'string') return { source: rawRef };
103
- const refObj: Record<string, unknown> = {};
104
- // gl:-prefixed keys take precedence over unprefixed keys
105
- refObj.source = rawRef[GL.SOURCE] ?? rawRef.source;
106
- refObj.id = rawRef[GL.LOCAL_ID] ?? rawRef.id;
107
- refObj.version = rawRef[GL.VERSION] ?? rawRef.version;
108
- if (rawRef[GL.TEXT]) refObj.text = rawRef[GL.TEXT];
109
- return (refObj.source ?? refObj.id ?? refObj.version ?? refObj.text) != null
110
- ? refObj : null;
111
- }
112
-
113
- /**
114
- * Map JSON-LD locality to glossarist's snake_case format.
115
- * Always uses snake_case (reference_from/reference_to) for consistency
116
- * with the glossarist model.
117
- */
118
- export function mapLocalityFromJsonLd(rawLoc: JsonLdLocality | undefined): Record<string, unknown> | null {
119
- if (!rawLoc) return null;
120
- const locObj: Record<string, unknown> = {};
121
- locObj.type = rawLoc[GL.LOCALITY_TYPE] ?? rawLoc.type;
122
- locObj.reference_from = rawLoc[GL.REFERENCE_FROM] ?? rawLoc.reference_from;
123
- locObj.reference_to = rawLoc[GL.REFERENCE_TO] ?? rawLoc.reference_to;
124
- return (locObj.type ?? locObj.reference_from ?? locObj.reference_to) != null
125
- ? locObj : null;
126
- }
127
-
128
- export function mapDetailedDefinitionFromJsonLd(d: any): Record<string, unknown> {
129
- const result: Record<string, unknown> = { content: d[GL.CONTENT] ?? '' };
130
- if (d[GL.EXAMPLES]?.length) {
131
- result.examples = d[GL.EXAMPLES].map(mapDetailedDefinitionFromJsonLd);
132
- }
133
- return result;
134
- }
135
-
136
- export function mapOriginFromJsonLd(o: JsonLdOrigin): Record<string, unknown> {
137
- const origin: Record<string, unknown> = {};
138
- const ref = mapRefFromJsonLd(o[GL.REF]);
139
- if (ref) origin.ref = ref;
140
- const loc = mapLocalityFromJsonLd(o[GL.LOCALITY]);
141
- if (loc) origin.locality = loc;
142
- if (o[GL.LINK]) origin.link = o[GL.LINK];
143
- if (o[GL.LOCAL_ID]) origin.id = o[GL.LOCAL_ID];
144
- if (o[GL.VERSION]) origin.version = o[GL.VERSION];
145
- if (o[GL.SOURCE]) origin.source = o[GL.SOURCE];
146
- return origin;
147
- }
148
-
149
- export function mapSourceFromJsonLd(s: JsonLdSource): Record<string, unknown> {
150
- const result: Record<string, unknown> = {};
151
- // JsonLdSource uses GL.LOCAL_ID ('gl:id') for the source's local id,
152
- // distinct from JSON-LD's '@id' (the concept IRI).
153
- if (s[GL.LOCAL_ID]) result.id = s[GL.LOCAL_ID];
154
- if (s[GL.SOURCE_TYPE]) result.type = s[GL.SOURCE_TYPE];
155
- if (s[GL.SOURCE_STATUS]) result.status = s[GL.SOURCE_STATUS];
156
- if (s[GL.MODIFICATION]) result.modification = s[GL.MODIFICATION];
157
-
158
- const origin = s[GL.ORIGIN];
159
- if (origin) {
160
- result.origin = mapOriginFromJsonLd(origin);
161
- }
162
-
163
- const sf = s[GL.SOURCED_FROM] ?? s[GL.SOURCED_FROM_ALT];
164
- if (sf?.length) {
165
- result.sourced_from = sf.map(item => mapOriginFromJsonLd(item));
166
- }
167
-
168
- return result;
169
- }
170
-
171
- export function mapRelatedFromJsonLd(r: JsonLdRelated): Record<string, unknown> {
172
- const result: Record<string, unknown> = { type: 'references' };
173
-
174
- if (r[GL.RELATIONSHIP_TYPE]) {
175
- result.type = r[GL.RELATIONSHIP_TYPE];
176
- }
177
-
178
- if (r[GL.REF]) {
179
- const ref = mapRefFromJsonLd(r[GL.REF]);
180
- if (ref) result.ref = ref;
181
- }
182
-
183
- if (!result.ref && r['@id']) {
184
- const uri = r['@id'];
185
- const idMatch = uri.match(/\/concept\/([^/]+)$/);
186
- result.ref = idMatch
187
- ? { source: uri.split('/').slice(-3, -2)[0] || '', id: idMatch[1] }
188
- : { source: uri, id: null };
189
- }
190
- if (r[GL.TERM]) result.content = r[GL.TERM];
191
-
192
- // Bridged fields — stored in raw dict, extracted by attachBridges()
193
- if (r[GL.SOURCE_ID]) result.sourceId = r[GL.SOURCE_ID];
194
- const rawCitation = r[GL.CITATION];
195
- if (rawCitation) {
196
- const c = rawCitation;
197
- const citation: Record<string, unknown> = {};
198
- if (c[GL.REF]) {
199
- const cr = mapRefFromJsonLd(c[GL.REF]);
200
- if (cr) citation.ref = cr;
201
- }
202
- const loc = mapLocalityFromJsonLd(c[GL.LOCALITY]);
203
- if (loc) citation.locality = loc;
204
- if (c[GL.LINK]) citation.link = c[GL.LINK];
205
- if (Object.keys(citation).length > 0) result.citation = citation;
206
- }
207
-
208
- return result;
209
- }
210
-
211
- export function mapLocalizedFromJsonLd(lc: JsonLdLocalizedConcept): Record<string, unknown> {
212
- const data: Record<string, unknown> = {};
213
-
214
- if (lc[GL.LANGUAGE_CODE]) data.language_code = lc[GL.LANGUAGE_CODE];
215
- if (lc[GL.ENTRY_STATUS]) data.entry_status = lc[GL.ENTRY_STATUS];
216
- if (lc[GL.CLASSIFICATION]) data.classification = lc[GL.CLASSIFICATION];
217
- if (lc[GL.REVIEW_TYPE]) data.review_type = lc[GL.REVIEW_TYPE];
218
- if (lc[GL.DOMAIN]) data.domain = lc[GL.DOMAIN];
219
- if (lc[GL.RELEASE]) data.release = lc[GL.RELEASE];
220
- if (lc[GL.LINEAGE_SOURCE_SIMILARITY] != null) data.lineage_source_similarity = lc[GL.LINEAGE_SOURCE_SIMILARITY];
221
- if (lc[GL.SCRIPT]) data.script = lc[GL.SCRIPT];
222
- if (lc[GL.SYSTEM]) data.system = lc[GL.SYSTEM];
223
-
224
- const designation = lc[GL.DESIGNATION];
225
- if (designation?.length) {
226
- data.terms = designation.map(mapDesignationFromJsonLd);
227
- }
228
-
229
- const definition = lc[GL.DEFINITION];
230
- if (definition?.length) {
231
- data.definition = definition.map(mapDetailedDefinitionFromJsonLd);
232
- }
233
-
234
- const notes = lc[GL.NOTES];
235
- if (notes?.length) {
236
- data.notes = notes.map(mapDetailedDefinitionFromJsonLd);
237
- }
238
-
239
- const annotations = lc[GL.ANNOTATIONS];
240
- if (annotations?.length) {
241
- data.annotations = annotations.map(mapDetailedDefinitionFromJsonLd);
242
- }
243
-
244
- const examples = lc[GL.EXAMPLES];
245
- if (examples?.length) {
246
- data.examples = examples.map(mapDetailedDefinitionFromJsonLd);
247
- }
248
-
249
- const lcSources = lc[GL.SOURCE];
250
- if (lcSources?.length) {
251
- data.sources = lcSources.map(mapSourceFromJsonLd);
252
- }
253
-
254
- const dates = lc[GL.DATES];
255
- if (dates?.length) {
256
- data.dates = dates.map(d => ({
257
- date: d[GL.DATE] ?? null,
258
- type: d[GL.DATE_TYPE] ?? null,
259
- }));
260
- }
261
-
262
- const lcReferences = lc[GL.REFERENCES];
263
- if (lcReferences?.length) {
264
- data.related = lcReferences.map(mapRelatedFromJsonLd);
265
- }
266
-
267
- if (lc[GL.REVIEW_DATE]) data.review_date = lc[GL.REVIEW_DATE];
268
- if (lc[GL.REVIEW_DECISION_DATE]) data.review_decision_date = lc[GL.REVIEW_DECISION_DATE];
269
- if (lc[GL.REVIEW_DECISION_EVENT]) data.review_decision_event = lc[GL.REVIEW_DECISION_EVENT];
270
- if (lc[GL.REVIEW_STATUS]) data.review_status = lc[GL.REVIEW_STATUS];
271
- if (lc[GL.REVIEW_DECISION]) data.review_decision = lc[GL.REVIEW_DECISION];
272
- if (lc[GL.REVIEW_DECISION_NOTES]) data.review_decision_notes = lc[GL.REVIEW_DECISION_NOTES];
273
-
274
- return data;
275
- }
276
-
277
- export type { JsonLdConcept };
@@ -1,79 +0,0 @@
1
- /**
2
- * Partitive relation mapping: JSON-LD → glossarist-js PartitiveRelation.
3
- *
4
- * Handles ISO 704:2022 MECE axes (presence × count) plus legacy
5
- * migration from the 5-value `multiplicity` enum and the 2-value
6
- * `certainty` field. See BRIDGES.md for the migration contract.
7
- */
8
- import { GL } from '../wire-keys';
9
- import { isPartitivePresence, isPartitiveCount } from '../../utils/partitive-multiplicity';
10
- import { mapRefFromJsonLd } from './mappers';
11
- import type { JsonLdPartitiveRelation } from './jsonld-types';
12
-
13
- export function mapPartitiveRelationFromJsonLd(r: JsonLdPartitiveRelation): Record<string, unknown> | null {
14
- const comprehensive = r[GL.COMPREHENSIVE] ? mapRefFromJsonLd(r[GL.COMPREHENSIVE]) : null;
15
- if (!comprehensive) return null;
16
-
17
- const partitives = (r[GL.HAS_PARTITIVE] ?? [])
18
- .map((m): Record<string, unknown> | null => {
19
- const ref = m[GL.REF] ? mapRefFromJsonLd(m[GL.REF]) : null;
20
- if (!ref) return null;
21
- const out: Record<string, unknown> = { ref };
22
- // ISO 704:2022 MECE: prefer presence × count from JSON-LD. Fall back
23
- // to migrating the legacy one-string `multiplicity` or v2 `certainty`
24
- // so data in transit from older glossarist versions still loads.
25
- const presence = m[GL.PRESENCE];
26
- const count = m[GL.COUNT];
27
- if (isPartitivePresence(presence) && isPartitiveCount(count)) {
28
- out.presence = presence;
29
- out.count = count;
30
- } else {
31
- const raw = m[GL.MULTIPLICITY] ?? splitLegacyCertainty(m[GL.CERTAINTY]);
32
- if (raw) {
33
- const parts = splitMultiplicity(raw);
34
- out.presence = parts.presence;
35
- out.count = parts.count;
36
- }
37
- }
38
- if (m[GL.IS_DELIMITING] === true) out.is_delimiting = true;
39
- return out;
40
- })
41
- .filter((m): m is Record<string, unknown> => m !== null);
42
-
43
- // ISO 704 requires ≥2 partitives. Skip malformed relations rather
44
- // than letting the constructor throw and break the whole concept.
45
- if (partitives.length < 2) return null;
46
-
47
- const out: Record<string, unknown> = {
48
- comprehensive,
49
- partitives,
50
- };
51
-
52
- if (r[GL.COMPLETENESS]) out.completeness = r[GL.COMPLETENESS];
53
-
54
- if (r[GL.CRITERION]) {
55
- out.criterion = typeof r[GL.CRITERION] === 'string'
56
- ? { default: r[GL.CRITERION] }
57
- : r[GL.CRITERION];
58
- }
59
-
60
- return out;
61
- }
62
-
63
- /** Migrate legacy v2 certainty → old v3 multiplicity string. */
64
- function splitLegacyCertainty(certainty: string | undefined): string | null {
65
- if (!certainty) return null;
66
- return certainty === 'possible' ? 'optional' : 'compulsory';
67
- }
68
-
69
- /** Split the legacy one-string multiplicity into MECE presence × count. */
70
- function splitMultiplicity(m: string): { presence: 'required' | 'optional'; count: 'exactly_one' | 'at_least_one' | 'multiple' } {
71
- const LEGACY_MAP: Record<string, { presence: 'required' | 'optional'; count: 'exactly_one' | 'at_least_one' | 'multiple' }> = {
72
- compulsory: { presence: 'required', count: 'exactly_one' },
73
- optional: { presence: 'optional', count: 'exactly_one' },
74
- compulsory_multiple: { presence: 'required', count: 'multiple' },
75
- optional_multiple: { presence: 'optional', count: 'multiple' },
76
- compulsory_at_least_one: { presence: 'required', count: 'at_least_one' },
77
- };
78
- return LEGACY_MAP[m] ?? { presence: 'required', count: 'exactly_one' };
79
- }
@@ -1,339 +0,0 @@
1
- // Local module augmentation for glossarist 0.4.26.
2
- //
3
- // Upstream's published src/models/index.d.ts declares ZERO classes for the
4
- // non-verbal hierarchy (Figure, Table, Formula, FigureImage, NonVerbalEntity,
5
- // SharedNonVerbalEntity, NonVerbalReference + subclasses, BibliographyEntry,
6
- // BibliographyData) plus the localized-string helpers. The top-level
7
- // index.d.ts re-exports the names, so TypeScript silently resolves every
8
- // consumer import to `any`.
9
- //
10
- // This file declares the runtime shape so consumer code can be type-checked.
11
- // DELETE this file when upstream ships proper declarations — tracked by
12
- // PR glossarist/glossarist-js#31.
13
- //
14
- // v2 PartitiveRelation block (below) tracks glossarist 0.4.26 — the runtime
15
- // exports PartitiveRelation/PartitiveMember from src/models/index.js, but
16
- // the d.ts has not been updated. Remove the v2 block when upstream PRs the
17
- // d.ts changes.
18
-
19
- import type { ConceptSource, Citation, GlossaristModel } from 'glossarist';
20
- import type { PartitivePresence, PartitiveCount } from '../../utils/partitive-multiplicity';
21
-
22
- declare module 'glossarist' {
23
- class RegistrableModel extends GlossaristModel {
24
- static register(type: string, cls: typeof RegistrableModel): void;
25
- static fromData(data: Record<string, unknown>): RegistrableModel;
26
- }
27
-
28
- class FigureImage extends GlossaristModel {
29
- constructor(data?: {
30
- src?: string | null;
31
- format?: string | null;
32
- role?: string | null;
33
- width?: number | null;
34
- height?: number | null;
35
- scale?: number | null;
36
- });
37
- readonly src: string | null;
38
- readonly format: string | null;
39
- readonly role: string | null;
40
- readonly width: number | null;
41
- readonly height: number | null;
42
- readonly scale: number | null;
43
- static fromJSON(data: Record<string, unknown>): FigureImage;
44
- }
45
-
46
- class NonVerbalEntity extends RegistrableModel {
47
- constructor(data?: Record<string, unknown>);
48
- readonly caption: Record<string, string> | null;
49
- readonly description: Record<string, string> | null;
50
- readonly alt: Record<string, string> | null;
51
- readonly sources: ConceptSource[];
52
- findById(targetId: string): NonVerbalEntity | null;
53
- allIds(): string[];
54
- static fromJSON(data: Record<string, unknown>): NonVerbalEntity;
55
- }
56
-
57
- class SharedNonVerbalEntity extends NonVerbalEntity {
58
- constructor(data?: Record<string, unknown>);
59
- readonly id: string | null;
60
- readonly identifier: string | null;
61
- findById(targetId: string): SharedNonVerbalEntity | null;
62
- allIds(): string[];
63
- static fromJSON(data: Record<string, unknown>): SharedNonVerbalEntity;
64
- }
65
-
66
- class Figure extends SharedNonVerbalEntity {
67
- constructor(data?: Record<string, unknown>);
68
- readonly images: FigureImage[];
69
- readonly subfigures: Figure[];
70
- findById(targetId: string): Figure | null;
71
- allIds(): string[];
72
- static fromJSON(data: Record<string, unknown>): Figure;
73
- }
74
-
75
- class Table extends SharedNonVerbalEntity {
76
- constructor(data?: Record<string, unknown>);
77
- readonly content: Record<string, unknown> | null;
78
- readonly format: string | null;
79
- static fromJSON(data: Record<string, unknown>): Table;
80
- }
81
-
82
- class Formula extends SharedNonVerbalEntity {
83
- constructor(data?: Record<string, unknown>);
84
- readonly expression: Record<string, string> | null;
85
- readonly notation: string | null;
86
- static fromJSON(data: Record<string, unknown>): Formula;
87
- }
88
-
89
- const NON_VERBAL_TYPES: readonly string[];
90
-
91
- class NonVerbalReference extends RegistrableModel {
92
- constructor(data?: Record<string, unknown>);
93
- readonly entityId: string | null;
94
- readonly display: string | null;
95
- readonly dedupKey: readonly [string, string | null];
96
- static fromJSON(data: Record<string, unknown> | string): NonVerbalReference;
97
- static register(type: string, cls: typeof NonVerbalReference): void;
98
- }
99
-
100
- interface NonVerbRep {
101
- readonly caption: string | null;
102
- readonly description: string | null;
103
- readonly alt: string | null;
104
- readonly images: FigureImage[];
105
- }
106
-
107
- class FigureReference extends NonVerbalReference {
108
- static fromJSON(data: Record<string, unknown> | string): FigureReference;
109
- }
110
-
111
- class TableReference extends NonVerbalReference {
112
- static fromJSON(data: Record<string, unknown> | string): TableReference;
113
- }
114
-
115
- class FormulaReference extends NonVerbalReference {
116
- static fromJSON(data: Record<string, unknown> | string): FormulaReference;
117
- }
118
-
119
- class BibliographyEntry extends GlossaristModel {
120
- constructor(data?: Record<string, unknown>);
121
- readonly id: string | null;
122
- readonly reference: string | null;
123
- readonly title: string | null;
124
- readonly link: string | null;
125
- readonly type: string | null;
126
- static fromJSON(data: Record<string, unknown>): BibliographyEntry;
127
- }
128
-
129
- class BibliographyData extends GlossaristModel {
130
- constructor(data?: Record<string, unknown>);
131
- readonly entries: BibliographyEntry[];
132
- find(id: string): BibliographyEntry | null;
133
- readonly keys: string[];
134
- toYAML(): string;
135
- toJSON(): { bibliography: BibliographyEntry[] };
136
- static fromYAML(yamlString: string): BibliographyData;
137
- static fromJSON(data: Record<string, unknown>): BibliographyData;
138
- }
139
-
140
- // ── PartitiveRelation (glossarist 0.4.26 — MECE presence × count) ─
141
- // Runtime exports these from src/models/index.js; d.ts is stale.
142
- // (Tracked by PR glossarist/glossarist-js#31.)
143
-
144
- type Completeness = 'complete' | 'partial';
145
- const COMPLETENESS: { readonly COMPLETE: 'complete'; readonly PARTIAL: 'partial' };
146
- const COMPLETENESS_VALUES: readonly Completeness[];
147
- const DEFAULT_COMPLETENESS: Completeness;
148
- function isValidCompleteness(value: unknown): value is Completeness;
149
-
150
- const PARTITIVE_PRESENCE: { readonly REQUIRED: 'required'; readonly OPTIONAL: 'optional' } & { readonly VALUES: readonly ['required', 'optional'] };
151
- type PartitivePresence = (typeof PARTITIVE_PRESENCE.VALUES)[number];
152
- const PARTITIVE_PRESENCE_VALUES: readonly PartitivePresence[];
153
- const DEFAULT_PRESENCE: PartitivePresence;
154
- function isValidPresence(value: unknown): value is PartitivePresence;
155
-
156
- const PARTITIVE_COUNT: { readonly EXACTLY_ONE: 'exactly_one'; readonly AT_LEAST_ONE: 'at_least_one'; readonly MULTIPLE: 'multiple' } & { readonly VALUES: readonly ['exactly_one', 'at_least_one', 'multiple'] };
157
- type PartitiveCount = (typeof PARTITIVE_COUNT.VALUES)[number];
158
- const PARTITIVE_COUNT_VALUES: readonly PartitiveCount[];
159
- const DEFAULT_COUNT: PartitiveCount;
160
- function isValidCount(value: unknown): value is PartitiveCount;
161
-
162
- type Multiplicity =
163
- | 'compulsory' | 'optional' | 'compulsory_multiple'
164
- | 'optional_multiple' | 'compulsory_at_least_one';
165
- const MULTIPLICITY: Record<string, Multiplicity>;
166
- const MULTIPLICITY_VALUES: readonly Multiplicity[];
167
- const DEFAULT_MULTIPLICITY: Multiplicity;
168
- function isValidMultiplicity(value: unknown): value is Multiplicity;
169
- function multiplicityFromPair(presence: PartitivePresence, count: PartitiveCount): Multiplicity;
170
- function pairFromMultiplicity(name: Multiplicity): { presence: PartitivePresence; count: PartitiveCount };
171
-
172
- interface Concept {
173
- readonly relations: AbstractHyperedge[];
174
- }
175
-
176
- // Re-exposed here so callers importing from the top-level `glossarist`
177
- // entry get the MECE-augmented shape, not the stale d.ts type.
178
- export class HyperedgeMember extends GlossaristModel {
179
- constructor(data?: {
180
- ref?: ConceptRef;
181
- presence?: PartitivePresence;
182
- count?: PartitiveCount;
183
- });
184
- readonly ref: ConceptRef;
185
- readonly presence: PartitivePresence;
186
- readonly count: PartitiveCount;
187
- required(): boolean;
188
- optional(): boolean;
189
- toJSON(): Record<string, unknown>;
190
- static fromJSON(data: Record<string, unknown>): HyperedgeMember;
191
- static identityOf(value: unknown): string;
192
- }
193
-
194
- export class PartitiveMember extends HyperedgeMember {
195
- constructor(data?: {
196
- ref?: ConceptRef;
197
- presence?: PartitivePresence;
198
- count?: PartitiveCount;
199
- is_delimiting?: boolean;
200
- });
201
- readonly is_delimiting: boolean;
202
- get isDelimiting(): boolean;
203
- }
204
-
205
- export class GenericMember extends HyperedgeMember {
206
- constructor(data?: {
207
- ref?: ConceptRef;
208
- presence?: PartitivePresence;
209
- count?: PartitiveCount;
210
- delimitingCharacteristic?: Record<string, string> | string;
211
- });
212
- readonly delimitingCharacteristic: Record<string, string>;
213
- }
214
-
215
- export class AbstractHyperedge extends GlossaristModel {
216
- readonly comprehensive: ConceptRef;
217
- readonly members: HyperedgeMember[];
218
- readonly completeness: Completeness;
219
- readonly criterion: Record<string, string> | null;
220
- readonly sources: ConceptSource[];
221
- readonly notes: Record<string, string> | null;
222
- readonly status: string | null;
223
- readonly isComplete: boolean;
224
- readonly isPartial: boolean;
225
- readonly isCoordinate: boolean;
226
- toJSON(): Record<string, unknown>;
227
- static fromJSON(data: Record<string, unknown>): AbstractHyperedge;
228
- static identityOf(value: unknown): string;
229
- }
230
-
231
- export class PartitiveHyperedge extends AbstractHyperedge {
232
- get partitives(): HyperedgeMember[];
233
- static fromJSON(data: Record<string, unknown>): PartitiveHyperedge;
234
- static identityOf(value: unknown): string;
235
- }
236
-
237
- export class GenericHyperedge extends AbstractHyperedge {
238
- static fromJSON(data: Record<string, unknown>): GenericHyperedge;
239
- static identityOf(value: unknown): string;
240
- }
241
-
242
- // Legacy aliases (deprecated — use Hyperedge-based names)
243
- export class PartitiveRelation extends PartitiveHyperedge {}
244
- }
245
-
246
- // Re-declare the same exports under the 'glossarist/models' subpath so
247
- // deep-import callers can use them. Upstream's d.ts is stale on this
248
- // subpath too.
249
- //
250
- // The duplication between the 'glossarist' block above and this block
251
- // is forced by upstream's broken d.ts (PR glossarist/glossarist-js#31).
252
- // We cannot `export import` from a local namespace because TypeScript
253
- // requires `declare module` blocks to be self-contained. When upstream
254
- // ships proper d.ts, DELETE this entire file.
255
- declare module 'glossarist/models' {
256
- export type Completeness = 'complete' | 'partial';
257
- export const COMPLETENESS: { readonly COMPLETE: 'complete'; readonly PARTIAL: 'partial' };
258
- export const COMPLETENESS_VALUES: readonly Completeness[];
259
- export const DEFAULT_COMPLETENESS: Completeness;
260
- export function isValidCompleteness(value: unknown): value is Completeness;
261
-
262
- export const PARTITIVE_PRESENCE: { readonly REQUIRED: 'required'; readonly OPTIONAL: 'optional' } & { readonly VALUES: readonly ['required', 'optional'] };
263
- export type PartitivePresence = (typeof PARTITIVE_PRESENCE.VALUES)[number];
264
- export const PARTITIVE_PRESENCE_VALUES: readonly PartitivePresence[];
265
- export const DEFAULT_PRESENCE: PartitivePresence;
266
- export function isValidPresence(value: unknown): value is PartitivePresence;
267
-
268
- export const PARTITIVE_COUNT: { readonly EXACTLY_ONE: 'exactly_one'; readonly AT_LEAST_ONE: 'at_least_one'; readonly MULTIPLE: 'multiple' } & { readonly VALUES: readonly ['exactly_one', 'at_least_one', 'multiple'] };
269
- export type PartitiveCount = (typeof PARTITIVE_COUNT.VALUES)[number];
270
- export const PARTITIVE_COUNT_VALUES: readonly PartitiveCount[];
271
- export const DEFAULT_COUNT: PartitiveCount;
272
- export function isValidCount(value: unknown): value is PartitiveCount;
273
-
274
- export type Multiplicity =
275
- | 'compulsory' | 'optional' | 'compulsory_multiple'
276
- | 'optional_multiple' | 'compulsory_at_least_one';
277
- export const MULTIPLICITY: Record<string, Multiplicity>;
278
- export const MULTIPLICITY_VALUES: readonly Multiplicity[];
279
- export const DEFAULT_MULTIPLICITY: Multiplicity;
280
- export function isValidMultiplicity(value: unknown): value is Multiplicity;
281
- export function multiplicityFromPair(presence: PartitivePresence, count: PartitiveCount): Multiplicity;
282
- export function pairFromMultiplicity(name: Multiplicity): { presence: PartitivePresence; count: PartitiveCount };
283
- // (TypeSharedPlurality removed — superseded by presence/count on
284
- // PartitiveMember per MECE refactor. Was dead code.)
285
-
286
- // ── Hyperedge classes (glossarist 0.4.33 — unified n-ary model) ─
287
-
288
- export class HyperedgeMember extends GlossaristModel {
289
- constructor(data?: {
290
- ref?: ConceptRef;
291
- presence?: PartitivePresence;
292
- count?: PartitiveCount;
293
- is_delimiting?: boolean;
294
- });
295
- readonly ref: ConceptRef;
296
- readonly presence: PartitivePresence;
297
- readonly count: PartitiveCount;
298
- readonly is_delimiting: boolean;
299
- required(): boolean;
300
- optional(): boolean;
301
- get isDelimiting(): boolean;
302
- toJSON(): Record<string, unknown>;
303
- static fromJSON(data: Record<string, unknown>): HyperedgeMember;
304
- static identityOf(value: unknown): string;
305
- }
306
-
307
- export class PartitiveMember extends HyperedgeMember {}
308
- export class GenericMember extends HyperedgeMember {}
309
-
310
- export class AbstractHyperedge extends GlossaristModel {
311
- readonly comprehensive: ConceptRef;
312
- readonly members: HyperedgeMember[];
313
- readonly completeness: Completeness;
314
- readonly criterion: Record<string, string> | null;
315
- readonly sources: ConceptSource[];
316
- readonly notes: Record<string, string> | null;
317
- readonly status: string | null;
318
- readonly isComplete: boolean;
319
- readonly isPartial: boolean;
320
- readonly isCoordinate: boolean;
321
- toJSON(): Record<string, unknown>;
322
- static fromJSON(data: Record<string, unknown>): AbstractHyperedge;
323
- static identityOf(value: unknown): string;
324
- }
325
-
326
- export class PartitiveHyperedge extends AbstractHyperedge {
327
- get partitives(): HyperedgeMember[];
328
- static fromJSON(data: Record<string, unknown>): PartitiveHyperedge;
329
- static identityOf(value: unknown): string;
330
- }
331
-
332
- export class GenericHyperedge extends AbstractHyperedge {
333
- static fromJSON(data: Record<string, unknown>): GenericHyperedge;
334
- static identityOf(value: unknown): string;
335
- }
336
-
337
- // Legacy aliases (deprecated)
338
- export class PartitiveRelation extends PartitiveHyperedge {}
339
- }