Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const nextCloseButtonClick = closeButtonClicks.next.bind(closeButtonClicks)
/** Emits whenever the ref callback for the hover element is called */
const hoverOverlayElements = new Subject()
const nextOverlayElement = hoverOverlayElements.next.bind(hoverOverlayElements)
const relativeElement = document.body
const containerComponentUpdates = new Subject()
subscription.add(
registerHoverContributions({ extensionsController, platformContext, history: H.createBrowserHistory() })
)
// Code views come and go, but there is always a single hoverifier on the page
const hoverifier = createHoverifier<
RepoSpec & RevSpec & FileSpec & ResolvedRevSpec,
HoverData,
ActionItemAction
>({
closeButtonClicks,
hoverOverlayElements,
hoverOverlayRerenders: containerComponentUpdates.pipe(
withLatestFrom(hoverOverlayElements),
map(([, hoverOverlayElement]) => ({ hoverOverlayElement, relativeElement })),
filter(propertyIsDefined('hoverOverlayElement'))
),
getHover: ({ line, character, part, ...rest }) =>
combineLatest([
getHover({ ...rest, position: { line, character } }),
getActiveHoverAlerts(hoverAlerts),
]).pipe(
constructor(props: RepositoryCompareAreaProps) {
super(props)
this.hoverifier = createHoverifier<
RepoSpec & RevSpec & FileSpec & ResolvedRevSpec,
HoverMerged,
ActionItemAction
>({
closeButtonClicks: this.closeButtonClicks,
hoverOverlayElements: this.hoverOverlayElements,
hoverOverlayRerenders: this.componentUpdates.pipe(
withLatestFrom(this.hoverOverlayElements, this.repositoryCompareAreaElements),
map(([, hoverOverlayElement, repositoryCompareAreaElement]) => ({
hoverOverlayElement,
// The root component element is guaranteed to be rendered after a componentDidUpdate
relativeElement: repositoryCompareAreaElement!,
})),
// Can't reposition HoverOverlay if it wasn't rendered
filter(propertyIsDefined('hoverOverlayElement'))
),
constructor(props: BlobProps) {
super(props)
this.state = {
lineDecorationAttachmentIDs: {},
}
/** Emits parsed positions found in the URL */
const locationPositions: Observable = this.componentUpdates.pipe(
map(props => parseHash(props.location.hash)),
distinctUntilChanged((a, b) => isEqual(a, b)),
share()
)
const hoverifier = createHoverifier({
closeButtonClicks: this.closeButtonClicks,
goToDefinitionClicks: this.goToDefinitionClicks,
hoverOverlayElements: this.hoverOverlayElements,
hoverOverlayRerenders: this.componentUpdates.pipe(
withLatestFrom(this.hoverOverlayElements, this.blobElements),
// After componentDidUpdate, the blob element is guaranteed to have been rendered
map(([, hoverOverlayElement, blobElement]) => ({ hoverOverlayElement, relativeElement: blobElement! })),
// Can't reposition HoverOverlay if it wasn't rendered
filter(propertyIsDefined('hoverOverlayElement'))
),
pushHistory: path => this.props.history.push(path),
logTelemetryEvent,
fetchHover: position => getHover(this.getLSPTextDocumentPositionParams(position), this.props),
fetchJumpURL: position => getJumpURL(this.getLSPTextDocumentPositionParams(position), this.props),
})
this.subscriptions.add(hoverifier)
document.body.appendChild(overlayMount)
return overlayMount
}
const overlayMount = document.querySelector(`.${classNames.join('.')}`) || createMount()
const relativeElement = document.body
const fetchJumpURL = createJumpURLFetcher(
simpleProviderFns.fetchDefinition,
codeHost.buildJumpURLLocation || toPrettyBlobURL
)
const containerComponentUpdates = new Subject()
const hoverifier = createHoverifier({
closeButtonClicks,
goToDefinitionClicks,
hoverOverlayElements,
hoverOverlayRerenders: containerComponentUpdates.pipe(
withLatestFrom(hoverOverlayElements),
map(([, hoverOverlayElement]) => ({ hoverOverlayElement, relativeElement })),
filter(propertyIsDefined('hoverOverlayElement'))
),
pushHistory: path => {
location.href = path
},
fetchHover: ({ line, character, part, ...rest }) =>
simpleProviderFns
.fetchHover({ ...rest, position: { line, character } })
.pipe(map(hover => (hover ? (hover as HoverMerged) : hover))),
fetchJumpURL,
const nextCloseButtonClick = (event: MouseEvent) => closeButtonClicks.next(event)
/** Emits whenever the ref callback for the hover element is called */
const hoverOverlayElements = new Subject()
const nextOverlayElement = (element: HTMLElement | null) => hoverOverlayElements.next(element)
const relativeElement = document.body
const fetchJumpURL = createJumpURLFetcher(
simpleProviderFns.fetchDefinition,
codeHost.buildJumpURLLocation || toPrettyBlobURL
)
const containerComponentUpdates = new Subject()
const hoverifier = createHoverifier({
closeButtonClicks,
goToDefinitionClicks,
hoverOverlayElements,
hoverOverlayRerenders: containerComponentUpdates.pipe(
withLatestFrom(hoverOverlayElements),
map(([, hoverOverlayElement]) => ({ hoverOverlayElement, relativeElement })),
filter(propertyIsDefined('hoverOverlayElement'))
),
pushHistory: path => {
location.href = path
},
fetchHover: ({ line, character, part, ...rest }) =>
simpleProviderFns
.fetchHover({ ...rest, position: { line, character } })
.pipe(map(hover => (hover ? (hover as HoverMerged) : hover))),
fetchJumpURL,