Skip to content

Commit

Permalink
add dist
Browse files Browse the repository at this point in the history
  • Loading branch information
RoyEJohnson committed Mar 18, 2024
1 parent acfdc68 commit 60b8be9
Show file tree
Hide file tree
Showing 54 changed files with 2,667 additions and 0 deletions.
46 changes: 46 additions & 0 deletions dist/Highlight.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import SerializedHighlight from './SerializedHighlight';
export interface IHighlightData {
style?: string;
id: string;
content: string;
}
export interface IOptions {
skipIDsBy?: RegExp;
formatMessage: (descriptor: {
id: string;
}, values: {
style: IHighlightData['style'];
}) => string;
tabbable?: boolean;
}
export default class Highlight {
readonly id: string;
readonly content: string;
elements: HTMLElement[];
readonly range: Range;
readonly options: IOptions;
private data;
private _elements;
constructor(range: Range, data: Pick<IHighlightData, Exclude<keyof IHighlightData, 'id'>> & Partial<Pick<IHighlightData, 'id'>>, options: IOptions);
getMessage(id: string): string;
setStyle(style: string): void;
getStyle(): string | undefined;
removeStyle(): void;
isAttached(): boolean;
scrollTo(handler?: (elements: HTMLElement[]) => void): Highlight;
updateStartMarker(el: Element, position: string): void;
/**
* Add class 'focus' to all elements of this highlight.
*/
addFocusedStyles(): Highlight;
/**
* Move focus to the first element of this highlight.
* @return boolean indicating if the action was a success.
*/
focus(): boolean;
intersects(range: Range): boolean;
serialize(referenceElement?: HTMLElement): SerializedHighlight;
private loadStyle;
private checkReferenceElement;
private getValidReferenceElement;
}
142 changes: 142 additions & 0 deletions dist/Highlight.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/Highlight.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 55 additions & 0 deletions dist/Highlighter.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import Highlight, { IHighlightData, IOptions as HighlightOptions } from './Highlight';
import SerializedHighlight from './SerializedHighlight';
export declare const ON_SELECT_DELAY = 300;
interface IOptions {
snapCode?: boolean;
snapTableRows?: boolean;
snapMathJax?: boolean;
snapWords?: boolean;
className?: string;
skipIDsBy?: RegExp;
formatMessage: (descriptor: {
id: string;
}, values: {
style: IHighlightData['style'];
}) => string;
onClick?: (highlight: Highlight | undefined, event: MouseEvent) => void;
onSelect?: (highlights: Highlight[], newHighlight?: Highlight) => void;
onFocusIn?: (highlight: Highlight) => void;
onFocusOut?: (highlight: Highlight) => void;
tabbable?: boolean;
}
export default class Highlighter {
readonly container: HTMLElement;
private highlights;
private options;
private previousRange;
private focusInHandler;
private focusOutHandler;
constructor(container: HTMLElement, options: IOptions);
unmount(): void;
eraseAll: () => void;
teardown: () => void;
erase: (highlight: Highlight) => void;
highlight(highlight?: Highlight | SerializedHighlight): void;
getHighlight(id: string): Highlight | undefined;
getReferenceElement(id: string): HTMLElement | null;
getHighlightFromElement(el: Element): Highlight | null | undefined;
clearFocusedStyles(): void;
getHighlights(): Highlight[];
getHighlightOptions(): HighlightOptions;
getOrderedHighlights(): Highlight[];
getHighlightBefore(target: Highlight): Highlight | undefined;
getHighlightAfter(target: Highlight): Highlight | undefined;
readonly document: Document;
private snapSelection;
private debouncedSnapSelection;
private debouncedOnSelect;
private onSelectionChange;
private onClickHandler;
private onFocusHandler;
private onClick;
private onSelect;
private compareRanges;
}
export {};
Loading

0 comments on commit 60b8be9

Please sign in to comment.