@websolutespa/bom-mixer-hooks 1.8.2 → 1.8.4
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/CHANGELOG.md +13 -0
- package/dist/index.d.ts +33 -16
- package/dist/index.js +183 -192
- package/dist/index.mjs +152 -162
- package/package.json +1 -1
- package/src/index.ts +3 -2
- package/src/useFilters/useFilters.test.ts +1 -1
- package/src/usePageLoading/usePageLoading.ts +80 -0
- package/src/useSearchParams/useSearchParams.ts +17 -52
- package/src/useSearchParamsEncoded/useSearchParamsEncoded.ts +13 -39
- package/src/useSearchParamsQs/useSearchParamsQs.ts +13 -39
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @websolutespa/bom-mixer-hooks
|
|
2
2
|
|
|
3
|
+
## 1.8.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Modified: usePageLoading, shallow routes do not fire loading state
|
|
8
|
+
|
|
9
|
+
## 1.8.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Added: usePageLoading
|
|
14
|
+
- Modified: useSearchParams, useSearchParamsEncoded, useSearchParamsQs
|
|
15
|
+
|
|
3
16
|
## 1.8.2
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -396,6 +396,23 @@ declare function PageProvider({ children, page }: {
|
|
|
396
396
|
page: IPage;
|
|
397
397
|
}): react_jsx_runtime.JSX.Element;
|
|
398
398
|
|
|
399
|
+
type IPageRouteOptions = {
|
|
400
|
+
shallow: boolean;
|
|
401
|
+
};
|
|
402
|
+
type IPageRoute = {
|
|
403
|
+
pathname: string;
|
|
404
|
+
query: Record<string, string>;
|
|
405
|
+
asPath: string;
|
|
406
|
+
};
|
|
407
|
+
declare function usePageLoading(options?: {
|
|
408
|
+
loading: boolean;
|
|
409
|
+
}): {
|
|
410
|
+
loading: boolean;
|
|
411
|
+
error: void | Error | undefined;
|
|
412
|
+
pageRoute: IPageRoute | undefined;
|
|
413
|
+
previousPageRoute: IPageRoute | undefined;
|
|
414
|
+
};
|
|
415
|
+
|
|
399
416
|
type IPaginationInfo<T = any> = {
|
|
400
417
|
items: T[];
|
|
401
418
|
page: number;
|
|
@@ -434,26 +451,19 @@ declare function getRealSize(element: HTMLElement | null): SizeType;
|
|
|
434
451
|
|
|
435
452
|
declare function useResize(callback: () => unknown, immediate?: boolean): void;
|
|
436
453
|
|
|
437
|
-
type SSRState = {
|
|
438
|
-
isBrowser: boolean;
|
|
439
|
-
isServer: boolean;
|
|
440
|
-
};
|
|
441
|
-
declare const detectIsBrowser: () => boolean;
|
|
442
|
-
declare function useSSR(): SSRState;
|
|
443
|
-
|
|
444
454
|
type Scroll = {
|
|
445
455
|
left: number;
|
|
446
456
|
top: number;
|
|
447
457
|
};
|
|
448
458
|
declare function useScroll(): Scroll;
|
|
449
459
|
|
|
460
|
+
declare function useScrolled(callback?: (top: number, left: number) => boolean): boolean;
|
|
461
|
+
|
|
450
462
|
declare function useScrollTo(offset?: number): (event: React.MouseEvent<HTMLElement>) => void;
|
|
451
463
|
declare function scrollToSelector(selector?: string, offset?: number): void;
|
|
452
464
|
declare function scrollToRelativeY(y?: number, offset?: number): void;
|
|
453
465
|
declare function scrollToY(y?: number): void;
|
|
454
466
|
|
|
455
|
-
declare function useScrolled(callback?: (top: number, left: number) => boolean): boolean;
|
|
456
|
-
|
|
457
467
|
declare function getSearchParams(url: string, key?: string): IParams | string | null;
|
|
458
468
|
declare function updateSearchParams(currentPath: string, params: IParams): {
|
|
459
469
|
pathname: string;
|
|
@@ -462,9 +472,9 @@ declare function updateSearchParams(currentPath: string, params: IParams): {
|
|
|
462
472
|
};
|
|
463
473
|
};
|
|
464
474
|
declare function pushSearchParams(router: NextRouter, params: IParams): void;
|
|
465
|
-
declare function pushSearchParamsSilently(params: IParams): void;
|
|
475
|
+
declare function pushSearchParamsSilently(router: NextRouter, params: IParams): void;
|
|
466
476
|
declare function replaceSearchParams(router: NextRouter, params: IParams): void;
|
|
467
|
-
declare function replaceSearchParamsSilently(params: IParams): void;
|
|
477
|
+
declare function replaceSearchParamsSilently(router: NextRouter, params: IParams): void;
|
|
468
478
|
type IParams = {
|
|
469
479
|
[key: string]: string;
|
|
470
480
|
};
|
|
@@ -489,9 +499,9 @@ declare function updateSearchParamsEncoded(currentPath: string, value: IParamsEn
|
|
|
489
499
|
};
|
|
490
500
|
};
|
|
491
501
|
declare function pushSearchParamsEncoded(router: NextRouter, value: IParamsEncoded, key?: string): void;
|
|
492
|
-
declare function pushSearchParamsEncodedSilently(value: IParamsEncoded, key?: string): void;
|
|
502
|
+
declare function pushSearchParamsEncodedSilently(router: NextRouter, value: IParamsEncoded, key?: string): void;
|
|
493
503
|
declare function replaceSearchParamsEncoded(router: NextRouter, value: IParamsEncoded, key?: string): void;
|
|
494
|
-
declare function replaceSearchParamsEncodedSilently(value: IParamsEncoded, key?: string): void;
|
|
504
|
+
declare function replaceSearchParamsEncodedSilently(router: NextRouter, value: IParamsEncoded, key?: string): void;
|
|
495
505
|
type IParamsEncoded = {
|
|
496
506
|
[key: string]: any;
|
|
497
507
|
} | null;
|
|
@@ -518,9 +528,9 @@ declare function updateSearchParamsQs(url: string, value: IParamsQs, key?: strin
|
|
|
518
528
|
query: string;
|
|
519
529
|
};
|
|
520
530
|
declare function pushSearchParamsQs(router: NextRouter, value: IParamsQs, key?: string): void;
|
|
521
|
-
declare function pushSearchParamsQsSilently(value: IParamsQs, key?: string): void;
|
|
531
|
+
declare function pushSearchParamsQsSilently(router: NextRouter, value: IParamsQs, key?: string): void;
|
|
522
532
|
declare function replaceSearchParamsQs(router: NextRouter, value: IParamsQs, key?: string): void;
|
|
523
|
-
declare function replaceSearchParamsQsSilently(value: IParamsQs, key?: string): void;
|
|
533
|
+
declare function replaceSearchParamsQsSilently(router: NextRouter, value: IParamsQs, key?: string): void;
|
|
524
534
|
declare function useSearchParamsQs(key?: string): IUseSearchParamsQsResult;
|
|
525
535
|
|
|
526
536
|
type Sorting<T> = {
|
|
@@ -533,6 +543,13 @@ declare function useSorting<T>(items_: T[], callback_: (items: T[], sort?: IEqua
|
|
|
533
543
|
setSort: (sort?: IEquatable) => void;
|
|
534
544
|
};
|
|
535
545
|
|
|
546
|
+
type SSRState = {
|
|
547
|
+
isBrowser: boolean;
|
|
548
|
+
isServer: boolean;
|
|
549
|
+
};
|
|
550
|
+
declare const detectIsBrowser: () => boolean;
|
|
551
|
+
declare function useSSR(): SSRState;
|
|
552
|
+
|
|
536
553
|
/**
|
|
537
554
|
* Like `useRef`, but it returns immutable ref that contains actual value.
|
|
538
555
|
*
|
|
@@ -557,4 +574,4 @@ type WindowSize = {
|
|
|
557
574
|
};
|
|
558
575
|
declare function useWindowSize(): WindowSize;
|
|
559
576
|
|
|
560
|
-
export { BodyScrollOptions, ClickOutGetContainer, CurrentStateType, ElementStackItem, ExtraProvider, Filter, FilterMode, FilterParams, FilterValues, GeoLocationSensorState, IExtra, IFilter, IFilterOption, IGeolocationPositionError, ILabelContext, ILayoutContext, ILazyModulesContext, IPageContext, IPaginationInfo, IParams, IParamsEncoded, IParamsQs, IUseSearchParamsEncodedResult, IUseSearchParamsQsResult, IUseSearchParamsResult, IUseSearchParamsValueResult, KeyCode, KeyMod, KeyboardOptions, KeyboardResult, LabelProvider, LabelService, LayoutProvider, LazyModulesProvider, PageProvider, SSRState, SizeResult, SizeType, Sorting, UIReducer, UIValue, UseFiltersResultType, UseKeyboard, UseKeyboardHandler, createElementWithId, createGenericContext, detectIsBrowser, filtersToParams, getCurrentPosition, getFilteredItems, getFilters, getOwnerPaddingRight, getOwnerScrollbarWidth, getPagedItems, getPaginationInfo, getRealSize, getSearchParams, getSearchParamsEncoded, getSearchParamsQs, getUID, hasGeolocation, isElement, isPaginationInfo, localCollectionDelete, localCollectionFetch, localCollectionGet, localCollectionPatch, localCollectionPost, localCollectionPut, parseLabel, parseParams, pushSearchParams, pushSearchParamsEncoded, pushSearchParamsEncodedSilently, pushSearchParamsQs, pushSearchParamsQsSilently, pushSearchParamsSilently, replaceSearchParams, replaceSearchParamsEncoded, replaceSearchParamsEncodedSilently, replaceSearchParamsQs, replaceSearchParamsQsSilently, replaceSearchParamsSilently, scrollToRelativeY, scrollToSelector, scrollToY, setFilters, updateSearchParams, updateSearchParamsEncoded, updateSearchParamsQs, useApi, useApiDelete, useApiFetch, useApiGet, useApiPatch, useApiPost, useApiPut, useBodyScroll, useBreakpoint, useClickAnyWhere, useClickOut, useCollectionApi, useCollectionApiDelete, useCollectionApiGet, useCollectionApiPatch, useCollectionApiPost, useCollectionApiPut, useCurrency, useCurrentState, useDateTimeFormat, useDebounce, useDebounceCallback, useDebugChangedProps, useDomObserver, useDrawer, useElementSize, useEventListener, useExtra, useFilters, useGeolocation, useIdle, useInfiniteLoader, useIntersectionObserver, useIsomorphicLayoutEffect, useKeyboard, useLabel, useLayout, useLazyModules, useModal, useMounted, useNumber, usePage, usePagination, usePortal, usePrevious, useRealSize, useResize, useSSR, useScroll, useScrollTo, useScrolled, useSearchParams, useSearchParamsEncoded, useSearchParamsQs, useSearchParamsValue, useSorting, useSyncedRef, useUI, useUnit, useUnmountEffect, useWindowSize };
|
|
577
|
+
export { BodyScrollOptions, ClickOutGetContainer, CurrentStateType, ElementStackItem, ExtraProvider, Filter, FilterMode, FilterParams, FilterValues, GeoLocationSensorState, IExtra, IFilter, IFilterOption, IGeolocationPositionError, ILabelContext, ILayoutContext, ILazyModulesContext, IPageContext, IPageRoute, IPageRouteOptions, IPaginationInfo, IParams, IParamsEncoded, IParamsQs, IUseSearchParamsEncodedResult, IUseSearchParamsQsResult, IUseSearchParamsResult, IUseSearchParamsValueResult, KeyCode, KeyMod, KeyboardOptions, KeyboardResult, LabelProvider, LabelService, LayoutProvider, LazyModulesProvider, PageProvider, SSRState, SizeResult, SizeType, Sorting, UIReducer, UIValue, UseFiltersResultType, UseKeyboard, UseKeyboardHandler, createElementWithId, createGenericContext, detectIsBrowser, filtersToParams, getCurrentPosition, getFilteredItems, getFilters, getOwnerPaddingRight, getOwnerScrollbarWidth, getPagedItems, getPaginationInfo, getRealSize, getSearchParams, getSearchParamsEncoded, getSearchParamsQs, getUID, hasGeolocation, isElement, isPaginationInfo, localCollectionDelete, localCollectionFetch, localCollectionGet, localCollectionPatch, localCollectionPost, localCollectionPut, parseLabel, parseParams, pushSearchParams, pushSearchParamsEncoded, pushSearchParamsEncodedSilently, pushSearchParamsQs, pushSearchParamsQsSilently, pushSearchParamsSilently, replaceSearchParams, replaceSearchParamsEncoded, replaceSearchParamsEncodedSilently, replaceSearchParamsQs, replaceSearchParamsQsSilently, replaceSearchParamsSilently, scrollToRelativeY, scrollToSelector, scrollToY, setFilters, updateSearchParams, updateSearchParamsEncoded, updateSearchParamsQs, useApi, useApiDelete, useApiFetch, useApiGet, useApiPatch, useApiPost, useApiPut, useBodyScroll, useBreakpoint, useClickAnyWhere, useClickOut, useCollectionApi, useCollectionApiDelete, useCollectionApiGet, useCollectionApiPatch, useCollectionApiPost, useCollectionApiPut, useCurrency, useCurrentState, useDateTimeFormat, useDebounce, useDebounceCallback, useDebugChangedProps, useDomObserver, useDrawer, useElementSize, useEventListener, useExtra, useFilters, useGeolocation, useIdle, useInfiniteLoader, useIntersectionObserver, useIsomorphicLayoutEffect, useKeyboard, useLabel, useLayout, useLazyModules, useModal, useMounted, useNumber, usePage, usePageLoading, usePagination, usePortal, usePrevious, useRealSize, useResize, useSSR, useScroll, useScrollTo, useScrolled, useSearchParams, useSearchParamsEncoded, useSearchParamsQs, useSearchParamsValue, useSorting, useSyncedRef, useUI, useUnit, useUnmountEffect, useWindowSize };
|