Skip to content

Commit

Permalink
Update doc generator
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmybtlr committed Jan 1, 2024
1 parent 0d19923 commit 0a931a4
Show file tree
Hide file tree
Showing 18 changed files with 11,073 additions and 10,443 deletions.
80 changes: 4 additions & 76 deletions content/2.functions/actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,81 +2,9 @@

#### A collection of useful actions

## Page Actions
## // subtitle: Page Actions
// description: A collection of useful actions

##### A collection of useful actions

### scrollToAnchor
Smoothly scroll to an anchor on the page

```js [js]
scrollToAnchor('#my-anchor')
```

### toggleElementScroll
Toggles the element scroll

```js [js]
toggleElementScroll(document.querySelector('#my-element'))
```

### copyToClipboard
Copies a text to the clipboard

```js [js]
copyToClipboard()
```

### toggleDarkMode
Toggles the dark mode

```js [js]
toggleDarkMode()
```

### redirect
Redirects to a new URL

```js [js]
redirect('https://example.com')
```

## Form Actions

##### A collection of useful actions

### resetForm
Resets a form

```js [js]
resetForm(document.querySelector('form'))
```

### focusOn
Focuses on an element

```js [js]
focusOn(document.querySelector('#my-element'))
```

### focusOnFirst
Focuses on the first element

```js [js]
focusOnFirst(document.querySelector('#my-element'))
```

### focusOnLast
Focuses on the last element

```js [js]
focusOnLast(document.querySelector('#my-element'))
```

### focusTrap
Sets up a keyboard trap within an HTML element, allowing the focus to cycle between the first and last focusable elements when the Tab key is pressed.

```js [js]
focusTrap(document.querySelector('#my-element'))
```
## // subtitle: Form Actions
// description: A collection of useful actions

152 changes: 54 additions & 98 deletions content/2.functions/detections.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,143 +2,99 @@

#### A collection of detections for common data types

### getDeviceType
Detect if the current device is a mobile device
### detectDevice
Detect the current device type (Mobile or Desktop)

```js [js]
getDeviceType()
```js
detectDevice()
```

### getRelativeMousePosition
Detect the current mouse position within a container via ID

```js [js]
getRelativeMousePosition('container', event)
```

### getNetworkStatus
Detect the current network status of the user (Online or Offline)

```js [js]
getNetworkStatus()
```

### getLocalStorage
Returns a local storage value by name and parses it into JSON

```js [js]
getLocalStorage('name')
```

### getSessionStorage
Returns a session storage value by name and parses it into JSON

```js [js]
getSessionStorage('name')
```html
`Mobile` or `Desktop`
```

### getURLParameters
Returns a value from the URL by name
### detectDeviceType
Detect the device OS (iOS, Android, Windows, etc.)

```js [js]
getURLParameters('http://url.com/page?name=Adam&surname=Smith')
```js
detectDeviceType()
```

### getURLHashParameters
Returns a value from the URL hash by name

```js [js]
getURLHashParameters()
```

### getURLSearchParameters
Retrieves and returns the parameters from the URL search query string

```js [js]
getURLSearchParameters()
```html
`iOS`, `Android`, `Windows`, `Mac`, `Linux`, `UNIX`, or `Unknown`
```

### getURL
Returns the current URL
### detectBrowser
Detects the user's browser based on the user agent string.

```js [js]
getURL()
```js
detectBrowser()
```

### getDomain
Returns the current domain

```js [js]
getDomain()
```

### getIP
Returns the current IP address

```js [js]
getIP()
```html
A string representing the detected browser.
```

### getPort
Returns the current port
### detectActiveBrowser
Detect if the browser window is currently active or hidden.

```js [js]
getPort()
```js
detectActiveBrowser()
```

### getProtocol
Returns the current protocol (HTTP or HTTPS)
### detectColorScheme
Detect the current color scheme

```js [js]
getProtocol()
```js
detectColorScheme()
```

### getReferrer
Returns the URL of the referring page (the page that linked to the current page)
### detectOS
Detect the current operating system

```js [js]
getReferrer()
```js
`getOS()`
```

### getCachedData
Retrieves cached entries and optionally filters the entries based on a provided key
### detectBrowserLanguage
Detect the current browser language

```js [js]
getCachedData('abc')
```js
detectBrowserLanguage()
```

### isInContainer
Detects if the element is currently in the container via ID
### detectGeolocation
Detect the current user's location

```js [js]
isInContainer(element, 'container')
```js
detectUserLocation()
```

### isOverflowingY
Detects if the element is overflowing vertically
### detectDeviceOrientation
Detect the currect device orientation

```js [js]
isOverflowingY(element)
```js
detectDeviceOrientation()
```

### isOverflowingX
Detects if the element is overflowing horizontally
### detectDeviceMotion
Detect the current device motion

```js [js]
isOverflowingX(element)
```js
detectDeviceMotion()
```

### isScrollable
Detects if the element is scrollable (overflowing vertically or horizontally)
### detectTailwindContainerBreakpoint
Detect the current container breakpoint based on Tailwind CSS breakpoints

```js [js]
isScrollable(element)
```js
detectTailwindContainerBreakpoint('container')
```

### isElement
Detects if the elements is an HTML element
### detectScrollPosition
Detect the current scroll position of the window

```js [js]
isElement(element)
```js
detectScrollPosition()
```

66 changes: 66 additions & 0 deletions content/2.functions/formatters.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,69 @@

#### A collection of formatters for common data types

### formatCurrency
Format numbers into local currency

```js
formatCurrency(1234.56)
```

```html
$1,234.56
```

### formatCurrencyUnits
Format a number as a currency in thousands, millions, or billions

```js
formatCurrencyUnits(1234567890)
```

```html
$1.23B
```

### formatTime
Format time into hours, minutes, and seconds

```js
formatTime(3723)
```

```html
1hr 2min 3s
```

### formatDatetime
Format Unix timestamp into a datetime string

```js
formatDatetime(1619097600)
```

```html
2021-04-22 00:00:00
```

### formatPercentage
Format a number into a percentage

```js
formatPercentage(0.1234)
```

```html
12.34%
```

### formatList
Create a string of comma-separated values from an array of strings with an optional conjunction.

```js
commaList(['one', 'two', 'three'])
```

```html
one, two and three
```

22 changes: 22 additions & 0 deletions content/2.functions/generators.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,25 @@

#### A collection of generators

### generateShortId
Generate a unique short ID based on the current timestamp

```js
generateShortId(36)
```

```html
1HR2MIN3S
```

### generateInitials
Generate initials from any string

```js
generateInitials('John Doe')
```

```html
JD
```

Loading

0 comments on commit 0a931a4

Please sign in to comment.