@websolutespa/bom-mixer-hooks 1.7.1 → 1.7.2
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 +115 -105
- package/dist/index.d.ts +3 -2
- package/dist/index.js +5 -4
- package/dist/index.mjs +5 -4
- package/package.json +7 -7
- package/src/useBreakpoint/useBreakpoint.ts +10 -8
- package/src/useCollectionApi/useCollectionApi.ts +2 -1
- package/src/useLazyModules/useLazyModules.tsx +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,105 +1,115 @@
|
|
|
1
|
-
# @websolutespa/bom-mixer-hooks
|
|
2
|
-
|
|
3
|
-
## 1.7.
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
## 1.
|
|
20
|
-
|
|
21
|
-
###
|
|
22
|
-
|
|
23
|
-
- Modified:
|
|
24
|
-
- Updated dependencies
|
|
25
|
-
- @websolutespa/bom-mixer-models@1.
|
|
26
|
-
- @websolutespa/bom-mixer-store@1.
|
|
27
|
-
- @websolutespa/bom-core@
|
|
28
|
-
|
|
29
|
-
## 1.4.
|
|
30
|
-
|
|
31
|
-
### Patch Changes
|
|
32
|
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
- @websolutespa/bom-mixer-
|
|
37
|
-
- @websolutespa/bom-core@0.6.
|
|
38
|
-
|
|
39
|
-
## 1.4.
|
|
40
|
-
|
|
41
|
-
###
|
|
42
|
-
|
|
43
|
-
- Added
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
1
|
+
# @websolutespa/bom-mixer-hooks
|
|
2
|
+
|
|
3
|
+
## 1.7.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updating: dependencies
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @websolutespa/bom-mixer-models@1.7.2
|
|
10
|
+
- @websolutespa/bom-mixer-store@1.7.3
|
|
11
|
+
- @websolutespa/bom-core@1.7.3
|
|
12
|
+
|
|
13
|
+
## 1.7.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- aa41666: Added: useIntersectionObserver
|
|
18
|
+
|
|
19
|
+
## 1.7.0
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- 28e86bd: Modified: IPage, Store services & decorators
|
|
24
|
+
- Updated dependencies [28e86bd]
|
|
25
|
+
- @websolutespa/bom-mixer-models@1.7.0
|
|
26
|
+
- @websolutespa/bom-mixer-store@1.7.0
|
|
27
|
+
- @websolutespa/bom-core@1.7.0
|
|
28
|
+
|
|
29
|
+
## 1.4.2
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Modified: IFeatureType
|
|
34
|
+
- Updated dependencies
|
|
35
|
+
- @websolutespa/bom-mixer-models@1.5.4
|
|
36
|
+
- @websolutespa/bom-mixer-store@1.4.3
|
|
37
|
+
- @websolutespa/bom-core@0.6.5
|
|
38
|
+
|
|
39
|
+
## 1.4.1
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- Added: useCollectionApi, useExtra
|
|
44
|
+
- Modified: usePagination, useSearchParamsQs
|
|
45
|
+
- Updated dependencies
|
|
46
|
+
- @websolutespa/bom-mixer-models@1.5.2
|
|
47
|
+
- @websolutespa/bom-core@0.6.2
|
|
48
|
+
|
|
49
|
+
## 1.4.0
|
|
50
|
+
|
|
51
|
+
### Minor Changes
|
|
52
|
+
|
|
53
|
+
- Added useLazyModules
|
|
54
|
+
|
|
55
|
+
## 1.3.0
|
|
56
|
+
|
|
57
|
+
### Minor Changes
|
|
58
|
+
|
|
59
|
+
- Added: useSearchParamsQs
|
|
60
|
+
- Modified: useSearchParamsEncoded, useSearchParams, useScrollTo
|
|
61
|
+
|
|
62
|
+
## 1.2.1
|
|
63
|
+
|
|
64
|
+
### Patch Changes
|
|
65
|
+
|
|
66
|
+
- Added: LabelService
|
|
67
|
+
- Modified: useLabels, useScrollTo
|
|
68
|
+
|
|
69
|
+
## 1.2.0
|
|
70
|
+
|
|
71
|
+
### Minor Changes
|
|
72
|
+
|
|
73
|
+
- Updating: next 13
|
|
74
|
+
|
|
75
|
+
## 1.1.0
|
|
76
|
+
|
|
77
|
+
### Minor Changes
|
|
78
|
+
|
|
79
|
+
- Modified: useHttp, useApi
|
|
80
|
+
|
|
81
|
+
## 1.0.0
|
|
82
|
+
|
|
83
|
+
### Minor Changes
|
|
84
|
+
|
|
85
|
+
- Added: useScrolled
|
|
86
|
+
|
|
87
|
+
## 0.2.2
|
|
88
|
+
|
|
89
|
+
### Patch Changes
|
|
90
|
+
|
|
91
|
+
- Modified: useBreakpoint theme mediaQuery
|
|
92
|
+
|
|
93
|
+
## 0.2.1
|
|
94
|
+
|
|
95
|
+
### Patch Changes
|
|
96
|
+
|
|
97
|
+
- Added: source files
|
|
98
|
+
|
|
99
|
+
## 0.2.0
|
|
100
|
+
|
|
101
|
+
### Minor Changes
|
|
102
|
+
|
|
103
|
+
- Added: splat routes
|
|
104
|
+
|
|
105
|
+
## 0.1.0
|
|
106
|
+
|
|
107
|
+
### Minor Changes
|
|
108
|
+
|
|
109
|
+
- Added: @websolutespa/bom-core
|
|
110
|
+
|
|
111
|
+
## 0.0.2
|
|
112
|
+
|
|
113
|
+
### Patch Changes
|
|
114
|
+
|
|
115
|
+
- Added: first release
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import react__default, { RefObject, Dispatch, SetStateAction, MutableRefObject, ComponentProps, useEffect } from 'react';
|
|
2
|
+
import react__default, { RefObject, Dispatch, SetStateAction, CSSProperties, MutableRefObject, ComponentProps, useEffect } from 'react';
|
|
3
3
|
import { ApiRequestOptions } from '@websolutespa/bom-mixer-store';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import * as zustand_middleware from 'zustand/middleware';
|
|
@@ -42,7 +42,8 @@ type Breakpoint = {
|
|
|
42
42
|
min: number;
|
|
43
43
|
max: number;
|
|
44
44
|
};
|
|
45
|
-
|
|
45
|
+
type MediaQuery = Record<BreakpointType, CSSProperties['width']>;
|
|
46
|
+
declare function useBreakpoint(mediaQuery?: MediaQuery): Breakpoint;
|
|
46
47
|
|
|
47
48
|
type CartProps = {
|
|
48
49
|
hydrated: boolean;
|
package/dist/index.js
CHANGED
|
@@ -401,14 +401,15 @@ function useWindowSize() {
|
|
|
401
401
|
}
|
|
402
402
|
|
|
403
403
|
// src/useBreakpoint/useBreakpoint.ts
|
|
404
|
-
function useBreakpoint() {
|
|
404
|
+
function useBreakpoint(mediaQuery) {
|
|
405
405
|
const windowSize = useWindowSize();
|
|
406
406
|
const theme = (0, import_react7.useContext)(import_styled_components.ThemeContext);
|
|
407
|
-
if (!theme) {
|
|
407
|
+
if (!theme && !mediaQuery) {
|
|
408
408
|
throw new Error("useBreakpoint must be used within ThemeProvider");
|
|
409
409
|
}
|
|
410
|
-
const
|
|
411
|
-
const
|
|
410
|
+
const queries = mediaQuery || theme.mediaQuery;
|
|
411
|
+
const breakpoints = Object.keys(queries);
|
|
412
|
+
const values = Object.values(queries).map((x) => parseInt(String(x)));
|
|
412
413
|
const breakpoint = (0, import_react7.useMemo)(() => {
|
|
413
414
|
const breakpoint2 = values.reduce((p, c, i) => {
|
|
414
415
|
if (c < windowSize.width) {
|
package/dist/index.mjs
CHANGED
|
@@ -257,14 +257,15 @@ function useWindowSize() {
|
|
|
257
257
|
}
|
|
258
258
|
|
|
259
259
|
// src/useBreakpoint/useBreakpoint.ts
|
|
260
|
-
function useBreakpoint() {
|
|
260
|
+
function useBreakpoint(mediaQuery) {
|
|
261
261
|
const windowSize = useWindowSize();
|
|
262
262
|
const theme = useContext2(ThemeContext);
|
|
263
|
-
if (!theme) {
|
|
263
|
+
if (!theme && !mediaQuery) {
|
|
264
264
|
throw new Error("useBreakpoint must be used within ThemeProvider");
|
|
265
265
|
}
|
|
266
|
-
const
|
|
267
|
-
const
|
|
266
|
+
const queries = mediaQuery || theme.mediaQuery;
|
|
267
|
+
const breakpoints = Object.keys(queries);
|
|
268
|
+
const values = Object.values(queries).map((x) => parseInt(String(x)));
|
|
268
269
|
const breakpoint = useMemo(() => {
|
|
269
270
|
const breakpoint2 = values.reduce((p, c, i) => {
|
|
270
271
|
if (c < windowSize.width) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@websolutespa/bom-mixer-hooks",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.2",
|
|
4
4
|
"description": "Mixer Hooks module of the BOM Repository",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bom",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@websolutespa/bom-mixer-store": "*",
|
|
30
30
|
"framer-motion": ">= 7.2.1",
|
|
31
31
|
"iron-session": ">= 6.2.1",
|
|
32
|
-
"next": ">=
|
|
32
|
+
"next": ">= 14.1.4",
|
|
33
33
|
"react-dom": ">= 18.2.0",
|
|
34
34
|
"react": ">= 18.2.0",
|
|
35
35
|
"styled-components": ">= 5.3.11 <6.x.x",
|
|
@@ -37,21 +37,21 @@
|
|
|
37
37
|
"zustand": ">= 4.4.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@types/react": "^18.2.
|
|
41
|
-
"@types/react-dom": "^18.2.
|
|
40
|
+
"@types/react": "^18.2.75",
|
|
41
|
+
"@types/react-dom": "^18.2.24",
|
|
42
42
|
"@types/styled-components": "^5.1.26",
|
|
43
43
|
"@websolutespa/bom-cli": "*",
|
|
44
44
|
"@websolutespa/test": "*",
|
|
45
45
|
"@websolutespa/tsconfig": "*",
|
|
46
|
-
"eslint": "^
|
|
46
|
+
"eslint": "^9.0.0",
|
|
47
47
|
"eslint-config-websolute": "*",
|
|
48
48
|
"npm-run-all": "^4.1.5",
|
|
49
49
|
"raw-loader": "^4.0.2",
|
|
50
50
|
"react": "^18.2.0",
|
|
51
51
|
"styled-components": "^5.3.11",
|
|
52
|
-
"ts-node": "^10.9.
|
|
52
|
+
"ts-node": "^10.9.2",
|
|
53
53
|
"tsup": "^6.7.0",
|
|
54
|
-
"typescript": "^5.
|
|
54
|
+
"typescript": "^5.4.5"
|
|
55
55
|
},
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useContext, useMemo } from 'react';
|
|
1
|
+
import { CSSProperties, useContext, useMemo } from 'react';
|
|
2
2
|
import { ThemeContext } from 'styled-components';
|
|
3
3
|
import { useWindowSize } from '../useWindowSize/useWindowSize';
|
|
4
4
|
|
|
@@ -10,19 +10,21 @@ type Breakpoint = {
|
|
|
10
10
|
max: number;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
// todo
|
|
15
|
-
const windowSize = useWindowSize();
|
|
13
|
+
type MediaQuery = Record<BreakpointType, CSSProperties['width']>;
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
export function useBreakpoint(mediaQuery?: MediaQuery): Breakpoint {
|
|
16
|
+
const windowSize = useWindowSize();
|
|
18
17
|
|
|
19
18
|
const theme = useContext(ThemeContext);
|
|
20
|
-
|
|
19
|
+
|
|
20
|
+
if (!theme && !mediaQuery) {
|
|
21
21
|
throw new Error('useBreakpoint must be used within ThemeProvider');
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
const
|
|
25
|
-
|
|
24
|
+
const queries: MediaQuery = mediaQuery || theme.mediaQuery;
|
|
25
|
+
|
|
26
|
+
const breakpoints: BreakpointType[] = Object.keys(queries) as BreakpointType[];
|
|
27
|
+
const values: number[] = Object.values(queries).map(x => parseInt(String(x)));
|
|
26
28
|
|
|
27
29
|
const breakpoint = useMemo(() => {
|
|
28
30
|
const breakpoint = values.reduce((p, c, i) => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { QueryParams, qsSerialize } from '@websolutespa/bom-core';
|
|
2
|
-
import { useApiFetch, useLayout } from '@websolutespa/bom-mixer-hooks';
|
|
3
2
|
import { ApiRequestOptions } from '@websolutespa/bom-mixer-store';
|
|
3
|
+
import { useApiFetch } from '../useApi/useApi';
|
|
4
|
+
import { useLayout } from '../useLayout/useLayout';
|
|
4
5
|
import { localCollectionDelete, localCollectionGet, localCollectionPatch, localCollectionPost, localCollectionPut } from './local.collection';
|
|
5
6
|
|
|
6
7
|
type CollectionApi = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createGenericContext } from '@websolutespa/bom-mixer-hooks';
|
|
2
1
|
import { ILazyModules } from '@websolutespa/bom-mixer-models';
|
|
3
2
|
import React from 'react';
|
|
3
|
+
import { createGenericContext } from '../useGenericContext/useGenericContext';
|
|
4
4
|
|
|
5
5
|
export type ILazyModulesContext = ILazyModules;
|
|
6
6
|
|