@magmamath/students-features 0.11.0-rc.21 → 0.11.0-rc.22
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/commonjs/features/chatbot/components/Chat/FadeMask.js +16 -104
- package/dist/commonjs/features/chatbot/components/Chat/FadeMask.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/Chat/FadeMask.native.js +89 -0
- package/dist/commonjs/features/chatbot/components/Chat/FadeMask.native.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/Chat/FadeMask.web.js +43 -0
- package/dist/commonjs/features/chatbot/components/Chat/FadeMask.web.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/Chat/useChatScroll.js +5 -5
- package/dist/commonjs/features/chatbot/components/Chat/useChatScroll.js.map +1 -1
- package/dist/module/features/chatbot/components/Chat/FadeMask.js +1 -104
- package/dist/module/features/chatbot/components/Chat/FadeMask.js.map +1 -1
- package/dist/module/features/chatbot/components/Chat/FadeMask.native.js +81 -0
- package/dist/module/features/chatbot/components/Chat/FadeMask.native.js.map +1 -0
- package/dist/module/features/chatbot/components/Chat/FadeMask.web.js +37 -0
- package/dist/module/features/chatbot/components/Chat/FadeMask.web.js.map +1 -0
- package/dist/module/features/chatbot/components/Chat/useChatScroll.js +6 -6
- package/dist/module/features/chatbot/components/Chat/useChatScroll.js.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/Chat/FadeMask.d.ts +2 -14
- package/dist/typescript/commonjs/features/chatbot/components/Chat/FadeMask.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/Chat/FadeMask.native.d.ts +18 -0
- package/dist/typescript/commonjs/features/chatbot/components/Chat/FadeMask.native.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/Chat/FadeMask.web.d.ts +19 -0
- package/dist/typescript/commonjs/features/chatbot/components/Chat/FadeMask.web.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/Chat/useChatScroll.d.ts +1 -1
- package/dist/typescript/module/features/chatbot/components/Chat/FadeMask.d.ts +2 -14
- package/dist/typescript/module/features/chatbot/components/Chat/FadeMask.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/Chat/FadeMask.native.d.ts +18 -0
- package/dist/typescript/module/features/chatbot/components/Chat/FadeMask.native.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/Chat/FadeMask.web.d.ts +19 -0
- package/dist/typescript/module/features/chatbot/components/Chat/FadeMask.web.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/Chat/useChatScroll.d.ts +1 -1
- package/package.json +1 -1
- package/src/features/chatbot/components/Chat/{FadeMask.tsx → FadeMask.native.tsx} +11 -36
- package/src/features/chatbot/components/Chat/FadeMask.ts +2 -0
- package/src/features/chatbot/components/Chat/FadeMask.web.tsx +37 -0
- package/src/features/chatbot/components/Chat/useChatScroll.ts +5 -5
|
@@ -3,111 +3,23 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
-
const WEB_MASKS = {
|
|
14
|
-
top: {
|
|
15
|
-
maskImage: 'linear-gradient(to top, transparent, black 10%, black)'
|
|
16
|
-
},
|
|
17
|
-
bottom: {
|
|
18
|
-
maskImage: 'linear-gradient(to bottom, transparent, black 10%, black)'
|
|
19
|
-
},
|
|
20
|
-
both: {
|
|
21
|
-
maskImage: 'linear-gradient(to top, transparent, black 10%, black 90%, transparent)'
|
|
6
|
+
Object.defineProperty(exports, "FadeOverlays", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _FadeMaskWeb.FadeOverlays;
|
|
22
10
|
}
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const showBottom = fade === 'bottom' || fade === 'both';
|
|
35
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
36
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(LinearGradient, {
|
|
37
|
-
colors: ['white', 'rgba(255,255,255,0)'],
|
|
38
|
-
start: {
|
|
39
|
-
x: 0,
|
|
40
|
-
y: 0
|
|
41
|
-
},
|
|
42
|
-
end: {
|
|
43
|
-
x: 0,
|
|
44
|
-
y: 1
|
|
45
|
-
},
|
|
46
|
-
style: [styles.gradient, styles.gradientTop, {
|
|
47
|
-
opacity: showTop ? 1 : 0
|
|
48
|
-
}],
|
|
49
|
-
pointerEvents: "none"
|
|
50
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(LinearGradient, {
|
|
51
|
-
colors: ['rgba(255,255,255,0)', 'white'],
|
|
52
|
-
start: {
|
|
53
|
-
x: 0,
|
|
54
|
-
y: 0
|
|
55
|
-
},
|
|
56
|
-
end: {
|
|
57
|
-
x: 0,
|
|
58
|
-
y: 1
|
|
59
|
-
},
|
|
60
|
-
style: [styles.gradient, styles.gradientBottom, {
|
|
61
|
-
opacity: showBottom ? 1 : 0
|
|
62
|
-
}],
|
|
63
|
-
pointerEvents: "none"
|
|
64
|
-
})]
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
|
-
const NoopOverlays = _ => null;
|
|
68
|
-
const FadeOverlays = exports.FadeOverlays = _reactNativeUi.IS_WEB ? NoopOverlays : NativeFadeOverlays;
|
|
69
|
-
const useWebFadeUpdate = () => {
|
|
70
|
-
const fadeRef = (0, _react.useRef)(null);
|
|
71
|
-
const lastFade = (0, _react.useRef)(undefined);
|
|
72
|
-
const [webMask, setWebMask] = (0, _react.useState)(undefined);
|
|
73
|
-
const updateFade = (0, _react.useCallback)(fade => {
|
|
74
|
-
if (fade === lastFade.current) return;
|
|
75
|
-
lastFade.current = fade;
|
|
76
|
-
setWebMask(fade ? WEB_MASKS[fade] : undefined);
|
|
77
|
-
}, []);
|
|
78
|
-
return {
|
|
79
|
-
fadeRef,
|
|
80
|
-
updateFade,
|
|
81
|
-
webMask
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
const useNativeFadeUpdate = () => {
|
|
85
|
-
const fadeRef = (0, _react.useRef)(null);
|
|
86
|
-
const lastFade = (0, _react.useRef)(undefined);
|
|
87
|
-
const updateFade = (0, _react.useCallback)(fade => {
|
|
88
|
-
if (fade === lastFade.current) return;
|
|
89
|
-
lastFade.current = fade;
|
|
90
|
-
fadeRef.current?.(fade);
|
|
91
|
-
}, []);
|
|
92
|
-
return {
|
|
93
|
-
fadeRef,
|
|
94
|
-
updateFade,
|
|
95
|
-
webMask: undefined
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
const useFadeUpdate = exports.useFadeUpdate = _reactNativeUi.IS_WEB ? useWebFadeUpdate : useNativeFadeUpdate;
|
|
99
|
-
const styles = _reactNative.StyleSheet.create({
|
|
100
|
-
gradient: {
|
|
101
|
-
position: 'absolute',
|
|
102
|
-
left: 0,
|
|
103
|
-
right: 0,
|
|
104
|
-
height: FADE_HEIGHT
|
|
105
|
-
},
|
|
106
|
-
gradientTop: {
|
|
107
|
-
top: 0
|
|
108
|
-
},
|
|
109
|
-
gradientBottom: {
|
|
110
|
-
bottom: 0
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "FadePosition", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _FadeMaskWeb.FadePosition;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "useFadeUpdate", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _FadeMaskWeb.useFadeUpdate;
|
|
111
22
|
}
|
|
112
23
|
});
|
|
24
|
+
var _FadeMaskWeb = require("./FadeMask.web.js");
|
|
113
25
|
//# sourceMappingURL=FadeMask.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_FadeMaskWeb","require"],"sourceRoot":"../../../../../../src","sources":["features/chatbot/components/Chat/FadeMask.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useFadeUpdate = exports.FadePosition = exports.FadeOverlays = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _reactNativeLinearGradient = require("react-native-linear-gradient");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
+
let FadePosition = exports.FadePosition = /*#__PURE__*/function (FadePosition) {
|
|
14
|
+
FadePosition["TOP"] = "top";
|
|
15
|
+
FadePosition["BOTTOM"] = "bottom";
|
|
16
|
+
FadePosition["BOTH"] = "both";
|
|
17
|
+
return FadePosition;
|
|
18
|
+
}({});
|
|
19
|
+
const FADE_HEIGHT = 35;
|
|
20
|
+
const FadeOverlays = ({
|
|
21
|
+
fadeRef
|
|
22
|
+
}) => {
|
|
23
|
+
const [fade, setFade] = (0, _react.useState)(undefined);
|
|
24
|
+
fadeRef.current = setFade;
|
|
25
|
+
const showTop = fade === FadePosition.TOP || fade === FadePosition.BOTH;
|
|
26
|
+
const showBottom = fade === FadePosition.BOTTOM || fade === FadePosition.BOTH;
|
|
27
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
28
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeLinearGradient.LinearGradient, {
|
|
29
|
+
colors: ['white', 'rgba(255,255,255,0)'],
|
|
30
|
+
start: {
|
|
31
|
+
x: 0,
|
|
32
|
+
y: 0
|
|
33
|
+
},
|
|
34
|
+
end: {
|
|
35
|
+
x: 0,
|
|
36
|
+
y: 1
|
|
37
|
+
},
|
|
38
|
+
style: [styles.gradient, styles.gradientTop, {
|
|
39
|
+
opacity: showTop ? 1 : 0
|
|
40
|
+
}],
|
|
41
|
+
pointerEvents: "none"
|
|
42
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeLinearGradient.LinearGradient, {
|
|
43
|
+
colors: ['rgba(255,255,255,0)', 'white'],
|
|
44
|
+
start: {
|
|
45
|
+
x: 0,
|
|
46
|
+
y: 0
|
|
47
|
+
},
|
|
48
|
+
end: {
|
|
49
|
+
x: 0,
|
|
50
|
+
y: 1
|
|
51
|
+
},
|
|
52
|
+
style: [styles.gradient, styles.gradientBottom, {
|
|
53
|
+
opacity: showBottom ? 1 : 0
|
|
54
|
+
}],
|
|
55
|
+
pointerEvents: "none"
|
|
56
|
+
})]
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
exports.FadeOverlays = FadeOverlays;
|
|
60
|
+
const useFadeUpdate = () => {
|
|
61
|
+
const fadeRef = (0, _react.useRef)(null);
|
|
62
|
+
const lastFade = (0, _react.useRef)(undefined);
|
|
63
|
+
const updateFade = (0, _react.useCallback)(fade => {
|
|
64
|
+
if (fade === lastFade.current) return;
|
|
65
|
+
lastFade.current = fade;
|
|
66
|
+
fadeRef.current?.(fade);
|
|
67
|
+
}, []);
|
|
68
|
+
return {
|
|
69
|
+
fadeRef,
|
|
70
|
+
updateFade,
|
|
71
|
+
webMask: undefined
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
exports.useFadeUpdate = useFadeUpdate;
|
|
75
|
+
const styles = _reactNative.StyleSheet.create({
|
|
76
|
+
gradient: {
|
|
77
|
+
position: 'absolute',
|
|
78
|
+
left: 0,
|
|
79
|
+
right: 0,
|
|
80
|
+
height: FADE_HEIGHT
|
|
81
|
+
},
|
|
82
|
+
gradientTop: {
|
|
83
|
+
top: 0
|
|
84
|
+
},
|
|
85
|
+
gradientBottom: {
|
|
86
|
+
bottom: 0
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
//# sourceMappingURL=FadeMask.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeLinearGradient","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","FadePosition","exports","FADE_HEIGHT","FadeOverlays","fadeRef","fade","setFade","useState","undefined","current","showTop","TOP","BOTH","showBottom","BOTTOM","jsxs","Fragment","children","jsx","LinearGradient","colors","start","x","y","end","style","styles","gradient","gradientTop","opacity","pointerEvents","gradientBottom","useFadeUpdate","useRef","lastFade","updateFade","useCallback","webMask","StyleSheet","create","position","left","right","height","top","bottom"],"sourceRoot":"../../../../../../src","sources":["features/chatbot/components/Chat/FadeMask.native.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,0BAAA,GAAAF,OAAA;AAA6D,IAAAG,WAAA,GAAAH,OAAA;AAAA,SAAAI,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CA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AAGY,uBAAU,CAACC,MAAM,CAAC;EAC/BZ,QAAQ,EAAE;IACRa,QAAQ,EAAE,UAAU;IACpBC,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAEzC;EACV,CAAC;EACD0B,WAAW,EAAE;IACXgB,GAAG,EAAE;EACP,CAAC;EACDb,cAAc,EAAE;IACdc,MAAM,EAAE;EACV;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useFadeUpdate = exports.FadePosition = exports.FadeOverlays = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
let FadePosition = exports.FadePosition = /*#__PURE__*/function (FadePosition) {
|
|
9
|
+
FadePosition["TOP"] = "top";
|
|
10
|
+
FadePosition["BOTTOM"] = "bottom";
|
|
11
|
+
FadePosition["BOTH"] = "both";
|
|
12
|
+
return FadePosition;
|
|
13
|
+
}({});
|
|
14
|
+
const WEB_MASKS = {
|
|
15
|
+
[FadePosition.TOP]: {
|
|
16
|
+
maskImage: 'linear-gradient(to top, transparent, black 10%, black)'
|
|
17
|
+
},
|
|
18
|
+
[FadePosition.BOTTOM]: {
|
|
19
|
+
maskImage: 'linear-gradient(to bottom, transparent, black 10%, black)'
|
|
20
|
+
},
|
|
21
|
+
[FadePosition.BOTH]: {
|
|
22
|
+
maskImage: 'linear-gradient(to top, transparent, black 10%, black 90%, transparent)'
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const FadeOverlays = _ => null;
|
|
26
|
+
exports.FadeOverlays = FadeOverlays;
|
|
27
|
+
const useFadeUpdate = () => {
|
|
28
|
+
const fadeRef = (0, _react.useRef)(null);
|
|
29
|
+
const lastFade = (0, _react.useRef)(undefined);
|
|
30
|
+
const [webMask, setWebMask] = (0, _react.useState)(undefined);
|
|
31
|
+
const updateFade = (0, _react.useCallback)(fade => {
|
|
32
|
+
if (fade === lastFade.current) return;
|
|
33
|
+
lastFade.current = fade;
|
|
34
|
+
setWebMask(fade ? WEB_MASKS[fade] : undefined);
|
|
35
|
+
}, []);
|
|
36
|
+
return {
|
|
37
|
+
fadeRef,
|
|
38
|
+
updateFade,
|
|
39
|
+
webMask
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
exports.useFadeUpdate = useFadeUpdate;
|
|
43
|
+
//# sourceMappingURL=FadeMask.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","FadePosition","exports","WEB_MASKS","TOP","maskImage","BOTTOM","BOTH","FadeOverlays","_","useFadeUpdate","fadeRef","useRef","lastFade","undefined","webMask","setWebMask","useState","updateFade","useCallback","fade","current"],"sourceRoot":"../../../../../../src","sources":["features/chatbot/components/Chat/FadeMask.web.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAuE,IAG3DC,YAAY,GAAAC,OAAA,CAAAD,YAAA,0BAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAA,OAAZA,YAAY;AAAA;AAWxB,MAAME,SAA0C,GAAG;EACjD,CAACF,YAAY,CAACG,GAAG,GAAG;IAAEC,SAAS,EAAE;EAAyD,CAAQ;EAClG,CAACJ,YAAY,CAACK,MAAM,GAAG;IAAED,SAAS,EAAE;EAA4D,CAAQ;EACxG,CAACJ,YAAY,CAACM,IAAI,GAAG;IACnBF,SAAS,EAAE;EACb;AACF,CAAC;AAEM,MAAMG,YAAY,GAAIC,CAAoB,IAAK,IAAI;AAAAP,OAAA,CAAAM,YAAA,GAAAA,YAAA;AAEnD,MAAME,aAAa,GAAGA,CAAA,KAAM;EACjC,MAAMC,OAAO,GAAG,IAAAC,aAAM,EAAsB,IAAI,CAAC;EACjD,MAAMC,QAAQ,GAAG,IAAAD,aAAM,EAA2BE,SAAS,CAAC;EAC5D,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAG,IAAAC,eAAQ,EAAwBH,SAAS,CAAC;EAExE,MAAMI,UAAU,GAAG,IAAAC,kBAAW,EAAEC,IAA8B,IAAK;IACjE,IAAIA,IAAI,KAAKP,QAAQ,CAACQ,OAAO,EAAE;IAC/BR,QAAQ,CAACQ,OAAO,GAAGD,IAAI;IACvBJ,UAAU,CAACI,IAAI,GAAGjB,SAAS,CAACiB,IAAI,CAAC,GAAGN,SAAS,CAAC;EAChD,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IAAEH,OAAO;IAAEO,UAAU;IAAEH;EAAQ,CAAC;AACzC,CAAC;AAAAb,OAAA,CAAAQ,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -14,11 +14,11 @@ const initialScrollState = {
|
|
|
14
14
|
listHeight: 0,
|
|
15
15
|
contentHeight: 0
|
|
16
16
|
};
|
|
17
|
-
const computeFade =
|
|
18
|
-
if (!
|
|
19
|
-
if (
|
|
20
|
-
if (
|
|
21
|
-
return
|
|
17
|
+
const computeFade = scrollState => {
|
|
18
|
+
if (!scrollState.isScrollable) return undefined;
|
|
19
|
+
if (scrollState.isAtTop) return _FadeMask.FadePosition.BOTTOM;
|
|
20
|
+
if (scrollState.isScrolledUp) return _FadeMask.FadePosition.BOTH;
|
|
21
|
+
return _FadeMask.FadePosition.TOP;
|
|
22
22
|
};
|
|
23
23
|
const useChatScroll = () => {
|
|
24
24
|
const listRef = (0, _react.useRef)(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_constants","_FadeMask","initialScrollState","isScrollable","isScrolledUp","isAtTop","listHeight","contentHeight","computeFade","
|
|
1
|
+
{"version":3,"names":["_react","require","_constants","_FadeMask","initialScrollState","isScrollable","isScrolledUp","isAtTop","listHeight","contentHeight","computeFade","scrollState","undefined","FadePosition","BOTTOM","BOTH","TOP","useChatScroll","listRef","useRef","scroll","setIsScrolledUp","useState","fadeRef","updateFade","webMask","useFadeUpdate","handleScroll","useCallback","e","contentOffset","contentSize","layoutMeasurement","nativeEvent","scrolledUp","y","SCROLL_BOTTOM_THRESHOLD","atTop","height","s","current","wasScrolledUp","handleLayout","layout","handleContentSizeChange","_","scrollToBottom","scrollToOffset","offset","animated","reset","exports"],"sourceRoot":"../../../../../../src","sources":["features/chatbot/components/Chat/useChatScroll.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAUA,MAAMG,kBAA+B,GAAG;EACtCC,YAAY,EAAE,KAAK;EACnBC,YAAY,EAAE,KAAK;EACnBC,OAAO,EAAE,KAAK;EACdC,UAAU,EAAE,CAAC;EACbC,aAAa,EAAE;AACjB,CAAC;AAED,MAAMC,WAAW,GAAIC,WAAwB,IAAK;EAChD,IAAI,CAACA,WAAW,CAACN,YAAY,EAAE,OAAOO,SAAS;EAC/C,IAAID,WAAW,CAACJ,OAAO,EAAE,OAAOM,sBAAY,CAACC,MAAM;EACnD,IAAIH,WAAW,CAACL,YAAY,EAAE,OAAOO,sBAAY,CAACE,IAAI;EACtD,OAAOF,sBAAY,CAACG,GAAG;AACzB,CAAC;AAEM,MAAMC,aAAa,GAAGA,CAAA,KAAM;EACjC,MAAMC,OAAO,GAAG,IAAAC,aAAM,EAAW,IAAI,CAAC;EACtC,MAAMC,MAAM,GAAG,IAAAD,aAAM,EAAc;IAAE,GAAGf;EAAmB,CAAC,CAAC;EAC7D,MAAM,CAACE,YAAY,EAAEe,eAAe,CAAC,GAAG,IAAAC,eAAQ,EAAC,KAAK,CAAC;EACvD,MAAM;IAAEC,OAAO;IAAEC,UAAU;IAAEC;EAAQ,CAAC,GAAG,IAAAC,uBAAa,EAAC,CAAC;EAExD,MAAMC,YAAY,GAAG,IAAAC,kBAAW,EAC7BC,CAA0C,IAAK;IAC9C,MAAM;MAAEC,aAAa;MAAEC,WAAW;MAAEC;IAAkB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AAC;EAC5B,CAAC,EACD,CAACf,UAAU,CACb,CAAC;EAED,MAAMsB,cAAc,GAAG,IAAAlB,kBAAW,EAAC,MAAM;IACvC,IAAIR,MAAM,CAACoB,OAAO,CAAClC,YAAY,EAAE;MAC/BY,OAAO,CAACsB,OAAO,EAAEO,cAAc,CAAC;QAAEC,MAAM,EAAE,CAAC;QAAEC,QAAQ,EAAE;MAAK,CAAC,CAAC;IAChE;EACF,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMC,KAAK,GAAG,IAAAtB,kBAAW,EAAC,MAAM;IAC9BR,MAAM,CAACoB,OAAO,GAAG;MAAE,GAAGpC;IAAmB,CAAC;IAC1CiB,eAAe,CAAC,KAAK,CAAC;IACtBG,UAAU,CAACZ,SAAS,CAAC;EACvB,CAAC,EAAE,CAACY,UAAU,CAAC,CAAC;EAEhB,OAAO;IACLN,OAAO;IACPE,MAAM;IACNd,YAAY;IACZiB,OAAO;IACPE,OAAO;IACPE,YAAY;IACZe,YAAY;IACZE,uBAAuB;IACvBE,cAAc;IACdI;EACF,CAAC;AACH,CAAC;AAAAC,OAAA,CAAAlC,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -1,107 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
import { StyleSheet } from 'react-native';
|
|
5
|
-
import { IS_WEB } from '@magmamath/react-native-ui';
|
|
6
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
-
const WEB_MASKS = {
|
|
8
|
-
top: {
|
|
9
|
-
maskImage: 'linear-gradient(to top, transparent, black 10%, black)'
|
|
10
|
-
},
|
|
11
|
-
bottom: {
|
|
12
|
-
maskImage: 'linear-gradient(to bottom, transparent, black 10%, black)'
|
|
13
|
-
},
|
|
14
|
-
both: {
|
|
15
|
-
maskImage: 'linear-gradient(to top, transparent, black 10%, black 90%, transparent)'
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
const FADE_HEIGHT = 35;
|
|
19
|
-
const NativeFadeOverlays = ({
|
|
20
|
-
fadeRef
|
|
21
|
-
}) => {
|
|
22
|
-
const {
|
|
23
|
-
LinearGradient
|
|
24
|
-
} = require('react-native-linear-gradient');
|
|
25
|
-
const [fade, setFade] = useState(undefined);
|
|
26
|
-
fadeRef.current = setFade;
|
|
27
|
-
const showTop = fade === 'top' || fade === 'both';
|
|
28
|
-
const showBottom = fade === 'bottom' || fade === 'both';
|
|
29
|
-
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
30
|
-
children: [/*#__PURE__*/_jsx(LinearGradient, {
|
|
31
|
-
colors: ['white', 'rgba(255,255,255,0)'],
|
|
32
|
-
start: {
|
|
33
|
-
x: 0,
|
|
34
|
-
y: 0
|
|
35
|
-
},
|
|
36
|
-
end: {
|
|
37
|
-
x: 0,
|
|
38
|
-
y: 1
|
|
39
|
-
},
|
|
40
|
-
style: [styles.gradient, styles.gradientTop, {
|
|
41
|
-
opacity: showTop ? 1 : 0
|
|
42
|
-
}],
|
|
43
|
-
pointerEvents: "none"
|
|
44
|
-
}), /*#__PURE__*/_jsx(LinearGradient, {
|
|
45
|
-
colors: ['rgba(255,255,255,0)', 'white'],
|
|
46
|
-
start: {
|
|
47
|
-
x: 0,
|
|
48
|
-
y: 0
|
|
49
|
-
},
|
|
50
|
-
end: {
|
|
51
|
-
x: 0,
|
|
52
|
-
y: 1
|
|
53
|
-
},
|
|
54
|
-
style: [styles.gradient, styles.gradientBottom, {
|
|
55
|
-
opacity: showBottom ? 1 : 0
|
|
56
|
-
}],
|
|
57
|
-
pointerEvents: "none"
|
|
58
|
-
})]
|
|
59
|
-
});
|
|
60
|
-
};
|
|
61
|
-
const NoopOverlays = _ => null;
|
|
62
|
-
export const FadeOverlays = IS_WEB ? NoopOverlays : NativeFadeOverlays;
|
|
63
|
-
const useWebFadeUpdate = () => {
|
|
64
|
-
const fadeRef = useRef(null);
|
|
65
|
-
const lastFade = useRef(undefined);
|
|
66
|
-
const [webMask, setWebMask] = useState(undefined);
|
|
67
|
-
const updateFade = useCallback(fade => {
|
|
68
|
-
if (fade === lastFade.current) return;
|
|
69
|
-
lastFade.current = fade;
|
|
70
|
-
setWebMask(fade ? WEB_MASKS[fade] : undefined);
|
|
71
|
-
}, []);
|
|
72
|
-
return {
|
|
73
|
-
fadeRef,
|
|
74
|
-
updateFade,
|
|
75
|
-
webMask
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
const useNativeFadeUpdate = () => {
|
|
79
|
-
const fadeRef = useRef(null);
|
|
80
|
-
const lastFade = useRef(undefined);
|
|
81
|
-
const updateFade = useCallback(fade => {
|
|
82
|
-
if (fade === lastFade.current) return;
|
|
83
|
-
lastFade.current = fade;
|
|
84
|
-
fadeRef.current?.(fade);
|
|
85
|
-
}, []);
|
|
86
|
-
return {
|
|
87
|
-
fadeRef,
|
|
88
|
-
updateFade,
|
|
89
|
-
webMask: undefined
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
export const useFadeUpdate = IS_WEB ? useWebFadeUpdate : useNativeFadeUpdate;
|
|
93
|
-
const styles = StyleSheet.create({
|
|
94
|
-
gradient: {
|
|
95
|
-
position: 'absolute',
|
|
96
|
-
left: 0,
|
|
97
|
-
right: 0,
|
|
98
|
-
height: FADE_HEIGHT
|
|
99
|
-
},
|
|
100
|
-
gradientTop: {
|
|
101
|
-
top: 0
|
|
102
|
-
},
|
|
103
|
-
gradientBottom: {
|
|
104
|
-
bottom: 0
|
|
105
|
-
}
|
|
106
|
-
});
|
|
3
|
+
export { FadePosition, FadeOverlays, useFadeUpdate } from "./FadeMask.web.js";
|
|
107
4
|
//# sourceMappingURL=FadeMask.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["FadePosition","FadeOverlays","useFadeUpdate"],"sourceRoot":"../../../../../../src","sources":["features/chatbot/components/Chat/FadeMask.ts"],"mappings":";;AAAA,SAASA,YAAY,EAAEC,YAAY,EAAEC,aAAa,QAAQ,mBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useCallback, useRef, useState } from 'react';
|
|
4
|
+
import { StyleSheet } from 'react-native';
|
|
5
|
+
import { LinearGradient } from 'react-native-linear-gradient';
|
|
6
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
export let FadePosition = /*#__PURE__*/function (FadePosition) {
|
|
8
|
+
FadePosition["TOP"] = "top";
|
|
9
|
+
FadePosition["BOTTOM"] = "bottom";
|
|
10
|
+
FadePosition["BOTH"] = "both";
|
|
11
|
+
return FadePosition;
|
|
12
|
+
}({});
|
|
13
|
+
const FADE_HEIGHT = 35;
|
|
14
|
+
export const FadeOverlays = ({
|
|
15
|
+
fadeRef
|
|
16
|
+
}) => {
|
|
17
|
+
const [fade, setFade] = useState(undefined);
|
|
18
|
+
fadeRef.current = setFade;
|
|
19
|
+
const showTop = fade === FadePosition.TOP || fade === FadePosition.BOTH;
|
|
20
|
+
const showBottom = fade === FadePosition.BOTTOM || fade === FadePosition.BOTH;
|
|
21
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
22
|
+
children: [/*#__PURE__*/_jsx(LinearGradient, {
|
|
23
|
+
colors: ['white', 'rgba(255,255,255,0)'],
|
|
24
|
+
start: {
|
|
25
|
+
x: 0,
|
|
26
|
+
y: 0
|
|
27
|
+
},
|
|
28
|
+
end: {
|
|
29
|
+
x: 0,
|
|
30
|
+
y: 1
|
|
31
|
+
},
|
|
32
|
+
style: [styles.gradient, styles.gradientTop, {
|
|
33
|
+
opacity: showTop ? 1 : 0
|
|
34
|
+
}],
|
|
35
|
+
pointerEvents: "none"
|
|
36
|
+
}), /*#__PURE__*/_jsx(LinearGradient, {
|
|
37
|
+
colors: ['rgba(255,255,255,0)', 'white'],
|
|
38
|
+
start: {
|
|
39
|
+
x: 0,
|
|
40
|
+
y: 0
|
|
41
|
+
},
|
|
42
|
+
end: {
|
|
43
|
+
x: 0,
|
|
44
|
+
y: 1
|
|
45
|
+
},
|
|
46
|
+
style: [styles.gradient, styles.gradientBottom, {
|
|
47
|
+
opacity: showBottom ? 1 : 0
|
|
48
|
+
}],
|
|
49
|
+
pointerEvents: "none"
|
|
50
|
+
})]
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
export const useFadeUpdate = () => {
|
|
54
|
+
const fadeRef = useRef(null);
|
|
55
|
+
const lastFade = useRef(undefined);
|
|
56
|
+
const updateFade = useCallback(fade => {
|
|
57
|
+
if (fade === lastFade.current) return;
|
|
58
|
+
lastFade.current = fade;
|
|
59
|
+
fadeRef.current?.(fade);
|
|
60
|
+
}, []);
|
|
61
|
+
return {
|
|
62
|
+
fadeRef,
|
|
63
|
+
updateFade,
|
|
64
|
+
webMask: undefined
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
const styles = StyleSheet.create({
|
|
68
|
+
gradient: {
|
|
69
|
+
position: 'absolute',
|
|
70
|
+
left: 0,
|
|
71
|
+
right: 0,
|
|
72
|
+
height: FADE_HEIGHT
|
|
73
|
+
},
|
|
74
|
+
gradientTop: {
|
|
75
|
+
top: 0
|
|
76
|
+
},
|
|
77
|
+
gradientBottom: {
|
|
78
|
+
bottom: 0
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingURL=FadeMask.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useCallback","useRef","useState","StyleSheet","LinearGradient","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","FadePosition","FADE_HEIGHT","FadeOverlays","fadeRef","fade","setFade","undefined","current","showTop","TOP","BOTH","showBottom","BOTTOM","children","colors","start","x","y","end","style","styles","gradient","gradientTop","opacity","pointerEvents","gradientBottom","useFadeUpdate","lastFade","updateFade","webMask","create","position","left","right","height","top","bottom"],"sourceRoot":"../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 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useRef, useState } from 'react';
|
|
4
|
+
export let FadePosition = /*#__PURE__*/function (FadePosition) {
|
|
5
|
+
FadePosition["TOP"] = "top";
|
|
6
|
+
FadePosition["BOTTOM"] = "bottom";
|
|
7
|
+
FadePosition["BOTH"] = "both";
|
|
8
|
+
return FadePosition;
|
|
9
|
+
}({});
|
|
10
|
+
const WEB_MASKS = {
|
|
11
|
+
[FadePosition.TOP]: {
|
|
12
|
+
maskImage: 'linear-gradient(to top, transparent, black 10%, black)'
|
|
13
|
+
},
|
|
14
|
+
[FadePosition.BOTTOM]: {
|
|
15
|
+
maskImage: 'linear-gradient(to bottom, transparent, black 10%, black)'
|
|
16
|
+
},
|
|
17
|
+
[FadePosition.BOTH]: {
|
|
18
|
+
maskImage: 'linear-gradient(to top, transparent, black 10%, black 90%, transparent)'
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export const FadeOverlays = _ => null;
|
|
22
|
+
export const useFadeUpdate = () => {
|
|
23
|
+
const fadeRef = useRef(null);
|
|
24
|
+
const lastFade = useRef(undefined);
|
|
25
|
+
const [webMask, setWebMask] = useState(undefined);
|
|
26
|
+
const updateFade = useCallback(fade => {
|
|
27
|
+
if (fade === lastFade.current) return;
|
|
28
|
+
lastFade.current = fade;
|
|
29
|
+
setWebMask(fade ? WEB_MASKS[fade] : undefined);
|
|
30
|
+
}, []);
|
|
31
|
+
return {
|
|
32
|
+
fadeRef,
|
|
33
|
+
updateFade,
|
|
34
|
+
webMask
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=FadeMask.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useRef","useState","FadePosition","WEB_MASKS","TOP","maskImage","BOTTOM","BOTH","FadeOverlays","_","useFadeUpdate","fadeRef","lastFade","undefined","webMask","setWebMask","updateFade","fade","current"],"sourceRoot":"../../../../../../src","sources":["features/chatbot/components/Chat/FadeMask.web.tsx"],"mappings":";;AAAA,SAA2BA,WAAW,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAGvE,WAAYC,YAAY,0BAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAZA,YAAY;EAAA,OAAZA,YAAY;AAAA;AAWxB,MAAMC,SAA0C,GAAG;EACjD,CAACD,YAAY,CAACE,GAAG,GAAG;IAAEC,SAAS,EAAE;EAAyD,CAAQ;EAClG,CAACH,YAAY,CAACI,MAAM,GAAG;IAAED,SAAS,EAAE;EAA4D,CAAQ;EACxG,CAACH,YAAY,CAACK,IAAI,GAAG;IACnBF,SAAS,EAAE;EACb;AACF,CAAC;AAED,OAAO,MAAMG,YAAY,GAAIC,CAAoB,IAAK,IAAI;AAE1D,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAAM;EACjC,MAAMC,OAAO,GAAGX,MAAM,CAAsB,IAAI,CAAC;EACjD,MAAMY,QAAQ,GAAGZ,MAAM,CAA2Ba,SAAS,CAAC;EAC5D,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGd,QAAQ,CAAwBY,SAAS,CAAC;EAExE,MAAMG,UAAU,GAAGjB,WAAW,CAAEkB,IAA8B,IAAK;IACjE,IAAIA,IAAI,KAAKL,QAAQ,CAACM,OAAO,EAAE;IAC/BN,QAAQ,CAACM,OAAO,GAAGD,IAAI;IACvBF,UAAU,CAACE,IAAI,GAAGd,SAAS,CAACc,IAAI,CAAC,GAAGJ,SAAS,CAAC;EAChD,CAAC,EAAE,EAAE,CAAC;EAEN,OAAO;IAAEF,OAAO;IAAEK,UAAU;IAAEF;EAAQ,CAAC;AACzC,CAAC","ignoreList":[]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useCallback, useRef, useState } from 'react';
|
|
4
4
|
import { SCROLL_BOTTOM_THRESHOLD } from "./constants.js";
|
|
5
|
-
import { useFadeUpdate } from "./FadeMask.js";
|
|
5
|
+
import { FadePosition, useFadeUpdate } from "./FadeMask.js";
|
|
6
6
|
const initialScrollState = {
|
|
7
7
|
isScrollable: false,
|
|
8
8
|
isScrolledUp: false,
|
|
@@ -10,11 +10,11 @@ const initialScrollState = {
|
|
|
10
10
|
listHeight: 0,
|
|
11
11
|
contentHeight: 0
|
|
12
12
|
};
|
|
13
|
-
const computeFade =
|
|
14
|
-
if (!
|
|
15
|
-
if (
|
|
16
|
-
if (
|
|
17
|
-
return
|
|
13
|
+
const computeFade = scrollState => {
|
|
14
|
+
if (!scrollState.isScrollable) return undefined;
|
|
15
|
+
if (scrollState.isAtTop) return FadePosition.BOTTOM;
|
|
16
|
+
if (scrollState.isScrolledUp) return FadePosition.BOTH;
|
|
17
|
+
return FadePosition.TOP;
|
|
18
18
|
};
|
|
19
19
|
export const useChatScroll = () => {
|
|
20
20
|
const listRef = useRef(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useCallback","useRef","useState","SCROLL_BOTTOM_THRESHOLD","useFadeUpdate","initialScrollState","isScrollable","isScrolledUp","isAtTop","listHeight","contentHeight","computeFade","
|
|
1
|
+
{"version":3,"names":["useCallback","useRef","useState","SCROLL_BOTTOM_THRESHOLD","FadePosition","useFadeUpdate","initialScrollState","isScrollable","isScrolledUp","isAtTop","listHeight","contentHeight","computeFade","scrollState","undefined","BOTTOM","BOTH","TOP","useChatScroll","listRef","scroll","setIsScrolledUp","fadeRef","updateFade","webMask","handleScroll","e","contentOffset","contentSize","layoutMeasurement","nativeEvent","scrolledUp","y","atTop","height","s","current","wasScrolledUp","handleLayout","layout","handleContentSizeChange","_","scrollToBottom","scrollToOffset","offset","animated","reset"],"sourceRoot":"../../../../../../src","sources":["features/chatbot/components/Chat/useChatScroll.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAErD,SAASC,uBAAuB,QAAQ,gBAAa;AACrD,SAASC,YAAY,EAAEC,aAAa,QA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AAG;MAAE,GAAG9B;IAAmB,CAAC;IAC1Ce,eAAe,CAAC,KAAK,CAAC;IACtBE,UAAU,CAACT,SAAS,CAAC;EACvB,CAAC,EAAE,CAACS,UAAU,CAAC,CAAC;EAEhB,OAAO;IACLJ,OAAO;IACPC,MAAM;IACNZ,YAAY;IACZc,OAAO;IACPE,OAAO;IACPC,YAAY;IACZa,YAAY;IACZE,uBAAuB;IACvBE,cAAc;IACdI;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export type FadePosition = 'top' | 'bottom' | 'both';
|
|
4
|
-
export type FadeUpdateFn = (fade: FadePosition | undefined) => void;
|
|
5
|
-
type FadeOverlaysProps = {
|
|
6
|
-
fadeRef: MutableRefObject<FadeUpdateFn | null>;
|
|
7
|
-
};
|
|
8
|
-
export declare const FadeOverlays: (({ fadeRef }: FadeOverlaysProps) => React.JSX.Element) | ((_: FadeOverlaysProps) => null);
|
|
9
|
-
export declare const useFadeUpdate: () => {
|
|
10
|
-
fadeRef: React.MutableRefObject<FadeUpdateFn | null>;
|
|
11
|
-
updateFade: (fade: FadePosition | undefined) => void;
|
|
12
|
-
webMask: ViewStyle | undefined;
|
|
13
|
-
};
|
|
14
|
-
export {};
|
|
1
|
+
export { FadePosition, FadeOverlays, useFadeUpdate } from './FadeMask.web';
|
|
2
|
+
export type { FadeUpdateFn } from './FadeMask.web';
|
|
15
3
|
//# sourceMappingURL=FadeMask.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FadeMask.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/chatbot/components/Chat/FadeMask.
|
|
1
|
+
{"version":3,"file":"FadeMask.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/chatbot/components/Chat/FadeMask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC1E,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React, { MutableRefObject } from 'react';
|
|
2
|
+
export declare enum FadePosition {
|
|
3
|
+
TOP = "top",
|
|
4
|
+
BOTTOM = "bottom",
|
|
5
|
+
BOTH = "both"
|
|
6
|
+
}
|
|
7
|
+
export type FadeUpdateFn = (fade: FadePosition | undefined) => void;
|
|
8
|
+
type FadeOverlaysProps = {
|
|
9
|
+
fadeRef: MutableRefObject<FadeUpdateFn | null>;
|
|
10
|
+
};
|
|
11
|
+
export declare const FadeOverlays: ({ fadeRef }: FadeOverlaysProps) => React.JSX.Element;
|
|
12
|
+
export declare const useFadeUpdate: () => {
|
|
13
|
+
fadeRef: React.MutableRefObject<FadeUpdateFn | null>;
|
|
14
|
+
updateFade: (fade: FadePosition | undefined) => void;
|
|
15
|
+
webMask: undefined;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=FadeMask.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FadeMask.native.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/chatbot/components/Chat/FadeMask.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,gBAAgB,EAAiC,MAAM,OAAO,CAAA;AAI9E,oBAAY,YAAY;IACtB,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AACD,MAAM,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,YAAY,GAAG,SAAS,KAAK,IAAI,CAAA;AAInE,KAAK,iBAAiB,GAAG;IACvB,OAAO,EAAE,gBAAgB,CAAC,YAAY,GAAG,IAAI,CAAC,CAAA;CAC/C,CAAA;AAED,eAAO,MAAM,YAAY,gBAAiB,iBAAiB,sBAyB1D,CAAA;AAED,eAAO,MAAM,aAAa;;uBAIc,YAAY,GAAG,SAAS;;CAO/D,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MutableRefObject } from 'react';
|
|
2
|
+
import { ViewStyle } from 'react-native';
|
|
3
|
+
export declare enum FadePosition {
|
|
4
|
+
TOP = "top",
|
|
5
|
+
BOTTOM = "bottom",
|
|
6
|
+
BOTH = "both"
|
|
7
|
+
}
|
|
8
|
+
export type FadeUpdateFn = (fade: FadePosition | undefined) => void;
|
|
9
|
+
type FadeOverlaysProps = {
|
|
10
|
+
fadeRef: MutableRefObject<FadeUpdateFn | null>;
|
|
11
|
+
};
|
|
12
|
+
export declare const FadeOverlays: (_: FadeOverlaysProps) => null;
|
|
13
|
+
export declare const useFadeUpdate: () => {
|
|
14
|
+
fadeRef: MutableRefObject<FadeUpdateFn | null>;
|
|
15
|
+
updateFade: (fade: FadePosition | undefined) => void;
|
|
16
|
+
webMask: ViewStyle | undefined;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=FadeMask.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FadeMask.web.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/chatbot/components/Chat/FadeMask.web.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAiC,MAAM,OAAO,CAAA;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,oBAAY,YAAY;IACtB,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AACD,MAAM,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,YAAY,GAAG,SAAS,KAAK,IAAI,CAAA;AAEnE,KAAK,iBAAiB,GAAG;IACvB,OAAO,EAAE,gBAAgB,CAAC,YAAY,GAAG,IAAI,CAAC,CAAA;CAC/C,CAAA;AAUD,eAAO,MAAM,YAAY,MAAO,iBAAiB,SAAS,CAAA;AAE1D,eAAO,MAAM,aAAa;;uBAKc,YAAY,GAAG,SAAS;;CAO/D,CAAA"}
|
|
@@ -10,7 +10,7 @@ export declare const useChatScroll: () => {
|
|
|
10
10
|
listRef: import("react").RefObject<FlatList<any>>;
|
|
11
11
|
scroll: import("react").MutableRefObject<ScrollState>;
|
|
12
12
|
isScrolledUp: boolean;
|
|
13
|
-
fadeRef: import("react").MutableRefObject<import("./FadeMask").FadeUpdateFn | null>;
|
|
13
|
+
fadeRef: import("react").MutableRefObject<import("./FadeMask.web").FadeUpdateFn | null>;
|
|
14
14
|
webMask: import("react-native").ViewStyle | undefined;
|
|
15
15
|
handleScroll: (e: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
16
16
|
handleLayout: (e: {
|
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export type FadePosition = 'top' | 'bottom' | 'both';
|
|
4
|
-
export type FadeUpdateFn = (fade: FadePosition | undefined) => void;
|
|
5
|
-
type FadeOverlaysProps = {
|
|
6
|
-
fadeRef: MutableRefObject<FadeUpdateFn | null>;
|
|
7
|
-
};
|
|
8
|
-
export declare const FadeOverlays: (({ fadeRef }: FadeOverlaysProps) => React.JSX.Element) | ((_: FadeOverlaysProps) => null);
|
|
9
|
-
export declare const useFadeUpdate: () => {
|
|
10
|
-
fadeRef: React.MutableRefObject<FadeUpdateFn | null>;
|
|
11
|
-
updateFade: (fade: FadePosition | undefined) => void;
|
|
12
|
-
webMask: ViewStyle | undefined;
|
|
13
|
-
};
|
|
14
|
-
export {};
|
|
1
|
+
export { FadePosition, FadeOverlays, useFadeUpdate } from './FadeMask.web';
|
|
2
|
+
export type { FadeUpdateFn } from './FadeMask.web';
|
|
15
3
|
//# sourceMappingURL=FadeMask.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FadeMask.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/chatbot/components/Chat/FadeMask.
|
|
1
|
+
{"version":3,"file":"FadeMask.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/chatbot/components/Chat/FadeMask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAC1E,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React, { MutableRefObject } from 'react';
|
|
2
|
+
export declare enum FadePosition {
|
|
3
|
+
TOP = "top",
|
|
4
|
+
BOTTOM = "bottom",
|
|
5
|
+
BOTH = "both"
|
|
6
|
+
}
|
|
7
|
+
export type FadeUpdateFn = (fade: FadePosition | undefined) => void;
|
|
8
|
+
type FadeOverlaysProps = {
|
|
9
|
+
fadeRef: MutableRefObject<FadeUpdateFn | null>;
|
|
10
|
+
};
|
|
11
|
+
export declare const FadeOverlays: ({ fadeRef }: FadeOverlaysProps) => React.JSX.Element;
|
|
12
|
+
export declare const useFadeUpdate: () => {
|
|
13
|
+
fadeRef: React.MutableRefObject<FadeUpdateFn | null>;
|
|
14
|
+
updateFade: (fade: FadePosition | undefined) => void;
|
|
15
|
+
webMask: undefined;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=FadeMask.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FadeMask.native.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/chatbot/components/Chat/FadeMask.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,gBAAgB,EAAiC,MAAM,OAAO,CAAA;AAI9E,oBAAY,YAAY;IACtB,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AACD,MAAM,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,YAAY,GAAG,SAAS,KAAK,IAAI,CAAA;AAInE,KAAK,iBAAiB,GAAG;IACvB,OAAO,EAAE,gBAAgB,CAAC,YAAY,GAAG,IAAI,CAAC,CAAA;CAC/C,CAAA;AAED,eAAO,MAAM,YAAY,gBAAiB,iBAAiB,sBAyB1D,CAAA;AAED,eAAO,MAAM,aAAa;;uBAIc,YAAY,GAAG,SAAS;;CAO/D,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MutableRefObject } from 'react';
|
|
2
|
+
import { ViewStyle } from 'react-native';
|
|
3
|
+
export declare enum FadePosition {
|
|
4
|
+
TOP = "top",
|
|
5
|
+
BOTTOM = "bottom",
|
|
6
|
+
BOTH = "both"
|
|
7
|
+
}
|
|
8
|
+
export type FadeUpdateFn = (fade: FadePosition | undefined) => void;
|
|
9
|
+
type FadeOverlaysProps = {
|
|
10
|
+
fadeRef: MutableRefObject<FadeUpdateFn | null>;
|
|
11
|
+
};
|
|
12
|
+
export declare const FadeOverlays: (_: FadeOverlaysProps) => null;
|
|
13
|
+
export declare const useFadeUpdate: () => {
|
|
14
|
+
fadeRef: MutableRefObject<FadeUpdateFn | null>;
|
|
15
|
+
updateFade: (fade: FadePosition | undefined) => void;
|
|
16
|
+
webMask: ViewStyle | undefined;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=FadeMask.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FadeMask.web.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/chatbot/components/Chat/FadeMask.web.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAiC,MAAM,OAAO,CAAA;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,oBAAY,YAAY;IACtB,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AACD,MAAM,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,YAAY,GAAG,SAAS,KAAK,IAAI,CAAA;AAEnE,KAAK,iBAAiB,GAAG;IACvB,OAAO,EAAE,gBAAgB,CAAC,YAAY,GAAG,IAAI,CAAC,CAAA;CAC/C,CAAA;AAUD,eAAO,MAAM,YAAY,MAAO,iBAAiB,SAAS,CAAA;AAE1D,eAAO,MAAM,aAAa;;uBAKc,YAAY,GAAG,SAAS;;CAO/D,CAAA"}
|
|
@@ -10,7 +10,7 @@ export declare const useChatScroll: () => {
|
|
|
10
10
|
listRef: import("react").RefObject<FlatList<any>>;
|
|
11
11
|
scroll: import("react").MutableRefObject<ScrollState>;
|
|
12
12
|
isScrolledUp: boolean;
|
|
13
|
-
fadeRef: import("react").MutableRefObject<import("./FadeMask").FadeUpdateFn | null>;
|
|
13
|
+
fadeRef: import("react").MutableRefObject<import("./FadeMask.web").FadeUpdateFn | null>;
|
|
14
14
|
webMask: import("react-native").ViewStyle | undefined;
|
|
15
15
|
handleScroll: (e: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
16
16
|
handleLayout: (e: {
|
package/package.json
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import React, { MutableRefObject, useCallback, useRef, useState } from 'react'
|
|
2
|
-
import { StyleSheet
|
|
3
|
-
import {
|
|
2
|
+
import { StyleSheet } from 'react-native'
|
|
3
|
+
import { LinearGradient } from 'react-native-linear-gradient'
|
|
4
4
|
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
top: { maskImage: 'linear-gradient(to top, transparent, black 10%, black)' } as any,
|
|
10
|
-
bottom: { maskImage: 'linear-gradient(to bottom, transparent, black 10%, black)' } as any,
|
|
11
|
-
both: {
|
|
12
|
-
maskImage: 'linear-gradient(to top, transparent, black 10%, black 90%, transparent)',
|
|
13
|
-
} as any,
|
|
5
|
+
export enum FadePosition {
|
|
6
|
+
TOP = 'top',
|
|
7
|
+
BOTTOM = 'bottom',
|
|
8
|
+
BOTH = 'both',
|
|
14
9
|
}
|
|
10
|
+
export type FadeUpdateFn = (fade: FadePosition | undefined) => void
|
|
15
11
|
|
|
16
12
|
const FADE_HEIGHT = 35
|
|
17
13
|
|
|
@@ -19,13 +15,12 @@ type FadeOverlaysProps = {
|
|
|
19
15
|
fadeRef: MutableRefObject<FadeUpdateFn | null>
|
|
20
16
|
}
|
|
21
17
|
|
|
22
|
-
const
|
|
23
|
-
const { LinearGradient } = require('react-native-linear-gradient')
|
|
18
|
+
export const FadeOverlays = ({ fadeRef }: FadeOverlaysProps) => {
|
|
24
19
|
const [fade, setFade] = useState<FadePosition | undefined>(undefined)
|
|
25
20
|
fadeRef.current = setFade
|
|
26
21
|
|
|
27
|
-
const showTop = fade ===
|
|
28
|
-
const showBottom = fade ===
|
|
22
|
+
const showTop = fade === FadePosition.TOP || fade === FadePosition.BOTH
|
|
23
|
+
const showBottom = fade === FadePosition.BOTTOM || fade === FadePosition.BOTH
|
|
29
24
|
|
|
30
25
|
return (
|
|
31
26
|
<>
|
|
@@ -47,25 +42,7 @@ const NativeFadeOverlays = ({ fadeRef }: FadeOverlaysProps) => {
|
|
|
47
42
|
)
|
|
48
43
|
}
|
|
49
44
|
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
export const FadeOverlays = IS_WEB ? NoopOverlays : NativeFadeOverlays
|
|
53
|
-
|
|
54
|
-
const useWebFadeUpdate = () => {
|
|
55
|
-
const fadeRef = useRef<FadeUpdateFn | null>(null)
|
|
56
|
-
const lastFade = useRef<FadePosition | undefined>(undefined)
|
|
57
|
-
const [webMask, setWebMask] = useState<ViewStyle | undefined>(undefined)
|
|
58
|
-
|
|
59
|
-
const updateFade = useCallback((fade: FadePosition | undefined) => {
|
|
60
|
-
if (fade === lastFade.current) return
|
|
61
|
-
lastFade.current = fade
|
|
62
|
-
setWebMask(fade ? WEB_MASKS[fade] : undefined)
|
|
63
|
-
}, [])
|
|
64
|
-
|
|
65
|
-
return { fadeRef, updateFade, webMask }
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const useNativeFadeUpdate = () => {
|
|
45
|
+
export const useFadeUpdate = () => {
|
|
69
46
|
const fadeRef = useRef<FadeUpdateFn | null>(null)
|
|
70
47
|
const lastFade = useRef<FadePosition | undefined>(undefined)
|
|
71
48
|
|
|
@@ -78,8 +55,6 @@ const useNativeFadeUpdate = () => {
|
|
|
78
55
|
return { fadeRef, updateFade, webMask: undefined }
|
|
79
56
|
}
|
|
80
57
|
|
|
81
|
-
export const useFadeUpdate = IS_WEB ? useWebFadeUpdate : useNativeFadeUpdate
|
|
82
|
-
|
|
83
58
|
const styles = StyleSheet.create({
|
|
84
59
|
gradient: {
|
|
85
60
|
position: 'absolute',
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { MutableRefObject, useCallback, useRef, useState } from 'react'
|
|
2
|
+
import { ViewStyle } from 'react-native'
|
|
3
|
+
|
|
4
|
+
export enum FadePosition {
|
|
5
|
+
TOP = 'top',
|
|
6
|
+
BOTTOM = 'bottom',
|
|
7
|
+
BOTH = 'both',
|
|
8
|
+
}
|
|
9
|
+
export type FadeUpdateFn = (fade: FadePosition | undefined) => void
|
|
10
|
+
|
|
11
|
+
type FadeOverlaysProps = {
|
|
12
|
+
fadeRef: MutableRefObject<FadeUpdateFn | null>
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const WEB_MASKS: Record<FadePosition, ViewStyle> = {
|
|
16
|
+
[FadePosition.TOP]: { maskImage: 'linear-gradient(to top, transparent, black 10%, black)' } as any,
|
|
17
|
+
[FadePosition.BOTTOM]: { maskImage: 'linear-gradient(to bottom, transparent, black 10%, black)' } as any,
|
|
18
|
+
[FadePosition.BOTH]: {
|
|
19
|
+
maskImage: 'linear-gradient(to top, transparent, black 10%, black 90%, transparent)',
|
|
20
|
+
} as any,
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const FadeOverlays = (_: FadeOverlaysProps) => null
|
|
24
|
+
|
|
25
|
+
export const useFadeUpdate = () => {
|
|
26
|
+
const fadeRef = useRef<FadeUpdateFn | null>(null)
|
|
27
|
+
const lastFade = useRef<FadePosition | undefined>(undefined)
|
|
28
|
+
const [webMask, setWebMask] = useState<ViewStyle | undefined>(undefined)
|
|
29
|
+
|
|
30
|
+
const updateFade = useCallback((fade: FadePosition | undefined) => {
|
|
31
|
+
if (fade === lastFade.current) return
|
|
32
|
+
lastFade.current = fade
|
|
33
|
+
setWebMask(fade ? WEB_MASKS[fade] : undefined)
|
|
34
|
+
}, [])
|
|
35
|
+
|
|
36
|
+
return { fadeRef, updateFade, webMask }
|
|
37
|
+
}
|
|
@@ -19,11 +19,11 @@ const initialScrollState: ScrollState = {
|
|
|
19
19
|
contentHeight: 0,
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
const computeFade = (
|
|
23
|
-
if (!
|
|
24
|
-
if (
|
|
25
|
-
if (
|
|
26
|
-
return
|
|
22
|
+
const computeFade = (scrollState: ScrollState) => {
|
|
23
|
+
if (!scrollState.isScrollable) return undefined
|
|
24
|
+
if (scrollState.isAtTop) return FadePosition.BOTTOM
|
|
25
|
+
if (scrollState.isScrolledUp) return FadePosition.BOTH
|
|
26
|
+
return FadePosition.TOP
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export const useChatScroll = () => {
|