@streamlayer/react-ui 1.9.0 → 1.10.0
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/lib/app/app/Advertisement/index.d.ts +1 -0
- package/lib/app/app/Advertisement/index.js +78 -67
- package/lib/app/app/Features/Gamification/Question.d.ts +1 -0
- package/lib/app/app/Features/Gamification/Question.js +43 -41
- package/lib/app/app/Features/Gamification/Tabs.js +23 -22
- package/lib/app/app/Features/Gamification/index.js +1 -1
- package/lib/app/app/Insight/index.d.ts +2 -0
- package/lib/app/app/Insight/index.js +28 -24
- package/lib/app/app/Navigation/SDKPillNode.d.ts +1 -0
- package/lib/app/app/Navigation/SDKPillNode.js +9 -0
- package/lib/app/app/Notifications/index.js +125 -113
- package/lib/app/app/Points/index.js +16 -16
- package/lib/app/app/index.d.ts +1 -0
- package/lib/app/app/index.js +84 -86
- package/lib/app/app/story/insight/index.d.ts +1 -0
- package/lib/app/app/story/insight/index.js +29 -26
- package/lib/app/app/story/insight/video.d.ts +1 -0
- package/lib/app/app/story/insight/video.js +13 -13
- package/lib/app/app/story/promotion/content.d.ts +3 -1
- package/lib/app/app/story/promotion/content.js +13 -10
- package/lib/app/app/story/promotion/index.d.ts +1 -0
- package/lib/app/app/story/promotion/index.js +34 -30
- package/lib/app/app/story/promotion/video.d.ts +1 -0
- package/lib/app/app/story/promotion/video.js +34 -31
- package/lib/app/app/styles.js +44 -0
- package/lib/app/app/useApp.d.ts +0 -14
- package/lib/app/app/useApp.js +14 -44
- package/lib/app/masters/Features/Gamification/Leaderboard.d.ts +1 -1
- package/lib/app/masters/Features/Gamification/Tabs.d.ts +2 -2
- package/lib/app/masters/Features/Gamification/Tabs.js +2 -2
- package/lib/app/masters/Features/Gamification/index.d.ts +2 -2
- package/lib/app/masters/Features/Gamification/index.js +1 -1
- package/lib/app/masters/Features/index.d.ts +2 -2
- package/lib/app/masters/Navigation/MastersNavigation/index.d.ts +1 -1
- package/lib/app/masters/Notifications/Onboarding/index.d.ts +1 -1
- package/lib/app/masters/Notifications/Onboarding/index.js +4 -4
- package/lib/app/masters/Notifications/index.d.ts +2 -2
- package/lib/app/masters/Notifications/index.js +1 -1
- package/lib/app/masters/masters.js +23 -23
- package/lib/app/masters/styles.d.ts +20 -0
- package/lib/app/{styles.js → masters/styles.js} +15 -15
- package/lib/app/masters/useSdkResponsive.d.ts +15 -0
- package/lib/app/masters/useSdkResponsive.js +45 -0
- package/lib/app/masters/useSdkScroll.d.ts +12 -0
- package/lib/app/masters/useSdkScroll.js +50 -0
- package/lib/app/useSdkResponsive.d.ts +1 -0
- package/lib/app/useSdkResponsive.js +27 -29
- package/lib/app/useSdkScroll.js +25 -24
- package/lib/assets/style.css +1 -1
- package/lib/ui/advertisement/banner/index.js +14 -11
- package/lib/ui/advertisement/index.d.ts +3 -0
- package/lib/ui/advertisement/index.js +31 -10
- package/lib/ui/advertisement/notification/index.d.ts +1 -0
- package/lib/ui/advertisement/notification/index.js +30 -27
- package/lib/ui/advertisement/notification/lower-third/index.d.ts +9 -0
- package/lib/ui/advertisement/notification/lower-third/index.js +37 -0
- package/lib/ui/advertisement/notification/lower-third/styles.d.ts +16 -0
- package/lib/ui/advertisement/notification/lower-third/styles.js +64 -0
- package/lib/ui/advertisement/overlay/index.d.ts +2 -0
- package/lib/ui/advertisement/overlay/index.js +58 -43
- package/lib/ui/advertisement/overlay/styles.d.ts +0 -2
- package/lib/ui/advertisement/overlay/styles.js +41 -52
- package/lib/ui/close-btn/index.d.ts +7 -0
- package/lib/ui/close-btn/index.js +47 -0
- package/lib/ui/gamification/detail/header/index.d.ts +2 -1
- package/lib/ui/gamification/detail/header/index.js +16 -15
- package/lib/ui/gamification/vote/styles.js +1 -1
- package/lib/ui/questions/insight/index.js +21 -20
- package/lib/ui/theme/masters-theme.js +36 -13
- package/lib/ui/theme/theme.js +22 -21
- package/lib/ui/timer/index.d.ts +3 -1
- package/lib/ui/timer/index.js +54 -32
- package/lib/ui/video-player/index.d.ts +2 -0
- package/lib/ui/video-player/index.js +62 -51
- package/lib/ui/video-player/styles.d.ts +1 -0
- package/lib/ui/video-player/styles.js +7 -6
- package/package.json +15 -15
- /package/lib/app/{styles.d.ts → app/styles.d.ts} +0 -0
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { jsx as n, jsxs as v } from "react/jsx-runtime";
|
|
2
2
|
import { useStore as C } from "@nanostores/react";
|
|
3
|
-
import { SDKContainer as x, SDKScrollContainer as A } from "
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { useRef as S, useMemo as T, useEffect as j } from "react";
|
|
3
|
+
import { SDKContainer as x, SDKScrollContainer as A } from "./styles.js";
|
|
4
|
+
import { useSdkScroll as F } from "./useSdkScroll.js";
|
|
5
|
+
import { useSdkFeature as M } from "../useSdkFeature.js";
|
|
6
|
+
import { useAnalyticsListener as d, newTabLinkListener as b, appScrollListener as D, appClickListener as I } from "../../hooks/analytics.js";
|
|
7
|
+
import { useRef as S, useMemo as B, useEffect as T } from "react";
|
|
9
8
|
import { resetCss as p } from "../../ui/theme/theme.js";
|
|
10
|
-
import { ActiveFeature as
|
|
11
|
-
import { MastersNavigation as
|
|
12
|
-
import { SDKNotifications as
|
|
13
|
-
import { useMastersApp as
|
|
14
|
-
import { MastersContext as
|
|
9
|
+
import { ActiveFeature as j, StandaloneFeature as k } from "./Features/index.js";
|
|
10
|
+
import { MastersNavigation as E } from "./Navigation/MastersNavigation/index.js";
|
|
11
|
+
import { SDKNotifications as K } from "./Notifications/index.js";
|
|
12
|
+
import { useMastersApp as O } from "./useMastersApp.js";
|
|
13
|
+
import { MastersContext as R } from "./useMastersContext.js";
|
|
14
|
+
import { useSdkResponsive as w } from "./useSdkResponsive.js";
|
|
15
15
|
import { StreamLayerMastersThemeProvider as ce } from "../../ui/theme/masters.js";
|
|
16
16
|
import { ChannelsButtonId as P } from "../../ui/navigation/button/Channels.js";
|
|
17
17
|
import { LeaderBoardButtonId as G } from "../../ui/navigation/button/LeaderBoard.js";
|
|
18
18
|
import { FeaturedGroupsButtonId as V } from "../../ui/navigation/button/FeaturedGroups.js";
|
|
19
19
|
const W = ({ sdk: e, className: i, scrollStore: l, appNode: t, scrollNode: s, responsiveStore: o }) => {
|
|
20
|
-
const [, r] =
|
|
20
|
+
const [, r] = M(e);
|
|
21
21
|
return /* @__PURE__ */ n(
|
|
22
|
-
|
|
22
|
+
j,
|
|
23
23
|
{
|
|
24
24
|
className: i,
|
|
25
25
|
scrollNode: s,
|
|
@@ -35,7 +35,7 @@ const W = ({ sdk: e, className: i, scrollStore: l, appNode: t, scrollNode: s, re
|
|
|
35
35
|
return s ? Array.from(s, (o) => {
|
|
36
36
|
const r = e.getFeature(o);
|
|
37
37
|
return r ? /* @__PURE__ */ n(
|
|
38
|
-
|
|
38
|
+
k,
|
|
39
39
|
{
|
|
40
40
|
className: i,
|
|
41
41
|
appNode: l,
|
|
@@ -47,24 +47,24 @@ const W = ({ sdk: e, className: i, scrollStore: l, appNode: t, scrollNode: s, re
|
|
|
47
47
|
) : null;
|
|
48
48
|
}) : null;
|
|
49
49
|
}, ie = ({ sdk: e, overlays: i, children: l }) => {
|
|
50
|
-
const t = S(null), s = S(null), [o] =
|
|
51
|
-
d(t, { enabled: a, event: "click", listener:
|
|
50
|
+
const t = S(null), s = S(null), [o] = w(t), [r, f] = F(t, o), { sdkEnabled: a, sdkReady: c, activeOverlay: m, activateAndLoadOverlay: h, activateEventWithId: N, deactivate: g, isLogged: y } = O(e);
|
|
51
|
+
d(t, { enabled: a, event: "click", listener: b }), d(r, {
|
|
52
52
|
enabled: a,
|
|
53
53
|
event: "scrollend",
|
|
54
|
-
listener:
|
|
54
|
+
listener: D,
|
|
55
55
|
useDomNode: !0
|
|
56
56
|
}), d(r, {
|
|
57
57
|
enabled: a,
|
|
58
58
|
event: "click",
|
|
59
|
-
listener:
|
|
59
|
+
listener: I,
|
|
60
60
|
useDomNode: !0
|
|
61
61
|
});
|
|
62
|
-
const L =
|
|
63
|
-
return
|
|
62
|
+
const L = B(() => ({ sdk: e }), [e]);
|
|
63
|
+
return T(() => {
|
|
64
64
|
import("./Features/Gamification/gamification-feature.js");
|
|
65
|
-
}, []), /* @__PURE__ */ n(
|
|
65
|
+
}, []), /* @__PURE__ */ n(R.Provider, { value: L, children: /* @__PURE__ */ v(x, { ref: t, children: [
|
|
66
66
|
a && /* @__PURE__ */ n(
|
|
67
|
-
|
|
67
|
+
E,
|
|
68
68
|
{
|
|
69
69
|
ref: s,
|
|
70
70
|
sdkReady: c,
|
|
@@ -80,7 +80,7 @@ const W = ({ sdk: e, className: i, scrollStore: l, appNode: t, scrollNode: s, re
|
|
|
80
80
|
),
|
|
81
81
|
/* @__PURE__ */ v(A, { className: "sl-hide-on-modal", ref: r, "data-nav": a.toString(), children: [
|
|
82
82
|
c && /* @__PURE__ */ n(
|
|
83
|
-
|
|
83
|
+
K,
|
|
84
84
|
{
|
|
85
85
|
sdk: e,
|
|
86
86
|
scrollNode: r,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const SDKContainer: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
2
|
+
export declare const SDKScrollContainer: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
3
|
+
export declare const SDKContentContainer: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
4
|
+
export declare const SDKWhiteContainer: {
|
|
5
|
+
__wyw_meta: unknown;
|
|
6
|
+
} & import('react').FunctionComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown> & {
|
|
7
|
+
as?: React.ElementType;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const TabsContainer: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
10
|
+
export declare const LeaderboardContainer: {
|
|
11
|
+
__wyw_meta: unknown;
|
|
12
|
+
} & import('react').FunctionComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown> & {
|
|
13
|
+
as?: React.ElementType;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const TabsNavContainer: {
|
|
16
|
+
__wyw_meta: unknown;
|
|
17
|
+
} & import('react').FunctionComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown> & {
|
|
18
|
+
as?: React.ElementType;
|
|
19
|
+
}>;
|
|
20
|
+
export declare const UserSummaryContainer: import('@linaria/react').StyledComponent<import('react').ClassAttributes<HTMLDivElement> & import('react').HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
|
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
import { styled as s } from "@linaria/react";
|
|
2
2
|
const i = /* @__PURE__ */ s("div")({
|
|
3
3
|
name: "SDKContainer",
|
|
4
|
-
class: "
|
|
4
|
+
class: "s8zgqze",
|
|
5
5
|
propsAsIs: !1
|
|
6
|
-
}),
|
|
6
|
+
}), p = /* @__PURE__ */ s("div")({
|
|
7
7
|
name: "SDKScrollContainer",
|
|
8
|
-
class: "
|
|
8
|
+
class: "s6t897k",
|
|
9
9
|
propsAsIs: !1
|
|
10
10
|
}), a = /* @__PURE__ */ s("div")({
|
|
11
11
|
name: "SDKContentContainer",
|
|
12
|
-
class: "
|
|
12
|
+
class: "sw7pkvp",
|
|
13
13
|
propsAsIs: !1
|
|
14
14
|
}), e = () => a, n = /* @__PURE__ */ s(e())({
|
|
15
15
|
name: "SDKWhiteContainer",
|
|
16
|
-
class: "
|
|
16
|
+
class: "s14gkn7u",
|
|
17
17
|
propsAsIs: !0
|
|
18
|
-
}),
|
|
18
|
+
}), c = /* @__PURE__ */ s("div")({
|
|
19
19
|
name: "TabsContainer",
|
|
20
|
-
class: "
|
|
20
|
+
class: "t1yxstm9",
|
|
21
21
|
propsAsIs: !1
|
|
22
|
-
}), o = () => n,
|
|
22
|
+
}), o = () => n, l = /* @__PURE__ */ s(o())({
|
|
23
23
|
name: "LeaderboardContainer",
|
|
24
|
-
class: "
|
|
24
|
+
class: "ldpty1s",
|
|
25
25
|
propsAsIs: !0
|
|
26
|
-
}),
|
|
26
|
+
}), t = () => n, C = /* @__PURE__ */ s(t())({
|
|
27
27
|
name: "TabsNavContainer",
|
|
28
|
-
class: "
|
|
28
|
+
class: "t136a59y",
|
|
29
29
|
propsAsIs: !0
|
|
30
30
|
}), m = /* @__PURE__ */ s("div")({
|
|
31
31
|
name: "UserSummaryContainer",
|
|
32
|
-
class: "
|
|
32
|
+
class: "u11vnm9m",
|
|
33
33
|
propsAsIs: !1
|
|
34
34
|
});
|
|
35
35
|
export {
|
|
36
|
-
|
|
36
|
+
l as LeaderboardContainer,
|
|
37
37
|
i as SDKContainer,
|
|
38
38
|
a as SDKContentContainer,
|
|
39
|
-
|
|
39
|
+
p as SDKScrollContainer,
|
|
40
40
|
n as SDKWhiteContainer,
|
|
41
|
-
|
|
41
|
+
c as TabsContainer,
|
|
42
42
|
C as TabsNavContainer,
|
|
43
43
|
m as UserSummaryContainer
|
|
44
44
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AppNodeRef } from '..';
|
|
2
|
+
import { MapStore } from 'nanostores';
|
|
3
|
+
import { BREAKPOINTS } from '../../ui/theme/constants';
|
|
4
|
+
type BREAKPOINTS_KEYS = keyof typeof BREAKPOINTS;
|
|
5
|
+
type ResponsiveData = {
|
|
6
|
+
screen: {
|
|
7
|
+
name: BREAKPOINTS_KEYS;
|
|
8
|
+
size: (typeof BREAKPOINTS)[BREAKPOINTS_KEYS];
|
|
9
|
+
};
|
|
10
|
+
sdkInView: boolean;
|
|
11
|
+
sdkInDesktopView: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type ResponsiveStore = MapStore<ResponsiveData>;
|
|
14
|
+
export declare const useSdkResponsive: (appNode: AppNodeRef) => [ResponsiveStore];
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import c from "lodash.throttle";
|
|
2
|
+
import { useState as m, useEffect as u } from "react";
|
|
3
|
+
import { BREAKPOINTS as r } from "../../ui/theme/constants.js";
|
|
4
|
+
import { m as l } from "../../index-CZvwzN5o.js";
|
|
5
|
+
const d = Object.keys(r), i = () => {
|
|
6
|
+
const n = window.innerWidth;
|
|
7
|
+
let e = "sm";
|
|
8
|
+
for (let t = d.length - 1; t > 0; t--) {
|
|
9
|
+
const s = d[t];
|
|
10
|
+
if (!(n < r[s]) && n >= r[s]) {
|
|
11
|
+
e = s;
|
|
12
|
+
break;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
name: e,
|
|
17
|
+
size: r[e]
|
|
18
|
+
};
|
|
19
|
+
}, w = (n) => {
|
|
20
|
+
var e;
|
|
21
|
+
return (((e = n.current) == null ? void 0 : e.getBoundingClientRect().y) || 0) < -68;
|
|
22
|
+
}, k = (n) => n >= r.xl, v = (n) => {
|
|
23
|
+
const [e] = m(() => {
|
|
24
|
+
const t = i();
|
|
25
|
+
return l({
|
|
26
|
+
screen: i(),
|
|
27
|
+
sdkInView: w(n),
|
|
28
|
+
sdkInDesktopView: k(t.size)
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
return u(() => {
|
|
32
|
+
const t = c(() => {
|
|
33
|
+
e.setKey("sdkInView", w(n));
|
|
34
|
+
}, 200), s = c(() => {
|
|
35
|
+
const o = i();
|
|
36
|
+
e.setKey("screen", o), e.setKey("sdkInDesktopView", k(o.size));
|
|
37
|
+
}, 200);
|
|
38
|
+
return window.addEventListener("scroll", t), window.addEventListener("resize", s), () => {
|
|
39
|
+
window.removeEventListener("scroll", t), window.removeEventListener("resize", s);
|
|
40
|
+
};
|
|
41
|
+
}, [e, n]), [e];
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
v as useSdkResponsive
|
|
45
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ScrollNodeRef, AppNodeRef } from '..';
|
|
2
|
+
import { MapStore } from 'nanostores';
|
|
3
|
+
import { ResponsiveStore } from './useSdkResponsive';
|
|
4
|
+
type ScrollData = {
|
|
5
|
+
scrollPosition: number;
|
|
6
|
+
tabsShown?: boolean;
|
|
7
|
+
scrollDirection: 'forward' | 'backward';
|
|
8
|
+
};
|
|
9
|
+
export type ScrollStore = MapStore<ScrollData>;
|
|
10
|
+
export declare const scrollIntoAppView: (appNode: AppNodeRef, screenSize: number, options?: ScrollIntoViewOptions) => void;
|
|
11
|
+
export declare const useSdkScroll: (appNode: AppNodeRef, responsiveStore: ResponsiveStore) => [ScrollNodeRef, ScrollStore];
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useStore as S } from "@nanostores/react";
|
|
2
|
+
import h from "lodash.throttle";
|
|
3
|
+
import { useRef as m, useState as b, useEffect as g } from "react";
|
|
4
|
+
import { BREAKPOINTS as c } from "../../ui/theme/constants.js";
|
|
5
|
+
import { m as v } from "../../index-CZvwzN5o.js";
|
|
6
|
+
const C = (o, e, n) => {
|
|
7
|
+
const t = e >= c.lg && e < c.xl ? 75 : 52;
|
|
8
|
+
o.current && window.scrollTo({
|
|
9
|
+
top: o.current.offsetTop - t,
|
|
10
|
+
...n
|
|
11
|
+
});
|
|
12
|
+
}, T = 15, D = (o, e) => {
|
|
13
|
+
const n = m(null), t = m(0), [s] = b(
|
|
14
|
+
v({
|
|
15
|
+
scrollPosition: 0,
|
|
16
|
+
tabsShown: !0,
|
|
17
|
+
scrollDirection: "forward"
|
|
18
|
+
})
|
|
19
|
+
), i = S(e);
|
|
20
|
+
return g(() => {
|
|
21
|
+
const l = window.innerWidth < c.xl ? window : n.current;
|
|
22
|
+
if (!l)
|
|
23
|
+
return () => {
|
|
24
|
+
};
|
|
25
|
+
const f = h((d) => {
|
|
26
|
+
var a;
|
|
27
|
+
const u = d.target;
|
|
28
|
+
if (!u)
|
|
29
|
+
return;
|
|
30
|
+
let r = 0;
|
|
31
|
+
i.screen.size < c.xl ? r = ((a = o.current) == null ? void 0 : a.getBoundingClientRect().y) || 0 : r = u.scrollTop;
|
|
32
|
+
const w = t.current - r;
|
|
33
|
+
if (T > Math.abs(w))
|
|
34
|
+
return;
|
|
35
|
+
const p = t.current < r ? "forward" : "backward";
|
|
36
|
+
t.current = r, s.set({
|
|
37
|
+
scrollPosition: Math.round(r),
|
|
38
|
+
scrollDirection: p,
|
|
39
|
+
tabsShown: s.get().tabsShown
|
|
40
|
+
});
|
|
41
|
+
}, 200);
|
|
42
|
+
return l.addEventListener("scroll", f), () => {
|
|
43
|
+
l.removeEventListener("scroll", f);
|
|
44
|
+
};
|
|
45
|
+
}, [s, o, i.screen]), [n, s];
|
|
46
|
+
};
|
|
47
|
+
export {
|
|
48
|
+
C as scrollIntoAppView,
|
|
49
|
+
D as useSdkScroll
|
|
50
|
+
};
|
|
@@ -10,6 +10,7 @@ type ResponsiveData = {
|
|
|
10
10
|
sdkInView: boolean;
|
|
11
11
|
sdkInDesktopView: boolean;
|
|
12
12
|
};
|
|
13
|
+
export declare const checkSdkInDesktopView: () => boolean;
|
|
13
14
|
export type ResponsiveStore = MapStore<ResponsiveData>;
|
|
14
15
|
export declare const useSdkResponsive: (appNode: AppNodeRef) => [ResponsiveStore];
|
|
15
16
|
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useState as m, useEffect as
|
|
1
|
+
import i from "lodash.throttle";
|
|
2
|
+
import { useState as m, useEffect as a } from "react";
|
|
3
3
|
import { BREAKPOINTS as r } from "../ui/theme/constants.js";
|
|
4
|
-
import { m as
|
|
5
|
-
const
|
|
6
|
-
const
|
|
4
|
+
import { m as u } from "../index-CZvwzN5o.js";
|
|
5
|
+
const o = Object.keys(r), c = () => {
|
|
6
|
+
const t = window.innerWidth;
|
|
7
7
|
let e = "sm";
|
|
8
|
-
for (let
|
|
9
|
-
const s =
|
|
10
|
-
if (!(
|
|
8
|
+
for (let n = o.length - 1; n > 0; n--) {
|
|
9
|
+
const s = o[n];
|
|
10
|
+
if (!(t < r[s]) && t >= r[s]) {
|
|
11
11
|
e = s;
|
|
12
12
|
break;
|
|
13
13
|
}
|
|
@@ -16,30 +16,28 @@ const d = Object.keys(r), i = () => {
|
|
|
16
16
|
name: e,
|
|
17
17
|
size: r[e]
|
|
18
18
|
};
|
|
19
|
-
},
|
|
19
|
+
}, d = (t) => {
|
|
20
20
|
var e;
|
|
21
|
-
return (((e =
|
|
22
|
-
},
|
|
23
|
-
const [e] = m(() => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
e.setKey("
|
|
34
|
-
}, 200), s = c(() => {
|
|
35
|
-
const o = i();
|
|
36
|
-
e.setKey("screen", o), e.setKey("sdkInDesktopView", k(o.size));
|
|
21
|
+
return (((e = t.current) == null ? void 0 : e.getBoundingClientRect().y) || 0) < -68;
|
|
22
|
+
}, w = () => window.matchMedia("(orientation: landscape)").matches, h = (t) => {
|
|
23
|
+
const [e] = m(() => u({
|
|
24
|
+
screen: c(),
|
|
25
|
+
sdkInView: d(t),
|
|
26
|
+
sdkInDesktopView: w()
|
|
27
|
+
}));
|
|
28
|
+
return a(() => {
|
|
29
|
+
const n = i(() => {
|
|
30
|
+
e.setKey("sdkInView", d(t));
|
|
31
|
+
}, 200), s = i(() => {
|
|
32
|
+
const k = c();
|
|
33
|
+
e.setKey("screen", k), e.setKey("sdkInDesktopView", w());
|
|
37
34
|
}, 200);
|
|
38
|
-
return window.addEventListener("scroll",
|
|
39
|
-
window.removeEventListener("scroll",
|
|
35
|
+
return window.addEventListener("scroll", n), window.addEventListener("resize", s), () => {
|
|
36
|
+
window.removeEventListener("scroll", n), window.removeEventListener("resize", s);
|
|
40
37
|
};
|
|
41
|
-
}, [e,
|
|
38
|
+
}, [e, t]), [e];
|
|
42
39
|
};
|
|
43
40
|
export {
|
|
44
|
-
|
|
41
|
+
w as checkSdkInDesktopView,
|
|
42
|
+
h as useSdkResponsive
|
|
45
43
|
};
|
package/lib/app/useSdkScroll.js
CHANGED
|
@@ -1,50 +1,51 @@
|
|
|
1
|
-
import { useStore as
|
|
2
|
-
import
|
|
3
|
-
import { useRef as
|
|
4
|
-
import { BREAKPOINTS as
|
|
1
|
+
import { useStore as h } from "@nanostores/react";
|
|
2
|
+
import b from "lodash.throttle";
|
|
3
|
+
import { useRef as u, useState as g, useEffect as k } from "react";
|
|
4
|
+
import { BREAKPOINTS as a } from "../ui/theme/constants.js";
|
|
5
|
+
import { checkSdkInDesktopView as m } from "./useSdkResponsive.js";
|
|
5
6
|
import { m as v } from "../index-CZvwzN5o.js";
|
|
6
|
-
const
|
|
7
|
-
const t = e >=
|
|
7
|
+
const I = (o, e, n) => {
|
|
8
|
+
const t = e >= a.lg && e < a.xl ? 75 : 52;
|
|
8
9
|
o.current && window.scrollTo({
|
|
9
10
|
top: o.current.offsetTop - t,
|
|
10
11
|
...n
|
|
11
12
|
});
|
|
12
|
-
}, T = 15,
|
|
13
|
-
const n =
|
|
13
|
+
}, T = 15, L = (o, e) => {
|
|
14
|
+
const n = u(null), t = u(0), [s] = g(
|
|
14
15
|
v({
|
|
15
16
|
scrollPosition: 0,
|
|
16
17
|
tabsShown: !0,
|
|
17
18
|
scrollDirection: "forward"
|
|
18
19
|
})
|
|
19
|
-
),
|
|
20
|
-
return
|
|
21
|
-
const
|
|
22
|
-
if (!
|
|
20
|
+
), d = h(e);
|
|
21
|
+
return k(() => {
|
|
22
|
+
const c = m() ? n.current : window;
|
|
23
|
+
if (!c)
|
|
23
24
|
return () => {
|
|
24
25
|
};
|
|
25
|
-
const
|
|
26
|
-
var
|
|
27
|
-
const
|
|
28
|
-
if (!
|
|
26
|
+
const l = b((p) => {
|
|
27
|
+
var f;
|
|
28
|
+
const i = p.target;
|
|
29
|
+
if (!i)
|
|
29
30
|
return;
|
|
30
31
|
let r = 0;
|
|
31
|
-
|
|
32
|
+
m() ? r = i.scrollTop : r = ((f = o.current) == null ? void 0 : f.getBoundingClientRect().y) || 0;
|
|
32
33
|
const w = t.current - r;
|
|
33
34
|
if (T > Math.abs(w))
|
|
34
35
|
return;
|
|
35
|
-
const
|
|
36
|
+
const S = t.current < r ? "forward" : "backward";
|
|
36
37
|
t.current = r, s.set({
|
|
37
38
|
scrollPosition: Math.round(r),
|
|
38
|
-
scrollDirection:
|
|
39
|
+
scrollDirection: S,
|
|
39
40
|
tabsShown: s.get().tabsShown
|
|
40
41
|
});
|
|
41
42
|
}, 200);
|
|
42
|
-
return
|
|
43
|
-
|
|
43
|
+
return c.addEventListener("scroll", l), () => {
|
|
44
|
+
c.removeEventListener("scroll", l);
|
|
44
45
|
};
|
|
45
|
-
}, [s, o,
|
|
46
|
+
}, [s, o, d.screen]), [n, s];
|
|
46
47
|
};
|
|
47
48
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
I as scrollIntoAppView,
|
|
50
|
+
L as useSdkScroll
|
|
50
51
|
};
|