To avoid defining a new subclass of Range, perhaps the entire API could be somehow built around the HighlightsMap.
const range = new Range();
const highlight = document.highlights.create( 'example-highlight', range, {
priority: 1
} );
highlight.style.color = 'red';
highlight.priority = 42;
document.highlights.remove( range );
HighlightsMap#create() doing create&add at once is not the prettiest method, but maybe something along these lines could work. Having those new properties (style, priority, label) in some new interface (rather than squashed together with Range's properties) might avoid creating one giant class.
To avoid defining a new subclass of
Range, perhaps the entire API could be somehow built around theHighlightsMap.HighlightsMap#create()doing create&add at once is not the prettiest method, but maybe something along these lines could work. Having those new properties (style,priority,label) in some new interface (rather than squashed together withRange's properties) might avoid creating one giant class.