-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #184 from ator-dev/type-definition-files
Give type-only modules .d.mts, improve hierarchy
- Loading branch information
Showing
51 changed files
with
1,111 additions
and
1,100 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* This file is part of Mark My Search. | ||
* Copyright © 2021-present ‘ator-dev’, Mark My Search contributors. | ||
* Licensed under the EUPL-1.2-or-later. | ||
*/ | ||
|
||
import type { HighlighterCounterInterface, HighlighterWalkerInterface } from "/dist/modules/highlight/model.d.mjs"; | ||
import type { Highlighter } from "/dist/modules/highlight/engine.d.mjs"; | ||
import type { Engine, PaintEngineMethod } from "/dist/modules/common.mjs"; | ||
|
||
interface AbstractEngineManager extends Highlighter, HighlighterCounterInterface, HighlighterWalkerInterface { | ||
readonly setEngine: (preference: Engine) => Promise<void> | ||
|
||
readonly applyEngine: () => void | ||
|
||
readonly removeEngine: () => void | ||
|
||
readonly signalPaintEngineMethod: (preference: PaintEngineMethod) => void | ||
|
||
readonly applyPaintEngineMethod: (preference: PaintEngineMethod) => Promise<void> | ||
|
||
readonly setSpecialEngine: () => Promise<void> | ||
|
||
readonly removeSpecialEngine: () => void | ||
} | ||
|
||
export type { AbstractEngineManager }; |
This file contains 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
File renamed without changes.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
File renamed without changes.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
File renamed without changes.
This file contains 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
This file contains 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
92 changes: 92 additions & 0 deletions
92
src/modules/highlight/models/tree-cache/flow-tracker.d.mts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/* | ||
* This file is part of Mark My Search. | ||
* Copyright © 2021-present ‘ator-dev’, Mark My Search contributors. | ||
* Licensed under the EUPL-1.2-or-later. | ||
*/ | ||
|
||
import type { FlowMutationObserver } from "/dist/modules/highlight/flow-mutation-observer.d.mjs"; | ||
import type { BaseFlow, BaseSpan } from "/dist/modules/highlight/matcher.mjs"; | ||
import type { MatchTerm } from "/dist/modules/match-term.mjs"; | ||
import type { AllReadonly } from "/dist/modules/common.mjs"; | ||
|
||
type Flow = BaseFlow<true> | ||
|
||
type Span = BaseSpan<true> | ||
|
||
/** | ||
* Interface for the core utility of the tree-cache highlighting engines. | ||
* | ||
* Implementers are responsible for: | ||
* | ||
* - determining "flows" of text and matching within them, producing highlighting "boxes" information; | ||
* - maintaining a cache of [TODO] | ||
*/ | ||
interface AbstractFlowTracker extends FlowMutationObserver { | ||
readonly getElementFlowsMap: () => AllReadonly<Map<HTMLElement, Array<Flow>>> | ||
|
||
/** Sets the listener for gain of highlight spans in an unhighlighted element. */ | ||
readonly setNewSpanOwnerListener: ( | ||
listener: ( | ||
/** The new owner of text flows which together contain 1+ highlight spans. */ | ||
flowOwner: HTMLElement, | ||
) => void, | ||
) => void | ||
|
||
/** Sets the listener for gain of 1+ highlight spans in an element. */ | ||
readonly setSpansCreatedListener: ( | ||
listener: ( | ||
/** The owner of text flows which together contain 1+ new highlight spans (and any already present). */ | ||
flowOwner: HTMLElement, | ||
/** Spans created in text flows of the element. */ | ||
spansCreated: AllReadonly<Array<Span>>, | ||
) => void, | ||
) => void | ||
|
||
/** Sets the listener for loss of 1+ highlight spans in an element. */ | ||
readonly setSpansRemovedListener: ( | ||
listener: ( | ||
/** The owner of text flows which together contain some number of highlight spans. */ | ||
flowOwner: HTMLElement, | ||
/** Spans removed from text flows of the element. */ | ||
spansRemoved: AllReadonly<Array<Span>>, | ||
) => void, | ||
) => void | ||
|
||
/** Sets the listener for loss of all highlight spans in an element. */ | ||
readonly setNonSpanOwnerListener: ( | ||
listener: ( | ||
/** The owner of text flows which together used to contain highlight spans. */ | ||
flowOwner: HTMLElement, | ||
) => void, | ||
) => void | ||
|
||
/** Adds a listener for changes in highlighting. */ | ||
readonly addHighlightingUpdatedListener: (listener: () => void) => void | ||
|
||
/** | ||
* Generates highlighting information for all text flows below the given element. | ||
* @param terms The terms to highlight. Highlighting is removed for all terms not included. | ||
* @param root The highest element below which to generate highlight spans for flows. | ||
* This is assumed to be a flow-breaking element; an element at whose boundaries text flows start and end. | ||
* Otherwise the function would need to look above the element, since the boundary flows would extend outside. | ||
*/ | ||
readonly generateHighlightSpansFor: ( | ||
terms: ReadonlyArray<MatchTerm>, | ||
root: HTMLElement, | ||
) => void | ||
|
||
/** | ||
* Removes highlighting information for all text flows below the given element. | ||
* @param terms The terms for which to remove highlighting. If undefined, all highlighting information is removed. | ||
* @param root The element below which to remove flow highlighting. | ||
*/ | ||
readonly removeHighlightSpansFor: ( | ||
terms?: ReadonlyArray<MatchTerm>, | ||
root?: HTMLElement, | ||
) => void | ||
} | ||
|
||
export type { | ||
Flow, Span, | ||
AbstractFlowTracker, | ||
}; |
Oops, something went wrong.