Skip to content

Commit 7445f0a

Browse files
committed
v2.0.0
### Breaking changes - Migrated to the generic `@topmarksdevelopment/position`. Breaking as underlying types have changed: - `PositionAlignment` => `Alignment` - `PositionCollision` => `CollisionHandler` ### Changed - Now released as a `UMD`, `CJS` and `ES` module packages, for better support ### Other - Added tests to check basic functionality (plan to extend in the future) - Added workflows for auto releases to NPM and GitHub pages - Tidied readme - Other changes (nothing user facing)
1 parent 5e88906 commit 7445f0a

File tree

4 files changed

+9978
-2603
lines changed

4 files changed

+9978
-2603
lines changed

CHANGELOG.md

+34-6
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,47 @@ All notable changes to this project will be documented in this file.
2626
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
2727
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
2828

29+
## [2.0.0] - 2022-12-22
30+
31+
<small>[Compare to previous release][comp:2.0.0]</small>
32+
33+
### Breaking changes
34+
35+
- Migrated to the generic `@topmarksdevelopment/position`. Breaking as underlying types have changed:
36+
- `PositionAlignment` => `Alignment`
37+
- `PositionCollision` => `CollisionHandler`
38+
39+
### Changed
40+
41+
- Now released as a `UMD`, `CJS` and `ES` module packages, for better support
42+
43+
### Other
44+
45+
- Added tests to check basic functionality (plan to extend in the future)
46+
- Added workflows for auto releases to NPM and GitHub pages
47+
- Tidied readme
48+
- Other changes (nothing user facing)
49+
2950
## [1.0.1] - 2022-05-19
3051

