winduum 3.0.0-next.7 → 3.0.0-next.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "winduum",
3
- "version": "3.0.0-next.7",
3
+ "version": "3.0.0-next.8",
4
4
  "type": "module",
5
5
  "types": "types/index.d.ts",
6
6
  "main": "plugin/index.cjs",
@@ -82,7 +82,6 @@
82
82
  "default": "./src/components/details/index.js"
83
83
  },
84
84
  "./src/components/dialog": {
85
- "types": "./src/components/dialog/index.d.ts",
86
85
  "default": "./src/components/dialog/index.js"
87
86
  },
88
87
  "./src/components/drawer": {
@@ -1,40 +1,19 @@
1
- export interface ObserveCarouselOptions {
2
- visibleAttribute?: string
3
- observerOptions?: {
4
- rootMargin?: string
5
- threshold?: number | number[]
6
- }
7
- }
8
-
9
- export interface PaginationCarouselOptions {
10
- element?: HTMLElement | Element
11
- itemContent?: string
12
- activeAttribute?: string
13
- }
14
-
15
- export interface ScrollCarouselOptions {
16
- observe?: ObserveCarouselOptions
17
- pagination?: PaginationCarouselOptions
18
- progressElement?: HTMLProgressElement | Element
19
- counterMinElement?: HTMLElement | Element
20
- counterMaxElement?: HTMLElement | Element
21
- }
1
+ export type CarouselPlacement = 'left' | 'right' | 'top' | 'bottom'
22
2
 
23
- export interface AutoplayCarouselOptions {
24
- delay?: number
25
- pauseElements?: HTMLElement[] | Element[]
3
+ export interface ScrollByOptions {
4
+ direction?: number
5
+ vertical?: boolean
6
+ ratio?: number
26
7
  }
27
8
 
28
- export interface DragCarouselOptions {
29
- activeAttribute?: string
9
+ export interface ToggleScrollStateOptions {
10
+ prevElement?: HTMLButtonElement | null
11
+ nextElement?: HTMLButtonElement | null
12
+ vertical?: boolean
30
13
  }
31
14
 
32
- export function scrollPrev(element: HTMLElement | Element): void
33
- export function scrollNext(element: HTMLElement | Element): void
34
- export function scrollTo(element: HTMLElement | Element, selected?: number): void
35
- export function getItemCount(element: HTMLElement | Element, scrollWidth?: number, mathFloor?: boolean): number
36
- export function observeCarousel(element: HTMLElement | Element, options?: ObserveCarouselOptions): void
37
- export function scrollCarousel(element: HTMLElement | Element, options?: ScrollCarouselOptions): void
38
- export function paginationCarousel(element: HTMLElement | Element, options?: PaginationCarouselOptions): void
39
- export function autoplayCarousel(element: HTMLElement | Element, options?: AutoplayCarouselOptions): void
40
- export function dragCarousel(element: HTMLElement | Element, options?: DragCarouselOptions): void
15
+ export function scrollBy(element: HTMLElement, options?: ScrollByOptions): void
16
+ export function toggleScrollState(element: HTMLElement, options?: ToggleScrollStateOptions): void
17
+ export function setCurrentAttribute(element: HTMLElement, index: number, attributeName?: string): void
18
+ export function setSnappedAttribute(element: HTMLElement, target: HTMLElement, markerGroupElement?: HTMLElement | null): void
19
+ export function scrollToMarker(element: HTMLElement, target: HTMLElement, markerGroupElement: HTMLElement, scrollIntoViewOptions?: ScrollIntoViewOptions): void
@@ -0,0 +1,5 @@
1
+ export interface ToggleDetailsOptions {
2
+ selector?: string
3
+ }
4
+
5
+ export function toggleDetails(element: HTMLInputElement, options?: ToggleDetailsOptions): void
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @param {HTMLInputElement} element
3
+ * @param {import("./").ToggleDetailsOptions} options
4
+ * @returns void
5
+ */
6
+ export const toggleDetails = (element, options = {}) => {
7
+ const { selector } = {
8
+ selector: 'details',
9
+ ...options,
10
+ }
11
+
12
+ element?.closest(selector)?.toggleAttribute('open', element.checked)
13
+ }
@@ -1,8 +1,5 @@
1
1
  # [Details](https://winduum.dev/docs/components/details.html)
2
2
 
3
- ## Dependencies
4
- * [slide-element](https://www.npmjs.com/package/slide-element)
5
-
6
3
  ## Installation
7
4
  ```shell
8
5
  npm i winduum
@@ -10,7 +7,7 @@ npm i winduum
10
7
  Learn more how to set up Winduum [here](https://winduum.dev/docs/).
11
8
 
12
9
  ```js
13
- import { showDetails } from 'winduum/src/components/details/index.js'
10
+ import { toggleDetails } from 'winduum/src/components/details/index.js'
14
11
  ```
15
12
 
16
13
  ### Local imports
@@ -18,7 +15,7 @@ By default, imports are directly from `npm` so you can leverage updates.
18
15
  You can also copy and paste the code from this directory to your project and remap the imports to local.
19
16
 
20
17
  ```js
21
- import { showDetails } from '@/components/details/assets/index.js'
18
+ import { toggleDetails } from '@/components/details/assets/index.js'
22
19
  ```
23
20
 
24
21
  ### Docs
@@ -1,16 +1,9 @@
1
- export interface ScrollDrawerOptions {
2
- snapClass?: string
3
- opacityProperty?: string
4
- opacityRatio?: number
5
- scrollOpen?: number
6
- scrollClose?: number
7
- scrollSize?: number
8
- scrollDirection?:number
9
- }
1
+ export type DrawerPlacement = 'left' | 'right' | 'top' | 'bottom'
10
2
 
11
- export function showDrawer(element: HTMLElement | Element, distance?: number, direction?: 'left' | 'top'): void
12
- export function closeDrawer(element: HTMLElement | Element, distance?: number, direction?: 'left' | 'top'): void
13
- export function scrollInitDrawer(element: HTMLElement | Element, distance?: number, direction?: 'left' | 'top'): void
14
- export function toggleDrawerAttributes(element: HTMLDialogElement | Element, state?: 'open' | 'close', snapClass?: string): void
15
- export function scrollDrawerState(scrollState: number, scrollDirection: number): boolean
16
- export function scrollDrawer(element: HTMLDialogElement | Element, options?: ScrollDrawerOptions): void
3
+ export function isVerticalDrawer(placement: DrawerPlacement): boolean
4
+ export function scrollDrawer(element: HTMLElement | Element, placement: DrawerPlacement, reverse?: boolean, behavior?: 'auto' | 'instant'): void
5
+ export function showDrawer(element: HTMLElement | Element, placement: DrawerPlacement): Promise<void>
6
+ export function closeDrawer(element: HTMLElement | Element, placement: DrawerPlacement): void
7
+ export function drawerEvents(element: HTMLDialogElement | Element, contentElement: HTMLElement | Element, placement: DrawerPlacement, signal?: AbortSignal): void
8
+ export function drawerObserver(element: HTMLDialogElement | Element, placement: DrawerPlacement): IntersectionObserver
9
+ export function drawerProperties(element: HTMLElement | Element, placement: DrawerPlacement): ['top' | 'left', number, number]