Skip to content
This repository has been archived by the owner on Nov 25, 2021. It is now read-only.

Commit

Permalink
feat: remove HoverOverlay component
Browse files Browse the repository at this point in the history
This library no longer provides the React component for rendering the hover tooltip.

BREAKING CHANGE: Removes the HoverOverlay component. You must create your own UI component that renders from the hoverStateUpdates data.
  • Loading branch information
sqs committed Dec 23, 2018
1 parent 60d4adc commit e0caa80
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 381 deletions.
6 changes: 4 additions & 2 deletions README.md
Expand Up @@ -6,7 +6,7 @@
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![sourcegraph: search](https://img.shields.io/badge/sourcegraph-search-brightgreen.svg)](https://sourcegraph.com/github.com/sourcegraph/codeintellify)

Adds code intelligence to code views on the web. Used in [Sourcegraph](https://sourcegraph.com).
This library manages all of the inputs (mouse/keyboard events, location changes, hover information, and hover actions) necessary to display hover tooltips on with a code view. All together, this makes it easier to add code intelligence to code views on the web. Used in [Sourcegraph](https://sourcegraph.com).

## What it does

Expand All @@ -16,10 +16,12 @@ Adds code intelligence to code views on the web. Used in [Sourcegraph](https://s
- When clicking a token, pins the tooltip to that token
- Highlights the hovered token

You need to provide your own UI component (referred to as the HoverOverlay) that actually displays this information and exposes these actions to the user.

## Usage

- Call `createHoverifier()` to create a `Hoverifier` object (there should only be one on the page, to have only one HoverOverlay shown).
- The Hoverifier exposes an Observable `hoverStateUpdates` that a consumer can subscribe to, which emits all data needed to render the `HoverOverlay` React component.
- The Hoverifier exposes an Observable `hoverStateUpdates` that a consumer can subscribe to, which emits all data needed to render the HoverOverlay
- For each code view on the page, call `hoverifier.hoverify()`, passing the position events coming from `findPositionsFromEvents()`.
- `hoverify()` returns a `Subscription` that will "unhoverify" the code view again if unsubscribed from

Expand Down
8 changes: 1 addition & 7 deletions karma.conf.ts
Expand Up @@ -12,12 +12,6 @@ export default (config: Config): void => {
included: true,
served: true,
},
{
pattern: 'src/**/*.tsx',
watched: false,
included: true,
served: true,
},
],
preprocessors: {
'src/**/*.ts?(x)': ['webpack', 'sourcemap'],
Expand All @@ -28,7 +22,7 @@ export default (config: Config): void => {

// karma-webpack doesn't change the file extensions so we just need to tell karma what these extensions mean.
mime: {
'text/x-typescript': ['ts', 'tsx'],
'text/x-typescript': ['ts'],
},

webpack: webpackConfig,
Expand Down
121 changes: 21 additions & 100 deletions package-lock.json

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

2 changes: 0 additions & 2 deletions package.json
Expand Up @@ -31,9 +31,7 @@
"dependencies": {
"@sourcegraph/event-positions": "^1.0.0",
"@sourcegraph/extension-api-types": "^1.0.1",
"@sourcegraph/react-loading-spinner": "0.0.7",
"lodash": "^4.17.10",
"mdi-react": "^5.1.0",
"rxjs": "^6.3.3",
"ts-key-enum": "^2.0.0"
},
Expand Down
113 changes: 0 additions & 113 deletions src/HoverOverlay.scss

This file was deleted.

0 comments on commit e0caa80

Please sign in to comment.