@opensite/hooks 2.0.0 → 2.0.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/dist/browser/opensite-hooks.umd.cjs +1 -1
- package/dist/browser/opensite-hooks.umd.js +1 -1
- package/dist/browser/opensite-hooks.umd.js.map +1 -1
- package/dist/core/index.cjs +7 -0
- package/dist/core/index.d.ts +13 -0
- package/dist/core/index.js +7 -0
- package/dist/core/useOpenGraphExtractor.cjs +59 -0
- package/dist/core/useOpenGraphExtractor.d.ts +64 -0
- package/dist/core/useOpenGraphExtractor.js +59 -0
- package/dist/core/useWebsiteExtractorBase.cjs +153 -0
- package/dist/core/useWebsiteExtractorBase.d.ts +9 -0
- package/dist/core/useWebsiteExtractorBase.js +153 -0
- package/dist/core/useWebsiteLinksExtractor.cjs +16 -0
- package/dist/core/useWebsiteLinksExtractor.d.ts +14 -0
- package/dist/core/useWebsiteLinksExtractor.js +16 -0
- package/dist/core/useWebsiteMetaExtractor.cjs +20 -0
- package/dist/core/useWebsiteMetaExtractor.d.ts +12 -0
- package/dist/core/useWebsiteMetaExtractor.js +20 -0
- package/dist/core/useWebsiteRssExtractor.cjs +15 -0
- package/dist/core/useWebsiteRssExtractor.d.ts +12 -0
- package/dist/core/useWebsiteRssExtractor.js +15 -0
- package/dist/core/useWebsiteSchemaExtractor.cjs +15 -0
- package/dist/core/useWebsiteSchemaExtractor.d.ts +11 -0
- package/dist/core/useWebsiteSchemaExtractor.js +15 -0
- package/dist/core/websiteExtractorService.cjs +66 -0
- package/dist/core/websiteExtractorService.d.ts +3 -0
- package/dist/core/websiteExtractorService.js +66 -0
- package/dist/core/websiteExtractorTypes.cjs +25 -0
- package/dist/core/websiteExtractorTypes.d.ts +65 -0
- package/dist/core/websiteExtractorTypes.js +25 -0
- package/package.json +36 -1
- package/dist/hooks/index.cjs +0 -16
- package/dist/hooks/index.d.ts +0 -24
- package/dist/hooks/index.js +0 -16
- package/dist/hooks/useBoolean.cjs +0 -1
- package/dist/hooks/useBoolean.d.ts +0 -2
- package/dist/hooks/useBoolean.js +0 -1
- package/dist/hooks/useCopyToClipboard.cjs +0 -1
- package/dist/hooks/useCopyToClipboard.d.ts +0 -2
- package/dist/hooks/useCopyToClipboard.js +0 -1
- package/dist/hooks/useDebounceCallback.cjs +0 -1
- package/dist/hooks/useDebounceCallback.d.ts +0 -2
- package/dist/hooks/useDebounceCallback.js +0 -1
- package/dist/hooks/useDebounceValue.cjs +0 -1
- package/dist/hooks/useDebounceValue.d.ts +0 -2
- package/dist/hooks/useDebounceValue.js +0 -1
- package/dist/hooks/useEventListener.cjs +0 -1
- package/dist/hooks/useEventListener.d.ts +0 -1
- package/dist/hooks/useEventListener.js +0 -1
- package/dist/hooks/useHover.cjs +0 -1
- package/dist/hooks/useHover.d.ts +0 -1
- package/dist/hooks/useHover.js +0 -1
- package/dist/hooks/useIsClient.cjs +0 -1
- package/dist/hooks/useIsClient.d.ts +0 -1
- package/dist/hooks/useIsClient.js +0 -1
- package/dist/hooks/useIsomorphicLayoutEffect.cjs +0 -1
- package/dist/hooks/useIsomorphicLayoutEffect.d.ts +0 -1
- package/dist/hooks/useIsomorphicLayoutEffect.js +0 -1
- package/dist/hooks/useLocalStorage.cjs +0 -1
- package/dist/hooks/useLocalStorage.d.ts +0 -2
- package/dist/hooks/useLocalStorage.js +0 -1
- package/dist/hooks/useMap.cjs +0 -1
- package/dist/hooks/useMap.d.ts +0 -2
- package/dist/hooks/useMap.js +0 -1
- package/dist/hooks/useMediaQuery.cjs +0 -1
- package/dist/hooks/useMediaQuery.d.ts +0 -2
- package/dist/hooks/useMediaQuery.js +0 -1
- package/dist/hooks/useOnClickOutside.cjs +0 -1
- package/dist/hooks/useOnClickOutside.d.ts +0 -1
- package/dist/hooks/useOnClickOutside.js +0 -1
- package/dist/hooks/usePrevious.cjs +0 -1
- package/dist/hooks/usePrevious.d.ts +0 -1
- package/dist/hooks/usePrevious.js +0 -1
- package/dist/hooks/useResizeObserver.cjs +0 -1
- package/dist/hooks/useResizeObserver.d.ts +0 -1
- package/dist/hooks/useResizeObserver.js +0 -1
- package/dist/hooks/useSessionStorage.cjs +0 -1
- package/dist/hooks/useSessionStorage.d.ts +0 -2
- package/dist/hooks/useSessionStorage.js +0 -1
- package/dist/hooks/useThrottle.cjs +0 -1
- package/dist/hooks/useThrottle.d.ts +0 -2
- package/dist/hooks/useThrottle.js +0 -1
- package/dist/test/setup.cjs +0 -98
- package/dist/test/setup.d.ts +0 -5
- package/dist/test/setup.js +0 -98
- package/dist/test/utils.cjs +0 -73
- package/dist/test/utils.js +0 -73
package/dist/test/utils.cjs
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test utilities for React hook testing
|
|
3
|
-
*/
|
|
4
|
-
import { render } from "@testing-library/react";
|
|
5
|
-
/**
|
|
6
|
-
* Custom render function that wraps components with providers if needed
|
|
7
|
-
*/
|
|
8
|
-
function customRender(ui, options) {
|
|
9
|
-
return render(ui, { ...options });
|
|
10
|
-
}
|
|
11
|
-
// Re-export everything from testing-library
|
|
12
|
-
export * from "@testing-library/react";
|
|
13
|
-
// Override render with our custom version
|
|
14
|
-
export { customRender as render };
|
|
15
|
-
/**
|
|
16
|
-
* Helper to wait for a specific amount of time
|
|
17
|
-
* Useful for testing debounce/throttle hooks
|
|
18
|
-
*/
|
|
19
|
-
export function wait(ms) {
|
|
20
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Helper to mock matchMedia with specific matches value
|
|
24
|
-
*/
|
|
25
|
-
export function mockMatchMedia(matches) {
|
|
26
|
-
Object.defineProperty(window, "matchMedia", {
|
|
27
|
-
writable: true,
|
|
28
|
-
value: (query) => ({
|
|
29
|
-
matches,
|
|
30
|
-
media: query,
|
|
31
|
-
onchange: null,
|
|
32
|
-
addListener: () => { },
|
|
33
|
-
removeListener: () => { },
|
|
34
|
-
addEventListener: () => { },
|
|
35
|
-
removeEventListener: () => { },
|
|
36
|
-
dispatchEvent: () => false,
|
|
37
|
-
}),
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Helper to create a mock storage event
|
|
42
|
-
*/
|
|
43
|
-
export function createStorageEvent(key, newValue, storageArea = localStorage) {
|
|
44
|
-
return new StorageEvent("storage", {
|
|
45
|
-
key,
|
|
46
|
-
newValue,
|
|
47
|
-
oldValue: null,
|
|
48
|
-
storageArea,
|
|
49
|
-
url: window.location.href,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Helper to create a mock resize observer entry
|
|
54
|
-
*/
|
|
55
|
-
export function createResizeObserverEntry(target, width, height) {
|
|
56
|
-
return {
|
|
57
|
-
target,
|
|
58
|
-
contentRect: {
|
|
59
|
-
width,
|
|
60
|
-
height,
|
|
61
|
-
top: 0,
|
|
62
|
-
right: width,
|
|
63
|
-
bottom: height,
|
|
64
|
-
left: 0,
|
|
65
|
-
x: 0,
|
|
66
|
-
y: 0,
|
|
67
|
-
toJSON: () => ({}),
|
|
68
|
-
},
|
|
69
|
-
borderBoxSize: [{ blockSize: height, inlineSize: width }],
|
|
70
|
-
contentBoxSize: [{ blockSize: height, inlineSize: width }],
|
|
71
|
-
devicePixelContentBoxSize: [{ blockSize: height, inlineSize: width }],
|
|
72
|
-
};
|
|
73
|
-
}
|
package/dist/test/utils.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test utilities for React hook testing
|
|
3
|
-
*/
|
|
4
|
-
import { render } from "@testing-library/react";
|
|
5
|
-
/**
|
|
6
|
-
* Custom render function that wraps components with providers if needed
|
|
7
|
-
*/
|
|
8
|
-
function customRender(ui, options) {
|
|
9
|
-
return render(ui, { ...options });
|
|
10
|
-
}
|
|
11
|
-
// Re-export everything from testing-library
|
|
12
|
-
export * from "@testing-library/react";
|
|
13
|
-
// Override render with our custom version
|
|
14
|
-
export { customRender as render };
|
|
15
|
-
/**
|
|
16
|
-
* Helper to wait for a specific amount of time
|
|
17
|
-
* Useful for testing debounce/throttle hooks
|
|
18
|
-
*/
|
|
19
|
-
export function wait(ms) {
|
|
20
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Helper to mock matchMedia with specific matches value
|
|
24
|
-
*/
|
|
25
|
-
export function mockMatchMedia(matches) {
|
|
26
|
-
Object.defineProperty(window, "matchMedia", {
|
|
27
|
-
writable: true,
|
|
28
|
-
value: (query) => ({
|
|
29
|
-
matches,
|
|
30
|
-
media: query,
|
|
31
|
-
onchange: null,
|
|
32
|
-
addListener: () => { },
|
|
33
|
-
removeListener: () => { },
|
|
34
|
-
addEventListener: () => { },
|
|
35
|
-
removeEventListener: () => { },
|
|
36
|
-
dispatchEvent: () => false,
|
|
37
|
-
}),
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Helper to create a mock storage event
|
|
42
|
-
*/
|
|
43
|
-
export function createStorageEvent(key, newValue, storageArea = localStorage) {
|
|
44
|
-
return new StorageEvent("storage", {
|
|
45
|
-
key,
|
|
46
|
-
newValue,
|
|
47
|
-
oldValue: null,
|
|
48
|
-
storageArea,
|
|
49
|
-
url: window.location.href,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Helper to create a mock resize observer entry
|
|
54
|
-
*/
|
|
55
|
-
export function createResizeObserverEntry(target, width, height) {
|
|
56
|
-
return {
|
|
57
|
-
target,
|
|
58
|
-
contentRect: {
|
|
59
|
-
width,
|
|
60
|
-
height,
|
|
61
|
-
top: 0,
|
|
62
|
-
right: width,
|
|
63
|
-
bottom: height,
|
|
64
|
-
left: 0,
|
|
65
|
-
x: 0,
|
|
66
|
-
y: 0,
|
|
67
|
-
toJSON: () => ({}),
|
|
68
|
-
},
|
|
69
|
-
borderBoxSize: [{ blockSize: height, inlineSize: width }],
|
|
70
|
-
contentBoxSize: [{ blockSize: height, inlineSize: width }],
|
|
71
|
-
devicePixelContentBoxSize: [{ blockSize: height, inlineSize: width }],
|
|
72
|
-
};
|
|
73
|
-
}
|