refactor(bridge): use native DetailedDefinition.examples (glossarist 0.4.2)#72
Merged
Merged
Conversation
…0.4.2) PR #69 (b597b15) shipped scoped examples UI with a temporary WeakMap bridge because the published glossarist@0.4.0 DetailedDefinition class did not expose `examples` natively. That workaround was explicitly marked 'remove once the published model carries the field'. glossarist@0.4.2 (PR glossarist/glossarist-js#28, released today) adds `readonly examples: DetailedDefinition[]` to DetailedDefinition with the same lazy-instantiation pattern as `sources`. The bridge is now redundant — the model owns the nesting. Removed: - src/adapters/model-bridge.ts: extraNoteExamples WeakMap, getNoteExamples accessor, and the attachBridges block that paired raw with model instances for notes/definition/examples/annotations - src/composables/use-concept-content.ts: toRaw + getNoteExamples call, replaced with direct `n.examples` access Kept mapDetailedDefinitionFromJsonLd in model-bridge — it still translates JSON-LD wire shape (gl:content, gl:examples) to the DetailedDefinition.fromJSON input shape. Verified: full test suite (797 passing including the scoped-examples test from PR #69), vue-tsc clean, build clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR #69 (
b597b15) shipped scoped examples UI with a temporary WeakMap bridge because the publishedglossarist@0.4.0DetailedDefinitionclass did not exposeexamplesnatively. That workaround was explicitly marked "remove once the published model carries the field."glossarist@0.4.2(glossarist-js PR #28, released today) addsreadonly examples: DetailedDefinition[]toDetailedDefinitionwith the same lazy-instantiation pattern assources. The bridge is now redundant — the model owns the nesting.What's removed
src/adapters/model-bridge.ts:extraNoteExamplesWeakMap,getNoteExamples()accessor, and theattachBridgesblock that paired raw with model instances for notes/definition/examples/annotationssrc/composables/use-concept-content.ts:toRaw+getNoteExamplescall, replaced with directn.examplesaccessWhat's kept
mapDetailedDefinitionFromJsonLdinmodel-bridge.ts— still translates JSON-LD wire shape (gl:content,gl:examples) to theDetailedDefinition.fromJSONinput shape.Verification
vue-tsc --noEmitcleannpm run buildcleanDependency bump
glossarist:^0.4.0→^0.4.2Refs: glossarist/glossarist-js#28, #69