52+
<small>[Compare to previous release][comp:1.0.1]</small>
53+
3154
### Fixed
32-
- Fixed an issue where dragging back onto an element before its timeout fired would cancel the old hide queue but not re-queue it [#4](https://github.com/TopMarksDevelopment/JavaScript.HoverBox/pull/4)
55+
56+
- Fixed an issue where dragging back onto an element before its timeout fired would cancel the old hide queue but not re-queue it [#4](https://github.com/TopMarksDevelopment/JavaScript.HoverBox/pull/4)
3357

3458
### Updated
35-
- `@topmarksdevelopment/hover-position` from `1.0.0` to `1.0.1`
36-
- Fixed position when the anchor is inside a scrollable element [hover-position#4](https://github.com/TopMarksDevelopment/JavaScript.HoverPosition/pull/4)
37-
- Other changes (nothing user facing)
59+
60+
- `@topmarksdevelopment/hover-position` from `1.0.0` to `1.0.1`
61+
- Fixed position when the anchor is inside a scrollable element [hover-position#4](https://github.com/TopMarksDevelopment/JavaScript.HoverPosition/pull/4)
62+
- Other changes (nothing user facing)
3863

3964
## [1.0.0] - 2022-05-12
4065

4166
**This was the first release**
4267

43-
[1.0.1]: https://github.com/TopMarksDevelopment/JavaScript.HoverBox/compare/v1.0.0...v1.0.1
44-
[1.0.0]: https://github.com/TopMarksDevelopment/JavaScript.HoverBox/release/tag/v1.0.0
68+
[2.0.0]: https://github.com/TopMarksDevelopment/JavaScript.HoverBox/release/tag/v2.0.0
69+
[comp:2.0.0]: https://github.com/TopMarksDevelopment/JavaScript.HoverBox/compare/v1.0.1...v2.0.0
70+
[1.0.1]: https://github.com/TopMarksDevelopment/JavaScript.HoverBox/release/tag/v1.0.1
71+
[comp:1.0.1]: https://github.com/TopMarksDevelopment/JavaScript.HoverBox/compare/v1.0.0...v1.0.1
72+
[1.0.0]: https://github.com/TopMarksDevelopment/JavaScript.HoverBox/release/tag/v1.0.0

README.md

+67-22
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@
33
A simple package to reveal some extra information on hover
44

55
### Links
6-
- [Change log](./CHANGELOG.md)
7-
- [License (MIT)](./LICENSE)
6+
7+
- [Options](#options)
8+
- [Change log](./CHANGELOG.md)
9+
- [License (MIT)](./LICENSE)
810

911
## Usage
1012

1113
Add the below to your code to your project and you're away
1214

15+
_Note:_ by default, we're listening upon construction
16+
1317
```TS
1418
const hb = new HoverBox(".HoverBox");
1519
const hbWithOptions = new HoverBox(".HoverBox", options); // if you have options
@@ -21,33 +25,74 @@ hb.stopListening();
2125

2226
## Options
2327

24-
Option | Type | Default | Description
25-
---|---|---|---
26-
setMy? | [Type: pA][PositionAlignment] | `top center` | The part of the popup linked the anchor
27-
at? | [Type: pA][PositionAlignment] | `bottom center` | The part of the anchor that the target should link to
28-
keepOpen? | boolean | `true` | If the mouse moves into the popup, keep it open
29-
allowHtml? | boolean | `false` | The text provided can be treated as safe HTML
30-
transitionDelay? | number | `333` | The delay before we start the transition
31-
transitionDuration? | number | `333` | Must match the CSS transition property
32-
**HoverPosition specific**
33-
collision? | [PositionCollision](#type-positioncollision) | `bestfit` | How to handle the popup colliding with the window edge
34-
bestFitPreference? | `horizontal` OR `vertical` | `horizontal` | The preferred direction to try `bestfit` first
35-
defaults? | { my: [pA][PositionAlignment]; at: [pA][PositionAlignment]; } | Same as `setMy` & `at` respectively | Defaults to use if parsing of `setMy` or `at` fails
28+
### setMy?: [`alignment`][alignment]
29+
30+
The part of the popup linked to `at`
31+
**Default:** `top center`
32+
33+
### at?: [`alignment`][alignment]
34+
35+
The part of the anchor `setMy` will "attach" to
36+
**Default:** `bottom center`
37+
38+
### keepOpen?: `boolean`
39+
40+
If the mouse moves into the popup, keep the pop-up open
41+
**Default:** `true`
42+
43+
### allowHtml?: `boolean`
44+
45+
The text provided can be treated as safe HTML
46+
**Default:** `false`
47+
48+
### transitionDelay?: `number`
49+
50+
The delay before we start the transition (in milliseconds)
51+
**Default:** `333`
3652

37-
### Type: `PositionAlignment`
53+
### transitionDuration?: `number`
3854

39-
Where to position an element. Use either: `top`, `bottom`, `center`, `left` or `right`. You can also specify a vertical and horizontal alignment like `top right`, `bottom right` or `center left`.
55+
A link to the transition duration (in milliseconds). This must match the CSS transition property or the element
56+
**Default:** `333`
4057

58+
### collision?: [`CollisionHandler`](#the-collisionhandler-type)
59+
60+
How to handle the popup colliding with the window edge
61+
**Default:** `bestfit`
62+
**Note:** This is just passed straight to the underlying [Position](https://github.com/TopMarksDevelopment/JavaScript.Position) module
63+
64+
### bestFitPreference?: `horizontal` OR `vertical`
65+
66+
The preferred direction to try `bestfit` first
67+
**Default:** `horizontal`
68+
**Note:** This is just passed straight to the underlying [Position](https://github.com/TopMarksDevelopment/JavaScript.Position) module
69+
70+
### defaults?: `{ my: `[`alignment`][alignment]`, at: `[`alignment`][alignment]` }`
71+
72+
The fallback values when only one property is supplied, or the property supplied is invalid
73+
**Default:** Same as `setMy` & `at` respectively
74+
**Note:** This is just passed straight to the underlying [Position](https://github.com/TopMarksDevelopment/JavaScript.Position) module
75+
76+
## Types
77+
78+
### The `Alignment` type
79+
80+
The `Alignment` will allow any of the below, plus a combination in the form `vertical horizontal` (e.g. `top center`, `bottom right` or `center left`)
81+
82+
- `top`
83+
- `bottom`
84+
- `center`
85+
- `left`
86+
- `right`
4187

4288
Using a single value will default the other to `center` so `left` == `center left`
4389

44-
### Type: `PositionCollision`
90+
### The `CollisionHandler` type
4591

4692
How to handle any collisions, either:
4793

48-
- `bestFit`: find the best fit before trying to flip the element
49-
- `flipFit`: flip the element completely vertically and horizontally
50-
- `ignore`: ignore any collisions and just carry on
51-
94+
- `bestFit`: find the best fit before trying to flip the element
95+
- `flipFit`: flip the element completely vertically and horizontally
96+
- `ignore`: ignore any collisions and just carry on
5297

53-
[PositionAlignment]: #type-positionalignment
98+
[alignment]: #the-alignment-type

0 commit comments

Comments
 (0)