@koine/react 2.0.0-beta.15 → 2.0.0-beta.17
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/Animations/useReveal.js +4 -3
- package/Autocomplete/AutocompleteMui.js +4 -4
- package/Autocomplete/helpers.js +1 -2
- package/Breadcrumbs/Breadcrumbs.js +1 -1
- package/Calendar/CalendarDaygridCell.js +2 -2
- package/Calendar/CalendarDaygridNav.js +3 -2
- package/Calendar/CalendarDaygridTable.js +5 -5
- package/Calendar/CalendarLegend.js +2 -1
- package/Calendar/calendar-api-google.js +1 -3
- package/Calendar/useCalendar.js +15 -15
- package/Details/Details.d.ts +60 -60
- package/Details/Details.js +6 -6
- package/Dialog/DialogMui.d.ts +9 -9
- package/Dialog/DialogMui.js +1 -1
- package/Dialog/css/bare.d.ts +8 -8
- package/Dialog/css/bare.js +2 -1
- package/Dialog/m/bare.js +1 -1
- package/Dialog/sc/bare.d.ts +2 -2
- package/Dialog/sc/bare.js +1 -1
- package/Dialog/sc/framer.js +1 -1
- package/Dialog/sc/framerMaterial.js +1 -1
- package/Dialog/sc/material.d.ts +2 -2
- package/Dialog/sc/material.js +1 -1
- package/Dialog/tw/bare.d.ts +5 -5
- package/Dialog/tw/bare.js +2 -1
- package/Dialog/tw/elegant.d.ts +5 -5
- package/Dialog/tw/elegant.js +2 -1
- package/Dialog/tw/framer.d.ts +2 -2
- package/Dialog/tw/framer.js +1 -1
- package/Dialog/tw/framerMaterial.d.ts +2 -2
- package/Dialog/tw/framerMaterial.js +1 -1
- package/Dialog/tw/material.d.ts +5 -5
- package/Dialog/tw/material.js +2 -1
- package/Form/Form.d.ts +1 -1
- package/Form/Form.js +3 -3
- package/Form/sc/bare.js +1 -1
- package/Forms/Field/FieldControl.js +1 -1
- package/Forms/Password/Password.js +2 -2
- package/Forms/antispam.js +1 -3
- package/Forms/helpers.js +1 -2
- package/Grid/Grid.js +2 -2
- package/Header/useHeader.js +6 -5
- package/MenuItem/useMenuItem.js +2 -2
- package/Pagination/PaginationNav.js +1 -1
- package/Progress/ProgressOverlay.js +2 -2
- package/Rating/Rating.js +3 -3
- package/Sidebar/Sidebar.js +3 -3
- package/Spacing/Spacing.js +4 -4
- package/Tabs/TabsMui.d.ts +5 -5
- package/Tabs/TabsMui.js +1 -1
- package/Tabs/tw/bare.d.ts +4 -4
- package/Tabs/tw/bare.js +2 -1
- package/Tabs/tw/material.d.ts +1 -1
- package/Tabs/tw/material.js +2 -1
- package/Tabs/useTabs.js +3 -2
- package/Typography/ReadMore.js +6 -6
- package/Typography/TextLoop.js +4 -4
- package/{helpers/createUseMediaQueryWidth.d.ts → createUseMediaQueryWidth.d.ts} +1 -1
- package/{helpers/createUseMediaQueryWidth.js → createUseMediaQueryWidth.js} +6 -6
- package/css/index.d.ts +0 -1
- package/css/index.js +0 -1
- package/index.d.ts +25 -1
- package/index.js +24 -1
- package/package.json +79 -94
- package/sc/index.d.ts +0 -1
- package/sc/index.js +0 -1
- package/scm/index.d.ts +0 -1
- package/scm/index.js +0 -1
- package/shared/index.d.ts +3 -4
- package/shared/index.js +3 -4
- package/styles/media.js +3 -2
- package/styles/theme--vanilla.js +4 -3
- package/styles/theme.js +2 -2
- package/tw/index.d.ts +0 -1
- package/tw/index.js +0 -1
- package/twm/index.d.ts +0 -1
- package/twm/index.js +0 -1
- package/types.d.ts +2 -0
- package/{hooks/useAsyncFn.js → useAsyncFn.js} +3 -3
- package/{hooks/useDateLocale.js → useDateLocale.js} +3 -3
- package/{hooks/useFixedOffset.js → useFixedOffset.js} +2 -5
- package/{hooks/useInterval.js → useInterval.js} +3 -3
- package/useIsomorphicLayoutEffect.d.ts +3 -0
- package/{hooks/useIsomorphicLayoutEffect.js → useIsomorphicLayoutEffect.js} +1 -1
- package/{hooks/useKeyUp.js → useKeyUp.js} +3 -3
- package/{hooks/useMeasure.js → useMeasure.js} +11 -15
- package/{hooks/useNavigateAway.js → useNavigateAway.js} +1 -1
- package/{hooks/usePrevious.js → usePrevious.js} +2 -1
- package/{hooks/useScrollPosition.js → useScrollPosition.js} +2 -2
- package/{hooks/useScrollThreshold.js → useScrollThreshold.js} +4 -3
- package/{hooks/useScrollTo.js → useScrollTo.js} +4 -3
- package/{hooks/useSmoothScroll.js → useSmoothScroll.js} +2 -3
- package/{hooks/useSpinDelay.js → useSpinDelay.js} +2 -1
- package/{hooks/useTraceUpdate.js → useTraceUpdate.js} +2 -1
- package/{hooks/useWindowSize.d.ts → useWindowSize.d.ts} +1 -1
- package/{hooks/useWindowSize.js → useWindowSize.js} +4 -4
- package/Meta/index.d.ts +0 -2
- package/Meta/index.js +0 -2
- package/NoJs/index.d.ts +0 -2
- package/NoJs/index.js +0 -2
- package/helpers/index.d.ts +0 -4
- package/helpers/index.js +0 -4
- package/hooks/index.d.ts +0 -20
- package/hooks/index.js +0 -20
- package/hooks/types.d.ts +0 -2
- package/hooks/types.js +0 -1
- package/hooks/useIsomorphicLayoutEffect.d.ts +0 -3
- /package/{Meta/Meta.d.ts → Meta.d.ts} +0 -0
- /package/{Meta/Meta.js → Meta.js} +0 -0
- /package/{NoJs/NoJs.d.ts → NoJs.d.ts} +0 -0
- /package/{NoJs/NoJs.js → NoJs.js} +0 -0
- /package/{helpers/classed.d.ts → classed.d.ts} +0 -0
- /package/{helpers/classed.js → classed.js} +0 -0
- /package/{helpers/extend-component.d.ts → extendComponent.d.ts} +0 -0
- /package/{helpers/extend-component.js → extendComponent.js} +0 -0
- /package/{helpers/mergeRefs.d.ts → mergeRefs.d.ts} +0 -0
- /package/{helpers/mergeRefs.js → mergeRefs.js} +0 -0
- /package/{hooks/useAsyncFn.d.ts → useAsyncFn.d.ts} +0 -0
- /package/{hooks/useDateLocale.d.ts → useDateLocale.d.ts} +0 -0
- /package/{hooks/useFirstMountState.d.ts → useFirstMountState.d.ts} +0 -0
- /package/{hooks/useFirstMountState.js → useFirstMountState.js} +0 -0
- /package/{hooks/useFixedOffset.d.ts → useFixedOffset.d.ts} +0 -0
- /package/{hooks/useFocus.d.ts → useFocus.d.ts} +0 -0
- /package/{hooks/useFocus.js → useFocus.js} +0 -0
- /package/{hooks/useInterval.d.ts → useInterval.d.ts} +0 -0
- /package/{hooks/useKeyUp.d.ts → useKeyUp.d.ts} +0 -0
- /package/{hooks/useMeasure.d.ts → useMeasure.d.ts} +0 -0
- /package/{hooks/useMountedState.d.ts → useMountedState.d.ts} +0 -0
- /package/{hooks/useMountedState.js → useMountedState.js} +0 -0
- /package/{hooks/useNavigateAway.d.ts → useNavigateAway.d.ts} +0 -0
- /package/{hooks/usePrevious.d.ts → usePrevious.d.ts} +0 -0
- /package/{hooks/usePreviousRef.d.ts → usePreviousRef.d.ts} +0 -0
- /package/{hooks/usePreviousRef.js → usePreviousRef.js} +0 -0
- /package/{hooks/useScrollPosition.d.ts → useScrollPosition.d.ts} +0 -0
- /package/{hooks/useScrollThreshold.d.ts → useScrollThreshold.d.ts} +0 -0
- /package/{hooks/useScrollTo.d.ts → useScrollTo.d.ts} +0 -0
- /package/{hooks/useSmoothScroll.d.ts → useSmoothScroll.d.ts} +0 -0
- /package/{hooks/useSpinDelay.d.ts → useSpinDelay.d.ts} +0 -0
- /package/{hooks/useTraceUpdate.d.ts → useTraceUpdate.d.ts} +0 -0
- /package/{hooks/useUpdateEffect.d.ts → useUpdateEffect.d.ts} +0 -0
- /package/{hooks/useUpdateEffect.js → useUpdateEffect.js} +0 -0
package/styles/theme--vanilla.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { __read } from "tslib";
|
|
1
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
import { createContext, useEffect, useState } from "react";
|
|
3
|
-
import isBrowser from "@koine/utils
|
|
4
|
-
import useUpdateEffect from "../
|
|
4
|
+
import { isBrowser } from "@koine/utils";
|
|
5
|
+
import useUpdateEffect from "../useUpdateEffect.js";
|
|
5
6
|
export var THEME_KEY = "theme";
|
|
6
7
|
export var THEME_DEFAULT = "light";
|
|
7
8
|
export var getInitialThemeFromClient = function () {
|
|
@@ -23,7 +24,7 @@ export var ThemeVanillaContext = createContext({
|
|
|
23
24
|
});
|
|
24
25
|
export var ThemeVanillaProvider = function (_a) {
|
|
25
26
|
var initialTheme = _a.initialTheme, children = _a.children;
|
|
26
|
-
var _b = useState(initialTheme), theme = _b[0], setTheme = _b[1];
|
|
27
|
+
var _b = __read(useState(initialTheme), 2), theme = _b[0], setTheme = _b[1];
|
|
27
28
|
var rawSetTheme = function (rawTheme) {
|
|
28
29
|
if (!rawTheme || !isBrowser) {
|
|
29
30
|
return;
|
package/styles/theme.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
1
|
+
import { __assign, __read } from "tslib";
|
|
2
2
|
import { useTheme as _useTheme } from "styled-components";
|
|
3
3
|
var DEFAULT_BREAKPOINTS = {
|
|
4
4
|
xs: 0,
|
|
@@ -10,7 +10,7 @@ var DEFAULT_BREAKPOINTS = {
|
|
|
10
10
|
};
|
|
11
11
|
export var breakpoints = process.env["BREAKPOINTS"]
|
|
12
12
|
? process.env["BREAKPOINTS"].split(",").reduce(function (map, pair) {
|
|
13
|
-
var _a = pair.split(":"), key = _a[0], value = _a[1];
|
|
13
|
+
var _a = __read(pair.split(":"), 2), key = _a[0], value = _a[1];
|
|
14
14
|
map[key] = parseFloat(value);
|
|
15
15
|
return map;
|
|
16
16
|
}, {})
|
package/tw/index.d.ts
CHANGED
package/tw/index.js
CHANGED
package/twm/index.d.ts
CHANGED
package/twm/index.js
CHANGED
package/types.d.ts
CHANGED
|
@@ -7,3 +7,5 @@ export type Option = {
|
|
|
7
7
|
};
|
|
8
8
|
export type KoineComponentProps<BaseComponentProps, ExtendableProps> = BaseComponentProps & ExtendableProps;
|
|
9
9
|
export type KoineComponent<Props = any> = string | React.ForwardRefExoticComponent<Props> | React.ExoticComponent<Props> | React.FC<Props> | ((props: Props) => JSX.Element);
|
|
10
|
+
export type PromiseType<P extends Promise<any>> = P extends Promise<infer T> ? T : never;
|
|
11
|
+
export type FunctionReturningPromise = (...args: any[]) => Promise<any>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
1
|
+
import { __assign, __read, __spreadArray } from "tslib";
|
|
2
2
|
import { useCallback, useRef, useState } from "react";
|
|
3
3
|
import { useMountedState } from "./useMountedState.js";
|
|
4
4
|
export function useAsyncFn(fn, deps, initialState) {
|
|
@@ -6,7 +6,7 @@ export function useAsyncFn(fn, deps, initialState) {
|
|
|
6
6
|
if (initialState === void 0) { initialState = { loading: false }; }
|
|
7
7
|
var lastCallId = useRef(0);
|
|
8
8
|
var isMounted = useMountedState();
|
|
9
|
-
var _a = useState(initialState), state = _a[0], set = _a[1];
|
|
9
|
+
var _a = __read(useState(initialState), 2), state = _a[0], set = _a[1];
|
|
10
10
|
var callback = useCallback(function () {
|
|
11
11
|
var args = [];
|
|
12
12
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -16,7 +16,7 @@ export function useAsyncFn(fn, deps, initialState) {
|
|
|
16
16
|
if (!state.loading) {
|
|
17
17
|
set(function (prevState) { return (__assign(__assign({}, prevState), { loading: true })); });
|
|
18
18
|
}
|
|
19
|
-
return fn.apply(void 0, args).then(function (value) {
|
|
19
|
+
return fn.apply(void 0, __spreadArray([], __read(args), false)).then(function (value) {
|
|
20
20
|
isMounted() &&
|
|
21
21
|
callId === lastCallId.current &&
|
|
22
22
|
set({ value: value, loading: false });
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { __awaiter, __generator } from "tslib";
|
|
1
|
+
import { __awaiter, __generator, __read } from "tslib";
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
3
|
export function useDateLocale(locale, defaultLocale) {
|
|
4
4
|
var _this = this;
|
|
5
5
|
if (defaultLocale === void 0) { defaultLocale = "en"; }
|
|
6
|
-
var _a = useState(), data = _a[0], setData = _a[1];
|
|
7
|
-
var _b = useState(defaultLocale), current = _b[0], setCurrent = _b[1];
|
|
6
|
+
var _a = __read(useState(), 2), data = _a[0], setData = _a[1];
|
|
7
|
+
var _b = __read(useState(defaultLocale), 2), current = _b[0], setCurrent = _b[1];
|
|
8
8
|
useEffect(function () {
|
|
9
9
|
var importLocaleFile = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
10
10
|
var localeToSet;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { useRef } from "react";
|
|
2
|
-
import debounce from "@koine/utils
|
|
3
|
-
import $each from "@koine/dom
|
|
4
|
-
import calculateFixedOffset from "@koine/dom/calculateFixedOffset";
|
|
5
|
-
import injectCss from "@koine/dom/injectCss";
|
|
6
|
-
import listenResizeDebounced from "@koine/dom/listenResizeDebounced";
|
|
2
|
+
import { debounce } from "@koine/utils";
|
|
3
|
+
import { $each, calculateFixedOffset, injectCss, listenResizeDebounced, } from "@koine/dom";
|
|
7
4
|
import useIsomorphicLayoutEffect from "./useIsomorphicLayoutEffect.js";
|
|
8
5
|
var inject = function (value) {
|
|
9
6
|
injectCss("useFixedOffset", "html{scroll-padding-top: ".concat(value, "px}"));
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { __spreadArray } from "tslib";
|
|
1
|
+
import { __read, __spreadArray } from "tslib";
|
|
2
2
|
import { useEffect, useRef } from "react";
|
|
3
|
-
import noop from "@koine/utils
|
|
3
|
+
import { noop } from "@koine/utils";
|
|
4
4
|
export function useInterval(callback, delay, deps) {
|
|
5
5
|
if (deps === void 0) { deps = []; }
|
|
6
6
|
var savedCallback = useRef();
|
|
7
7
|
useEffect(function () {
|
|
8
8
|
savedCallback.current = callback;
|
|
9
|
-
}, __spreadArray([callback], deps,
|
|
9
|
+
}, __spreadArray([callback], __read(deps), false));
|
|
10
10
|
useEffect(function () {
|
|
11
11
|
function tick() {
|
|
12
12
|
if (savedCallback.current)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { __spreadArray } from "tslib";
|
|
1
|
+
import { __read, __spreadArray } from "tslib";
|
|
2
2
|
import { useEffect } from "react";
|
|
3
|
-
import on from "@koine/dom
|
|
3
|
+
import { on } from "@koine/dom";
|
|
4
4
|
export function useKeyUp(callback, deps) {
|
|
5
5
|
if (deps === void 0) { deps = []; }
|
|
6
6
|
useEffect(function () {
|
|
@@ -13,6 +13,6 @@ export function useKeyUp(callback, deps) {
|
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
15
|
return listener;
|
|
16
|
-
}, __spreadArray([callback], deps,
|
|
16
|
+
}, __spreadArray([callback], __read(deps), false));
|
|
17
17
|
}
|
|
18
18
|
export default useKeyUp;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import { __spreadArray } from "tslib";
|
|
1
|
+
import { __read, __spreadArray } from "tslib";
|
|
2
2
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
-
import debounce from "@koine/utils
|
|
4
|
-
import
|
|
5
|
-
import listenResizeDebounced from "@koine/dom/listenResizeDebounced";
|
|
6
|
-
import listenScrollDebounced from "@koine/dom/listenScrollDebounced";
|
|
7
|
-
import off from "@koine/dom/off";
|
|
8
|
-
import on from "@koine/dom/on";
|
|
3
|
+
import { debounce, noop } from "@koine/utils";
|
|
4
|
+
import { listenResizeDebounced, listenScrollDebounced, off, on, } from "@koine/dom";
|
|
9
5
|
var observer;
|
|
10
6
|
function findScrollContainers(element) {
|
|
11
7
|
var result = [];
|
|
@@ -14,7 +10,7 @@ function findScrollContainers(element) {
|
|
|
14
10
|
var _a = window.getComputedStyle(element), overflow = _a.overflow, overflowX = _a.overflowX, overflowY = _a.overflowY;
|
|
15
11
|
if ([overflow, overflowX, overflowY].some(function (prop) { return prop === "auto" || prop === "scroll"; }))
|
|
16
12
|
result.push(element);
|
|
17
|
-
return __spreadArray(__spreadArray([], result,
|
|
13
|
+
return __spreadArray(__spreadArray([], __read(result), false), __read(findScrollContainers(element.parentElement)), false);
|
|
18
14
|
}
|
|
19
15
|
var keys = [
|
|
20
16
|
"x",
|
|
@@ -31,7 +27,7 @@ var areBoundsEqual = function (a, b) {
|
|
|
31
27
|
};
|
|
32
28
|
export function useMeasure(options) {
|
|
33
29
|
var _a = (options || {}).scroll, scroll = _a === void 0 ? false : _a;
|
|
34
|
-
var _b = useState({
|
|
30
|
+
var _b = __read(useState({
|
|
35
31
|
left: 0,
|
|
36
32
|
top: 0,
|
|
37
33
|
width: 0,
|
|
@@ -40,7 +36,7 @@ export function useMeasure(options) {
|
|
|
40
36
|
right: 0,
|
|
41
37
|
x: 0,
|
|
42
38
|
y: 0,
|
|
43
|
-
}), bounds = _b[0], setBounds = _b[1];
|
|
39
|
+
}), 2), bounds = _b[0], setBounds = _b[1];
|
|
44
40
|
var state = useRef([
|
|
45
41
|
null,
|
|
46
42
|
null,
|
|
@@ -52,13 +48,13 @@ export function useMeasure(options) {
|
|
|
52
48
|
mounted.current = true;
|
|
53
49
|
return function () { return void (mounted.current = false); };
|
|
54
50
|
}, []);
|
|
55
|
-
var _c = useMemo(function () {
|
|
51
|
+
var _c = __read(useMemo(function () {
|
|
56
52
|
var callback = function () {
|
|
57
53
|
var _args = [];
|
|
58
54
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
59
55
|
_args[_i] = arguments[_i];
|
|
60
56
|
}
|
|
61
|
-
var _a = state.current, element = _a[0], lastBounds = _a[3];
|
|
57
|
+
var _a = __read(state.current, 4), element = _a[0], lastBounds = _a[3];
|
|
62
58
|
if (!element)
|
|
63
59
|
return;
|
|
64
60
|
var size = element.getBoundingClientRect();
|
|
@@ -70,9 +66,9 @@ export function useMeasure(options) {
|
|
|
70
66
|
};
|
|
71
67
|
var debouncedCallback = debounce(callback);
|
|
72
68
|
return [callback, debouncedCallback, debouncedCallback];
|
|
73
|
-
}, [setBounds]), forceRefresh = _c[0], scrollChange = _c[2];
|
|
69
|
+
}, [setBounds]), 3), forceRefresh = _c[0], scrollChange = _c[2];
|
|
74
70
|
function removeListeners() {
|
|
75
|
-
var _a = state.current, scrollContainers = _a[1], resizeObserver = _a[2];
|
|
71
|
+
var _a = __read(state.current, 3), scrollContainers = _a[1], resizeObserver = _a[2];
|
|
76
72
|
if (scrollContainers) {
|
|
77
73
|
scrollContainers.forEach(function (element) {
|
|
78
74
|
return off(element, "scroll", scrollChange);
|
|
@@ -85,7 +81,7 @@ export function useMeasure(options) {
|
|
|
85
81
|
}
|
|
86
82
|
}
|
|
87
83
|
function addListeners() {
|
|
88
|
-
var _a = state.current, element = _a[0], scrollContainers = _a[1];
|
|
84
|
+
var _a = __read(state.current, 2), element = _a[0], scrollContainers = _a[1];
|
|
89
85
|
if (!element)
|
|
90
86
|
return;
|
|
91
87
|
if (!observer && ResizeObserver) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { __read } from "tslib";
|
|
1
2
|
import { useState } from "react";
|
|
2
3
|
export function usePrevious(state, defaulValue) {
|
|
3
|
-
var _a = useState([state, defaulValue]), tuple = _a[0], setTuple = _a[1];
|
|
4
|
+
var _a = __read(useState([state, defaulValue]), 2), tuple = _a[0], setTuple = _a[1];
|
|
4
5
|
if (tuple[1] !== state) {
|
|
5
6
|
setTuple([tuple[1], state]);
|
|
6
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useRef } from "react";
|
|
2
|
-
import isBrowser from "@koine/utils
|
|
3
|
-
import listenScroll from "@koine/dom
|
|
2
|
+
import { isBrowser } from "@koine/utils";
|
|
3
|
+
import { listenScroll } from "@koine/dom";
|
|
4
4
|
import useIsomorphicLayoutEffect from "./useIsomorphicLayoutEffect.js";
|
|
5
5
|
var zeroPosition = { x: 0, y: 0 };
|
|
6
6
|
var getClientRect = function (element) {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { __read } from "tslib";
|
|
1
2
|
import { useCallback, useEffect, useState } from "react";
|
|
2
|
-
import noop from "@koine/utils
|
|
3
|
-
import listenScroll from "@koine/dom
|
|
3
|
+
import { noop } from "@koine/utils";
|
|
4
|
+
import { listenScroll } from "@koine/dom";
|
|
4
5
|
export var useScrollThreshold = function (threshold, callback) {
|
|
5
|
-
var _a = useState(false), isBelow = _a[0], setIsBelow = _a[1];
|
|
6
|
+
var _a = __read(useState(false), 2), isBelow = _a[0], setIsBelow = _a[1];
|
|
6
7
|
var handler = useCallback(function () {
|
|
7
8
|
if (threshold) {
|
|
8
9
|
var posY = window.scrollY;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { __read } from "tslib";
|
|
2
|
+
import { isBrowser } from "@koine/utils";
|
|
3
|
+
import useHeader from "./Header/useHeader.js";
|
|
3
4
|
export function useScrollTo(id, offset) {
|
|
4
5
|
if (id === void 0) { id = ""; }
|
|
5
6
|
if (offset === void 0) { offset = 0; }
|
|
6
|
-
var _a = useHeader(), headerHeight = _a[2];
|
|
7
|
+
var _a = __read(useHeader(), 3), headerHeight = _a[2];
|
|
7
8
|
if (!isBrowser) {
|
|
8
9
|
return;
|
|
9
10
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useCallback } from "react";
|
|
2
|
-
import isNumber from "@koine/utils
|
|
3
|
-
import getOffsetTopSlim from "@koine/dom
|
|
4
|
-
import scrollTo from "@koine/dom/scrollTo";
|
|
2
|
+
import { isNumber } from "@koine/utils";
|
|
3
|
+
import { getOffsetTopSlim, scrollTo } from "@koine/dom";
|
|
5
4
|
import useFixedOffset from "./useFixedOffset.js";
|
|
6
5
|
export function useSmoothScroll(disregardAutomaticFixedOffset) {
|
|
7
6
|
var fixedOffset = useFixedOffset();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __read } from "tslib";
|
|
1
2
|
import { useEffect, useRef, useState } from "react";
|
|
2
3
|
var State;
|
|
3
4
|
(function (State) {
|
|
@@ -9,7 +10,7 @@ var State;
|
|
|
9
10
|
export function useSpinDelay(loading, delay, minDuration) {
|
|
10
11
|
if (delay === void 0) { delay = 500; }
|
|
11
12
|
if (minDuration === void 0) { minDuration = 200; }
|
|
12
|
-
var _a = useState(State.IDLE), state = _a[0], setState = _a[1];
|
|
13
|
+
var _a = __read(useState(State.IDLE), 2), state = _a[0], setState = _a[1];
|
|
13
14
|
var timeout = useRef();
|
|
14
15
|
useEffect(function () {
|
|
15
16
|
if (loading && state === State.IDLE) {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { __read } from "tslib";
|
|
1
2
|
import { useEffect, useRef } from "react";
|
|
2
3
|
export function useTraceUpdate(props) {
|
|
3
4
|
var prev = useRef(props);
|
|
4
5
|
useEffect(function () {
|
|
5
6
|
var changedProps = Object.entries(props).reduce(function (ps, _a) {
|
|
6
|
-
var k =
|
|
7
|
+
var _b = __read(_a, 2), k = _b[0], v = _b[1];
|
|
7
8
|
if (prev.current[k] !== v) {
|
|
8
9
|
ps[k] = [prev.current[k], v];
|
|
9
10
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { __read } from "tslib";
|
|
1
2
|
import { useEffect, useState } from "react";
|
|
2
|
-
import listenResize from "@koine/dom
|
|
3
|
-
import listenResizeDebounced from "@koine/dom/listenResizeDebounced";
|
|
3
|
+
import { listenResize, listenResizeDebounced } from "@koine/dom";
|
|
4
4
|
export function useWindowSize(wait, immediate) {
|
|
5
|
-
var _a = useState(0), width = _a[0], widthSet = _a[1];
|
|
6
|
-
var _b = useState(0), height = _b[0], heightSet = _b[1];
|
|
5
|
+
var _a = __read(useState(0), 2), width = _a[0], widthSet = _a[1];
|
|
6
|
+
var _b = __read(useState(0), 2), height = _b[0], heightSet = _b[1];
|
|
7
7
|
useEffect(function () {
|
|
8
8
|
function updateSize() {
|
|
9
9
|
widthSet(window.innerWidth);
|
package/Meta/index.d.ts
DELETED
package/Meta/index.js
DELETED
package/NoJs/index.d.ts
DELETED
package/NoJs/index.js
DELETED
package/helpers/index.d.ts
DELETED
package/helpers/index.js
DELETED
package/hooks/index.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export { useAsyncFn, type UseAsyncFnReturn, type UseAsyncState, } from "./useAsyncFn.js";
|
|
2
|
-
export { useDateLocale } from "./useDateLocale.js";
|
|
3
|
-
export { useFirstMountState } from "./useFirstMountState.js";
|
|
4
|
-
export { useFixedOffset } from "./useFixedOffset.js";
|
|
5
|
-
export { useFocus } from "./useFocus.js";
|
|
6
|
-
export { useInterval } from "./useInterval.js";
|
|
7
|
-
export { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect.js";
|
|
8
|
-
export { useKeyUp } from "./useKeyUp.js";
|
|
9
|
-
export { useMeasure, type UseMeasureOptions, type UseMeasureReturn, } from "./useMeasure.js";
|
|
10
|
-
export { useMountedState } from "./useMountedState.js";
|
|
11
|
-
export { useNavigateAway, type UseNavigateAwayHandler, } from "./useNavigateAway.js";
|
|
12
|
-
export { usePrevious } from "./usePrevious.js";
|
|
13
|
-
export { usePreviousRef } from "./usePreviousRef.js";
|
|
14
|
-
export { useScrollPosition } from "./useScrollPosition.js";
|
|
15
|
-
export { useScrollThreshold } from "./useScrollThreshold.js";
|
|
16
|
-
export { useSmoothScroll } from "./useSmoothScroll.js";
|
|
17
|
-
export { useSpinDelay } from "./useSpinDelay.js";
|
|
18
|
-
export { useTraceUpdate } from "./useTraceUpdate.js";
|
|
19
|
-
export { useUpdateEffect } from "./useUpdateEffect.js";
|
|
20
|
-
export { useWindowSize } from "./useWindowSize.js";
|
package/hooks/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export { useAsyncFn, } from "./useAsyncFn.js";
|
|
2
|
-
export { useDateLocale } from "./useDateLocale.js";
|
|
3
|
-
export { useFirstMountState } from "./useFirstMountState.js";
|
|
4
|
-
export { useFixedOffset } from "./useFixedOffset.js";
|
|
5
|
-
export { useFocus } from "./useFocus.js";
|
|
6
|
-
export { useInterval } from "./useInterval.js";
|
|
7
|
-
export { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect.js";
|
|
8
|
-
export { useKeyUp } from "./useKeyUp.js";
|
|
9
|
-
export { useMeasure, } from "./useMeasure.js";
|
|
10
|
-
export { useMountedState } from "./useMountedState.js";
|
|
11
|
-
export { useNavigateAway, } from "./useNavigateAway.js";
|
|
12
|
-
export { usePrevious } from "./usePrevious.js";
|
|
13
|
-
export { usePreviousRef } from "./usePreviousRef.js";
|
|
14
|
-
export { useScrollPosition } from "./useScrollPosition.js";
|
|
15
|
-
export { useScrollThreshold } from "./useScrollThreshold.js";
|
|
16
|
-
export { useSmoothScroll } from "./useSmoothScroll.js";
|
|
17
|
-
export { useSpinDelay } from "./useSpinDelay.js";
|
|
18
|
-
export { useTraceUpdate } from "./useTraceUpdate.js";
|
|
19
|
-
export { useUpdateEffect } from "./useUpdateEffect.js";
|
|
20
|
-
export { useWindowSize } from "./useWindowSize.js";
|
package/hooks/types.d.ts
DELETED
package/hooks/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|