Skip to content

Commit

Permalink
README and CHANGELOG
Browse files Browse the repository at this point in the history
  • Loading branch information
KingSora committed May 9, 2024
1 parent 76589bb commit d9caa5d
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 25 deletions.
26 changes: 18 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ I created this plugin because I hate ugly and space consuming scrollbars. Simila
- Automatic update detection - **no polling**
- Usage of latest browser features - best **performance** in new browsers
- Flow independent - supports all values for `direction`, `flex-direction` and `writing-mode`
- Supports Scroll Snapping
- Supports all **virtual scrolling** libraries
- Supports the `body` element
- Simple and effective scrollbar styling
Expand Down Expand Up @@ -387,7 +388,7 @@ The [`PointerTypes`](https://developer.mozilla.org/en-US/docs/Web/API/PointerEve

```ts
// The options of a OverlayScrollbars instance.
export type Options = {
type Options = {
// Whether the padding shall be absolute.
paddingAbsolute: boolean;
// Whether to show the native scrollbars. Has only an effect it the native scrollbars are overlaid.
Expand Down Expand Up @@ -509,7 +510,7 @@ Is dispatched by scrolling the viewport.

```ts
// A mapping between event names and their listener arguments.
export type EventListenerArgs = {
type EventListenerArgs = {
// Dispatched after all elements are initialized and appended.
initialized: [instance: OverlayScrollbars];
// Dispatched after an update.
Expand All @@ -520,7 +521,7 @@ export type EventListenerArgs = {
scroll: [instance: OverlayScrollbars, event: Event];
};

export interface OnUpdatedEventListenerArgs {
interface OnUpdatedEventListenerArgs {
// Hints which describe what changed in the DOM.
updateHints: {
// Whether the size of the host element changed.
Expand All @@ -535,6 +536,8 @@ export interface OnUpdatedEventListenerArgs {
overflowAmountChanged: boolean;
// Whether the overflow style changed.
overflowStyleChanged: boolean;
// Whether the scroll coordinates changed.
scrollCoordinatesChanged: boolean;
// Whether an host mutation took place.
hostMutation: boolean;
// Whether an content mutation took place.
Expand Down Expand Up @@ -734,6 +737,13 @@ const osInstance = OverlayScrollbars(document.body, {});
overflowStyle: XY<OverflowStyle>;
// Whether the viewport has an overflow.
hasOverflow: XY<boolean>;
// The scroll coordinates of the viewport.
scrollCoordinates: {
// The start (origin) scroll coordinates for each axis.
start: XY<number>;
// The end scroll coordinates for each axis.
end: XY<number>;
};
// Whether the direction is considered rtl.
directionRTL: boolean;
// Whether the instance is considered destroyed.
Expand Down Expand Up @@ -1164,7 +1174,7 @@ instancePluginInstance.count; // 1

```ts
// Describes a OverlayScrollbar plugin.
export type Plugin<
type Plugin<
// the name of the plugin
Name extends string = string,
// the module instance type of the static module
Expand All @@ -1176,22 +1186,22 @@ export type Plugin<
};

// Describes a OverlayScrollbar plugin which has only a static module.
export type StaticPlugin<
type StaticPlugin<
Name extends string = string,
T extends PluginModuleInstance = PluginModuleInstance
> = Plugin<Name, T, void>;

// Describes a OverlayScrollbar plugin which has only a instance module.
export type InstancePlugin<
type InstancePlugin<
Name extends string = string,
T extends PluginModuleInstance = PluginModuleInstance
> = Plugin<Name, void, T>;

// Infers the type of the static modules instance of the passed plugin.
export type InferStaticPluginModuleInstance<T extends StaticPlugin>;
type InferStaticPluginModuleInstance<T extends StaticPlugin>;

// Infers the type of the instance modules instance of the passed plugin.
export type InferInstancePluginModuleInstance<T extends InstancePlugin>;
type InferInstancePluginModuleInstance<T extends InstancePlugin>;
```

</details>
Expand Down
22 changes: 22 additions & 0 deletions packages/overlayscrollbars/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# Changelog

## 2.8.0

### Breaking Changes

- Although not a major release, I've decided to remove the `rtlScrollBehavior` field from the `Environment` object. The reason for it is a switch of how the library now detects scroll coordinates for non default flow directions. The replacement for this field is the `scrollCoordinates` field of the `state` object for each instance.

### Features

- Support non default flow directions (block and inline) not only `direction: rtl`. [#625](https://github.com/KingSora/OverlayScrollbars/issues/625)
- A new field `scrollCoordinates` in the `state` object. It indicates the min. and max. scroll coordinates for the viewport. (useful for non default flow direction scrolling)
- A new field `scrollCoordinatesChanged` in the `updateHints` object. It indicates whether the scroll coordinates changed in an update.

### Improvements

- Fix a Firefox only behavior where releasing a scrollbar handle over an anchor would trigger the anchor and navigate to it.
- Change `zoom` detection: instead of the `window.resize` event, the `window.matchMedia` event is used.
- Greatly improve how dragging and releasing the scrollbar handle behaves for `scroll-snapped` viewports.

### Bug Fixes

- Fix a bug here pointer capture was released too early for wacom pen devices. [#630](https://github.com/KingSora/OverlayScrollbars/issues/630)

## 2.7.3

### Improvements
Expand Down
26 changes: 18 additions & 8 deletions packages/overlayscrollbars/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ I created this plugin because I hate ugly and space consuming scrollbars. Simila
- Automatic update detection - **no polling**
- Usage of latest browser features - best **performance** in new browsers
- Flow independent - supports all values for `direction`, `flex-direction` and `writing-mode`
- Supports Scroll Snapping
- Supports all **virtual scrolling** libraries
- Supports the `body` element
- Simple and effective scrollbar styling
Expand Down Expand Up @@ -387,7 +388,7 @@ The [`PointerTypes`](https://developer.mozilla.org/en-US/docs/Web/API/PointerEve

```ts
// The options of a OverlayScrollbars instance.
export type Options = {
type Options = {
// Whether the padding shall be absolute.
paddingAbsolute: boolean;
// Whether to show the native scrollbars. Has only an effect it the native scrollbars are overlaid.
Expand Down Expand Up @@ -509,7 +510,7 @@ Is dispatched by scrolling the viewport.

```ts
// A mapping between event names and their listener arguments.
export type EventListenerArgs = {
type EventListenerArgs = {
// Dispatched after all elements are initialized and appended.
initialized: [instance: OverlayScrollbars];
// Dispatched after an update.
Expand All @@ -520,7 +521,7 @@ export type EventListenerArgs = {
scroll: [instance: OverlayScrollbars, event: Event];
};

export interface OnUpdatedEventListenerArgs {
interface OnUpdatedEventListenerArgs {
// Hints which describe what changed in the DOM.
updateHints: {
// Whether the size of the host element changed.
Expand All @@ -535,6 +536,8 @@ export interface OnUpdatedEventListenerArgs {
overflowAmountChanged: boolean;
// Whether the overflow style changed.
overflowStyleChanged: boolean;
// Whether the scroll coordinates changed.
scrollCoordinatesChanged: boolean;
// Whether an host mutation took place.
hostMutation: boolean;
// Whether an content mutation took place.
Expand Down Expand Up @@ -734,6 +737,13 @@ const osInstance = OverlayScrollbars(document.body, {});
overflowStyle: XY<OverflowStyle>;
// Whether the viewport has an overflow.
hasOverflow: XY<boolean>;
// The scroll coordinates of the viewport.
scrollCoordinates: {
// The start (origin) scroll coordinates for each axis.
start: XY<number>;
// The end scroll coordinates for each axis.
end: XY<number>;
};
// Whether the direction is considered rtl.
directionRTL: boolean;
// Whether the instance is considered destroyed.
Expand Down Expand Up @@ -1164,7 +1174,7 @@ instancePluginInstance.count; // 1

```ts
// Describes a OverlayScrollbar plugin.
export type Plugin<
type Plugin<
// the name of the plugin
Name extends string = string,
// the module instance type of the static module
Expand All @@ -1176,22 +1186,22 @@ export type Plugin<
};

// Describes a OverlayScrollbar plugin which has only a static module.
export type StaticPlugin<
type StaticPlugin<
Name extends string = string,
T extends PluginModuleInstance = PluginModuleInstance
> = Plugin<Name, T, void>;

// Describes a OverlayScrollbar plugin which has only a instance module.
export type InstancePlugin<
type InstancePlugin<
Name extends string = string,
T extends PluginModuleInstance = PluginModuleInstance
> = Plugin<Name, void, T>;

// Infers the type of the static modules instance of the passed plugin.
export type InferStaticPluginModuleInstance<T extends StaticPlugin>;
type InferStaticPluginModuleInstance<T extends StaticPlugin>;

// Infers the type of the instance modules instance of the passed plugin.
export type InferInstancePluginModuleInstance<T extends InstancePlugin>;
type InferInstancePluginModuleInstance<T extends InstancePlugin>;
```

</details>
Expand Down
28 changes: 19 additions & 9 deletions website/mdx/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ I created this plugin because I hate ugly and space consuming scrollbars. Simila

## Goals & Features

- Simple, powerful and well documented API
- Simple, powerful and well documented API
- High browser compatibility - **Firefox 59+**, **Chrome 55+**, **Opera 42+**, **Edge 15+** and **Safari 10+**
- **Fully Accessible** - Native scroll behavior is completely preserved
- Can be run on the server (`Node`, `Deno` and `Bun`) - **SSR**, **SSG** and **ISR** support
Expand All @@ -14,6 +14,7 @@ I created this plugin because I hate ugly and space consuming scrollbars. Simila
- Automatic update detection - **no polling**
- Usage of latest browser features - best **performance** in new browsers
- Flow independent - supports all values for `direction`, `flex-direction` and `writing-mode`
- Supports Scroll Snapping
- Supports all **virtual scrolling** libraries
- Supports the `body` element
- Simple and effective scrollbar styling
Expand Down Expand Up @@ -364,7 +365,7 @@ The [`PointerTypes`](https://developer.mozilla.org/en-US/docs/Web/API/PointerEve

```ts
// The options of a OverlayScrollbars instance.
export type Options = {
type Options = {
// Whether the padding shall be absolute.
paddingAbsolute: boolean;
// Whether to show the native scrollbars. Has only an effect it the native scrollbars are overlaid.
Expand Down Expand Up @@ -486,7 +487,7 @@ Is dispatched by scrolling the viewport.

```ts
// A mapping between event names and their listener arguments.
export type EventListenerArgs = {
type EventListenerArgs = {
// Dispatched after all elements are initialized and appended.
initialized: [instance: OverlayScrollbars];
// Dispatched after an update.
Expand All @@ -497,7 +498,7 @@ export type EventListenerArgs = {
scroll: [instance: OverlayScrollbars, event: Event];
};

export interface OnUpdatedEventListenerArgs {
interface OnUpdatedEventListenerArgs {
// Hints which describe what changed in the DOM.
updateHints: {
// Whether the size of the host element changed.
Expand All @@ -512,6 +513,8 @@ export interface OnUpdatedEventListenerArgs {
overflowAmountChanged: boolean;
// Whether the overflow style changed.
overflowStyleChanged: boolean;
// Whether the scroll coordinates changed.
scrollCoordinatesChanged: boolean;
// Whether an host mutation took place.
hostMutation: boolean;
// Whether an content mutation took place.
Expand Down Expand Up @@ -711,6 +714,13 @@ const osInstance = OverlayScrollbars(document.body, {});
overflowStyle: XY<OverflowStyle>;
// Whether the viewport has an overflow.
hasOverflow: XY<boolean>;
// The scroll coordinates of the viewport.
scrollCoordinates: {
// The start (origin) scroll coordinates for each axis.
start: XY<number>;
// The end scroll coordinates for each axis.
end: XY<number>;
};
// Whether the direction is considered rtl.
directionRTL: boolean;
// Whether the instance is considered destroyed.
Expand Down Expand Up @@ -1141,7 +1151,7 @@ instancePluginInstance.count; // 1

```ts
// Describes a OverlayScrollbar plugin.
export type Plugin<
type Plugin<
// the name of the plugin
Name extends string = string,
// the module instance type of the static module
Expand All @@ -1153,22 +1163,22 @@ export type Plugin<
};

// Describes a OverlayScrollbar plugin which has only a static module.
export type StaticPlugin<
type StaticPlugin<
Name extends string = string,
T extends PluginModuleInstance = PluginModuleInstance
> = Plugin<Name, T, void>;

// Describes a OverlayScrollbar plugin which has only a instance module.
export type InstancePlugin<
type InstancePlugin<
Name extends string = string,
T extends PluginModuleInstance = PluginModuleInstance
> = Plugin<Name, void, T>;

// Infers the type of the static modules instance of the passed plugin.
export type InferStaticPluginModuleInstance<T extends StaticPlugin>;
type InferStaticPluginModuleInstance<T extends StaticPlugin>;

// Infers the type of the instance modules instance of the passed plugin.
export type InferInstancePluginModuleInstance<T extends InstancePlugin>;
type InferInstancePluginModuleInstance<T extends InstancePlugin>;
```

</details>
Expand Down

0 comments on commit d9caa5d

Please sign in to comment.