Skip to content

Commit

Permalink
Add TypeScript declaration file
Browse files Browse the repository at this point in the history
  • Loading branch information
Amphiluke committed Dec 7, 2022
1 parent dbf77d3 commit d6ce5eb
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 19 deletions.
10 changes: 10 additions & 0 deletions dist/handy-scroll.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
declare namespace handyScroll {
export function mount(containerRef: HTMLElement | NodeList | HTMLCollection | HTMLElement[] | string): void;
export function mounted(containerRef: HTMLElement | string): boolean;
export function update(containerRef: HTMLElement | NodeList | HTMLCollection | HTMLElement[] | string): void;
export function destroy(containerRef: HTMLElement | NodeList | HTMLCollection | HTMLElement[] | string): void;
export function destroyDetached(): void;
}

export default handyScroll;
export as namespace handyScroll;
8 changes: 4 additions & 4 deletions dist/handy-scroll.es6.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
handy-scroll v1.1.0
handy-scroll v1.1.1
https://amphiluke.github.io/handy-scroll/
(c) 2022 Amphiluke
*/
Expand Down Expand Up @@ -205,7 +205,7 @@ https://amphiluke.github.io/handy-scroll/
let handyScroll = {
/**
* Mount widgets in the given containers
* @param {HTMLElement|NodeList|HTMLCollection|Array|String} containerRef - Widget container reference (either an element, or a list of elements, or a selector)
* @param {HTMLElement|NodeList|HTMLCollection|HTMLElement[]|String} containerRef - Widget container reference (either an element, or a list of elements, or a selector)
*/
mount(containerRef) {
dom.$$(containerRef).forEach(container => {
Expand All @@ -230,7 +230,7 @@ https://amphiluke.github.io/handy-scroll/

/**
* Update widget parameters and position
* @param {HTMLElement|NodeList|HTMLCollection|Array|String} containerRef - Widget container reference (either an element, or a list of elements, or a selector)
* @param {HTMLElement|NodeList|HTMLCollection|HTMLElement[]|String} containerRef - Widget container reference (either an element, or a list of elements, or a selector)
*/
update(containerRef) {
dom.$$(containerRef).forEach(container => {
Expand All @@ -246,7 +246,7 @@ https://amphiluke.github.io/handy-scroll/

/**
* Destroy widgets mounted in the given containers
* @param {HTMLElement|NodeList|HTMLCollection|Array|String} containerRef - Widget container reference (either an element, or a list of elements, or a selector)
* @param {HTMLElement|NodeList|HTMLCollection|HTMLElement[]|String} containerRef - Widget container reference (either an element, or a list of elements, or a selector)
*/
destroy(containerRef) {
dom.$$(containerRef).forEach(container => {
Expand Down
2 changes: 1 addition & 1 deletion dist/handy-scroll.es6.min.js

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

8 changes: 4 additions & 4 deletions dist/handy-scroll.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
handy-scroll v1.1.0
handy-scroll v1.1.1
https://amphiluke.github.io/handy-scroll/
(c) 2022 Amphiluke
*/
Expand Down Expand Up @@ -210,7 +210,7 @@ https://amphiluke.github.io/handy-scroll/
var handyScroll = {
/**
* Mount widgets in the given containers
* @param {HTMLElement|NodeList|HTMLCollection|Array|String} containerRef - Widget container reference (either an element, or a list of elements, or a selector)
* @param {HTMLElement|NodeList|HTMLCollection|HTMLElement[]|String} containerRef - Widget container reference (either an element, or a list of elements, or a selector)
*/
mount: function mount(containerRef) {
dom.$$(containerRef).forEach(function (container) {
Expand All @@ -235,7 +235,7 @@ https://amphiluke.github.io/handy-scroll/
},
/**
* Update widget parameters and position
* @param {HTMLElement|NodeList|HTMLCollection|Array|String} containerRef - Widget container reference (either an element, or a list of elements, or a selector)
* @param {HTMLElement|NodeList|HTMLCollection|HTMLElement[]|String} containerRef - Widget container reference (either an element, or a list of elements, or a selector)
*/
update: function update(containerRef) {
dom.$$(containerRef).forEach(function (container) {
Expand All @@ -250,7 +250,7 @@ https://amphiluke.github.io/handy-scroll/
},
/**
* Destroy widgets mounted in the given containers
* @param {HTMLElement|NodeList|HTMLCollection|Array|String} containerRef - Widget container reference (either an element, or a list of elements, or a selector)
* @param {HTMLElement|NodeList|HTMLCollection|HTMLElement[]|String} containerRef - Widget container reference (either an element, or a list of elements, or a selector)
*/
destroy: function destroy(containerRef) {
dom.$$(containerRef).forEach(function (container) {
Expand Down
2 changes: 1 addition & 1 deletion dist/handy-scroll.min.js

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

4 changes: 2 additions & 2 deletions package-lock.json

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

15 changes: 11 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
{
"name": "handy-scroll",
"version": "1.1.0",
"version": "1.1.1",
"description": "Handy dependency-free floating scrollbar widget",
"main": "dist/handy-scroll.min.js",
"module": "src/handy-scroll.js",
"style": "dist/handy-scroll.css",
"main": "./dist/handy-scroll.min.js",
"module": "./src/handy-scroll.js",
"style": "./dist/handy-scroll.css",
"types": "./dist/handy-scroll.d.ts",
"exports": {
"types": "./dist/handy-scroll.d.ts",
"import": "./src/handy-scroll.js",
"require": "./dist/handy-scroll.js"
},
"type": "module",
"files": [
"dist",
"src"
Expand Down
6 changes: 3 additions & 3 deletions src/handy-scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ let instances = []; // if it were not for IE, it would be better to use Map (con
let handyScroll = {
/**
* Mount widgets in the given containers
* @param {HTMLElement|NodeList|HTMLCollection|Array|String} containerRef - Widget container reference (either an element, or a list of elements, or a selector)
* @param {HTMLElement|NodeList|HTMLCollection|HTMLElement[]|String} containerRef - Widget container reference (either an element, or a list of elements, or a selector)
*/
mount(containerRef) {
dom.$$(containerRef).forEach(container => {
Expand All @@ -31,7 +31,7 @@ let handyScroll = {

/**
* Update widget parameters and position
* @param {HTMLElement|NodeList|HTMLCollection|Array|String} containerRef - Widget container reference (either an element, or a list of elements, or a selector)
* @param {HTMLElement|NodeList|HTMLCollection|HTMLElement[]|String} containerRef - Widget container reference (either an element, or a list of elements, or a selector)
*/
update(containerRef) {
dom.$$(containerRef).forEach(container => {
Expand All @@ -47,7 +47,7 @@ let handyScroll = {

/**
* Destroy widgets mounted in the given containers
* @param {HTMLElement|NodeList|HTMLCollection|Array|String} containerRef - Widget container reference (either an element, or a list of elements, or a selector)
* @param {HTMLElement|NodeList|HTMLCollection|HTMLElement[]|String} containerRef - Widget container reference (either an element, or a list of elements, or a selector)
*/
destroy(containerRef) {
dom.$$(containerRef).forEach(container => {
Expand Down

0 comments on commit d6ce5eb

Please sign in to comment.