react-alp-loading-bar 3.1.3 → 4.0.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.
@@ -1,181 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _inheritsLoose = require('@babel/runtime/helpers/esm/inheritsLoose');
6
- var React = require('react');
7
- var ReactAlpContext = require('react-alp-context');
8
-
9
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
10
-
11
- var _inheritsLoose__default = /*#__PURE__*/_interopDefaultLegacy(_inheritsLoose);
12
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
13
- var ReactAlpContext__default = /*#__PURE__*/_interopDefaultLegacy(ReactAlpContext);
14
-
15
- /*
16
- Example with antd:
17
- import { Progress } from 'antd';
18
-
19
- const LoadingBarComponent = ({ progress }) => (
20
- <Progress
21
- type="line"
22
- status="active"
23
- percent={progress}
24
- showInfo={false}
25
- />
26
- );
27
- */
28
-
29
- /* number between 0 and 1 */
30
-
31
- var random = function random() {
32
- return Math.ceil(Math.random() * 100) / 100;
33
- };
34
- /**
35
- * around:
36
- * at 100ms 20%
37
- * at 1s 40%
38
- * at 2s 60%
39
- * at 3s 80%
40
- */
41
-
42
-
43
- var calculatePercent = function calculatePercent(percent) {
44
- if (percent < 60) return percent + random() * 10 + 5;
45
- if (percent < 70) return percent + random() * 10 + 3;else if (percent < 80) return percent + random() + 5;else if (percent < 90) return percent + random() + 1;else if (percent < 95) return percent + 0.1;else return percent;
46
- };
47
-
48
- var LoadingBar = /*#__PURE__*/function (_PureComponent) {
49
- _inheritsLoose__default(LoadingBar, _PureComponent);
50
-
51
- function LoadingBar() {
52
- var _this, _len, args, _key;
53
-
54
- for (_len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
55
- args[_key] = arguments[_key];
56
- }
57
-
58
- _this = _PureComponent.call.apply(_PureComponent, [this].concat(args)) || this;
59
- _this.state = {
60
- loading: true,
61
- hidden: true,
62
- progress: 1
63
- };
64
- return _this;
65
- }
66
-
67
- var _proto = LoadingBar.prototype;
68
-
69
- _proto.componentDidMount = function componentDidMount() {
70
- var _this2 = this;
71
-
72
- var websocket = this.getWebsocket();
73
-
74
- if (websocket.isConnected()) {
75
- this.setState(function (prevState) {
76
- return {
77
- loading: false,
78
- progress: 100,
79
- hidden: prevState.hidden || prevState.progress === 100
80
- };
81
- });
82
- }
83
-
84
- websocket.on('connect', function () {
85
- _this2.setState({
86
- loading: false
87
- });
88
- });
89
- websocket.on('disconnect', function () {
90
- _this2.setState({
91
- loading: true,
92
- progress: 1,
93
- hidden: false
94
- });
95
- });
96
- };
97
-
98
- _proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
99
- if (this.state.loading !== prevState.loading) {
100
- if (this.state.loading) {
101
- this.showBar();
102
- } else {
103
- this.hideBar();
104
- }
105
- }
106
- };
107
-
108
- _proto.componentWillUnmount = function componentWillUnmount() {
109
- clearTimeout(this.fadeOffTimeout);
110
- clearTimeout(this.resetTimeout);
111
- clearTimeout(this.first20Timeout);
112
- clearInterval(this.progressTimer);
113
- };
114
-
115
- _proto.getWebsocket = function getWebsocket() {
116
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return
117
- return this.context.app.websocket;
118
- };
119
-
120
- _proto.showBar = function showBar() {
121
- var _this3 = this;
122
-
123
- clearTimeout(this.fadeOffTimeout);
124
- clearTimeout(this.resetTimeout);
125
- this.first20Timeout = setTimeout(function () {
126
- _this3.setState({
127
- progress: 20
128
- });
129
- }, 100);
130
- this.progressTimer = setInterval(function () {
131
- _this3.setState(function (prevState) {
132
- var newValue = calculatePercent(prevState.progress);
133
- return {
134
- progress: newValue
135
- };
136
- });
137
- }, 500);
138
- };
139
-
140
- _proto.hideBar = function hideBar() {
141
- var _this4 = this;
142
-
143
- clearTimeout(this.first20Timeout);
144
- clearInterval(this.progressTimer);
145
- this.fadeOffTimeout = setTimeout(function () {
146
- _this4.setState({
147
- progress: 100
148
- });
149
- }, 500);
150
- this.resetTimeout = setTimeout(function () {
151
- _this4.setState({
152
- hidden: true,
153
- progress: 1
154
- });
155
- }, 1000);
156
- };
157
-
158
- _proto.render = function render() {
159
- var LoadingBarComponent = this.props.LoadingBarComponent;
160
- return /*#__PURE__*/React__default.createElement("div", {
161
- hidden: this.state.hidden,
162
- style: {
163
- position: 'fixed',
164
- top: 0,
165
- left: 0,
166
- right: 0,
167
- zIndex: 4,
168
- pointerEvents: 'none'
169
- }
170
- }, /*#__PURE__*/React__default.createElement(LoadingBarComponent, {
171
- progress: this.state.progress
172
- }));
173
- };
174
-
175
- return LoadingBar;
176
- }(React.PureComponent);
177
-
178
- LoadingBar.contextType = ReactAlpContext__default;
179
-
180
- exports.default = LoadingBar;
181
- //# sourceMappingURL=index-browser-dev.cjs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-browser-dev.cjs.js","sources":["../src/index.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport React, { PureComponent } from 'react';\nimport ReactAlpContext from 'react-alp-context';\n\n/*\nExample with antd:\nimport { Progress } from 'antd';\n\nconst LoadingBarComponent = ({ progress }) => (\n <Progress\n type=\"line\"\n status=\"active\"\n percent={progress}\n showInfo={false}\n />\n);\n*/\n\n/* number between 0 and 1 */\nconst random = (): number => Math.ceil(Math.random() * 100) / 100;\n\n/**\n * around:\n * at 100ms 20%\n * at 1s 40%\n * at 2s 60%\n * at 3s 80%\n */\nconst calculatePercent = (percent: number): number => {\n if (percent < 60) return percent + random() * 10 + 5;\n if (percent < 70) return percent + random() * 10 + 3;\n else if (percent < 80) return percent + random() + 5;\n else if (percent < 90) return percent + random() + 1;\n else if (percent < 95) return percent + 0.1;\n else return percent;\n};\n\ninterface LoadingBarProps {\n LoadingBarComponent: React.ComponentType<{ progress: number }>;\n}\n\ninterface LoadingBarState {\n loading: boolean;\n hidden: boolean;\n progress: number;\n}\n\ninterface WebsocketInterface {\n isConnected: () => boolean;\n on: (event: 'connect' | 'disconnect', callback: () => unknown) => void;\n}\n\nexport default class LoadingBar extends PureComponent<\n LoadingBarProps,\n LoadingBarState\n> {\n static contextType = ReactAlpContext;\n\n context!: React.ContextType<typeof ReactAlpContext>;\n\n state = {\n loading: true,\n hidden: true,\n progress: 1,\n };\n\n fadeOffTimeout?: any;\n\n resetTimeout?: any;\n\n first20Timeout?: any;\n\n progressTimer?: any;\n\n componentDidMount(): void {\n const websocket = this.getWebsocket();\n if (websocket.isConnected()) {\n this.setState((prevState) => ({\n loading: false,\n progress: 100,\n hidden: prevState.hidden || prevState.progress === 100,\n }));\n }\n websocket.on('connect', () => {\n this.setState({ loading: false });\n });\n websocket.on('disconnect', () => {\n this.setState({ loading: true, progress: 1, hidden: false });\n });\n }\n\n componentDidUpdate(\n prevProps: LoadingBarProps,\n prevState: LoadingBarState,\n ): void {\n if (this.state.loading !== prevState.loading) {\n if (this.state.loading) {\n this.showBar();\n } else {\n this.hideBar();\n }\n }\n }\n\n componentWillUnmount(): void {\n clearTimeout(this.fadeOffTimeout);\n clearTimeout(this.resetTimeout);\n clearTimeout(this.first20Timeout);\n clearInterval(this.progressTimer);\n }\n\n getWebsocket(): WebsocketInterface {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return\n return this.context.app.websocket;\n }\n\n private showBar(): void {\n clearTimeout(this.fadeOffTimeout);\n clearTimeout(this.resetTimeout);\n\n this.first20Timeout = setTimeout(() => {\n this.setState({ progress: 20 });\n }, 100);\n\n this.progressTimer = setInterval(() => {\n this.setState((prevState) => {\n const newValue = calculatePercent(prevState.progress);\n return { progress: newValue };\n });\n }, 500);\n }\n\n private hideBar(): void {\n clearTimeout(this.first20Timeout);\n clearInterval(this.progressTimer);\n\n this.fadeOffTimeout = setTimeout(() => {\n this.setState({\n progress: 100,\n });\n }, 500);\n\n this.resetTimeout = setTimeout(() => {\n this.setState({\n hidden: true,\n progress: 1,\n });\n }, 1000);\n }\n\n render(): ReactElement {\n const LoadingBarComponent = this.props.LoadingBarComponent;\n\n return (\n <div\n hidden={this.state.hidden}\n style={{\n position: 'fixed',\n top: 0,\n left: 0,\n right: 0,\n zIndex: 4,\n pointerEvents: 'none',\n }}\n >\n <LoadingBarComponent progress={this.state.progress} />\n </div>\n );\n }\n}\n"],"names":["random","Math","ceil","calculatePercent","percent","LoadingBar","state","loading","hidden","progress","componentDidMount","websocket","getWebsocket","isConnected","setState","prevState","on","componentDidUpdate","prevProps","showBar","hideBar","componentWillUnmount","clearTimeout","fadeOffTimeout","resetTimeout","first20Timeout","clearInterval","progressTimer","context","app","setTimeout","setInterval","newValue","render","LoadingBarComponent","props","React","position","top","left","right","zIndex","pointerEvents","PureComponent","contextType","ReactAlpContext"],"mappings":";;;;;;;;;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AACA,IAAMA,MAAM,GAAG,SAATA,MAAS;AAAA,SAAcC,IAAI,CAACC,IAAL,CAAUD,IAAI,CAACD,MAAL,KAAgB,GAA1B,IAAiC,GAA/C;AAAA,CAAf;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,IAAMG,gBAAgB,GAAG,SAAnBA,gBAAmB,CAACC,OAAD,EAA6B;AACpD,MAAIA,OAAO,GAAG,EAAd,EAAkB,OAAOA,OAAO,GAAGJ,MAAM,KAAK,EAArB,GAA0B,CAAjC;AAClB,MAAII,OAAO,GAAG,EAAd,EAAkB,OAAOA,OAAO,GAAGJ,MAAM,KAAK,EAArB,GAA0B,CAAjC,CAAlB,KACK,IAAII,OAAO,GAAG,EAAd,EAAkB,OAAOA,OAAO,GAAGJ,MAAM,EAAhB,GAAqB,CAA5B,CAAlB,KACA,IAAII,OAAO,GAAG,EAAd,EAAkB,OAAOA,OAAO,GAAGJ,MAAM,EAAhB,GAAqB,CAA5B,CAAlB,KACA,IAAII,OAAO,GAAG,EAAd,E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ID,KAL6B,EAK3B,IAL2B,CAA9B;AAMD;;SAEDwB,SAAA,kBAAuB;AACrB,QAAMC,mBAAmB,GAAG,KAAKC,KAAL,CAAWD,mBAAvC;AAEA,wBACEE;AACE,MAAA,MAAM,EAAE,KAAK9B,KAAL,CAAWE,MADrB;AAEE,MAAA,KAAK,EAAE;AACL6B,QAAAA,QAAQ,EAAE,OADL;AAELC,QAAAA,GAAG,EAAE,CAFA;AAGLC,QAAAA,IAAI,EAAE,CAHD;AAILC,QAAAA,KAAK,EAAE,CAJF;AAKLC,QAAAA,MAAM,EAAE,CALH;AAMLC,QAAAA,aAAa,EAAE;AANV;AAFT,oBAWEN,6BAAC,mBAAD;AAAqB,MAAA,QAAQ,EAAE,KAAK9B,KAAL,CAAWG;AAA1C,MAXF,CADF;AAeD;;;EApHqCkC;;AAAnBtC,WAIZuC,cAAcC;;;;"}
@@ -1,171 +0,0 @@
1
- import _inheritsLoose from '@babel/runtime/helpers/esm/inheritsLoose';
2
- import React, { PureComponent } from 'react';
3
- import ReactAlpContext from 'react-alp-context';
4
-
5
- /*
6
- Example with antd:
7
- import { Progress } from 'antd';
8
-
9
- const LoadingBarComponent = ({ progress }) => (
10
- <Progress
11
- type="line"
12
- status="active"
13
- percent={progress}
14
- showInfo={false}
15
- />
16
- );
17
- */
18
-
19
- /* number between 0 and 1 */
20
-
21
- var random = function random() {
22
- return Math.ceil(Math.random() * 100) / 100;
23
- };
24
- /**
25
- * around:
26
- * at 100ms 20%
27
- * at 1s 40%
28
- * at 2s 60%
29
- * at 3s 80%
30
- */
31
-
32
-
33
- var calculatePercent = function calculatePercent(percent) {
34
- if (percent < 60) return percent + random() * 10 + 5;
35
- if (percent < 70) return percent + random() * 10 + 3;else if (percent < 80) return percent + random() + 5;else if (percent < 90) return percent + random() + 1;else if (percent < 95) return percent + 0.1;else return percent;
36
- };
37
-
38
- var LoadingBar = /*#__PURE__*/function (_PureComponent) {
39
- _inheritsLoose(LoadingBar, _PureComponent);
40
-
41
- function LoadingBar() {
42
- var _this, _len, args, _key;
43
-
44
- for (_len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
45
- args[_key] = arguments[_key];
46
- }
47
-
48
- _this = _PureComponent.call.apply(_PureComponent, [this].concat(args)) || this;
49
- _this.state = {
50
- loading: true,
51
- hidden: true,
52
- progress: 1
53
- };
54
- return _this;
55
- }
56
-
57
- var _proto = LoadingBar.prototype;
58
-
59
- _proto.componentDidMount = function componentDidMount() {
60
- var _this2 = this;
61
-
62
- var websocket = this.getWebsocket();
63
-
64
- if (websocket.isConnected()) {
65
- this.setState(function (prevState) {
66
- return {
67
- loading: false,
68
- progress: 100,
69
- hidden: prevState.hidden || prevState.progress === 100
70
- };
71
- });
72
- }
73
-
74
- websocket.on('connect', function () {
75
- _this2.setState({
76
- loading: false
77
- });
78
- });
79
- websocket.on('disconnect', function () {
80
- _this2.setState({
81
- loading: true,
82
- progress: 1,
83
- hidden: false
84
- });
85
- });
86
- };
87
-
88
- _proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
89
- if (this.state.loading !== prevState.loading) {
90
- if (this.state.loading) {
91
- this.showBar();
92
- } else {
93
- this.hideBar();
94
- }
95
- }
96
- };
97
-
98
- _proto.componentWillUnmount = function componentWillUnmount() {
99
- clearTimeout(this.fadeOffTimeout);
100
- clearTimeout(this.resetTimeout);
101
- clearTimeout(this.first20Timeout);
102
- clearInterval(this.progressTimer);
103
- };
104
-
105
- _proto.getWebsocket = function getWebsocket() {
106
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return
107
- return this.context.app.websocket;
108
- };
109
-
110
- _proto.showBar = function showBar() {
111
- var _this3 = this;
112
-
113
- clearTimeout(this.fadeOffTimeout);
114
- clearTimeout(this.resetTimeout);
115
- this.first20Timeout = setTimeout(function () {
116
- _this3.setState({
117
- progress: 20
118
- });
119
- }, 100);
120
- this.progressTimer = setInterval(function () {
121
- _this3.setState(function (prevState) {
122
- var newValue = calculatePercent(prevState.progress);
123
- return {
124
- progress: newValue
125
- };
126
- });
127
- }, 500);
128
- };
129
-
130
- _proto.hideBar = function hideBar() {
131
- var _this4 = this;
132
-
133
- clearTimeout(this.first20Timeout);
134
- clearInterval(this.progressTimer);
135
- this.fadeOffTimeout = setTimeout(function () {
136
- _this4.setState({
137
- progress: 100
138
- });
139
- }, 500);
140
- this.resetTimeout = setTimeout(function () {
141
- _this4.setState({
142
- hidden: true,
143
- progress: 1
144
- });
145
- }, 1000);
146
- };
147
-
148
- _proto.render = function render() {
149
- var LoadingBarComponent = this.props.LoadingBarComponent;
150
- return /*#__PURE__*/React.createElement("div", {
151
- hidden: this.state.hidden,
152
- style: {
153
- position: 'fixed',
154
- top: 0,
155
- left: 0,
156
- right: 0,
157
- zIndex: 4,
158
- pointerEvents: 'none'
159
- }
160
- }, /*#__PURE__*/React.createElement(LoadingBarComponent, {
161
- progress: this.state.progress
162
- }));
163
- };
164
-
165
- return LoadingBar;
166
- }(PureComponent);
167
-
168
- LoadingBar.contextType = ReactAlpContext;
169
-
170
- export default LoadingBar;
171
- //# sourceMappingURL=index-browser-dev.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-browser-dev.es.js","sources":["../src/index.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport React, { PureComponent } from 'react';\nimport ReactAlpContext from 'react-alp-context';\n\n/*\nExample with antd:\nimport { Progress } from 'antd';\n\nconst LoadingBarComponent = ({ progress }) => (\n <Progress\n type=\"line\"\n status=\"active\"\n percent={progress}\n showInfo={false}\n />\n);\n*/\n\n/* number between 0 and 1 */\nconst random = (): number => Math.ceil(Math.random() * 100) / 100;\n\n/**\n * around:\n * at 100ms 20%\n * at 1s 40%\n * at 2s 60%\n * at 3s 80%\n */\nconst calculatePercent = (percent: number): number => {\n if (percent < 60) return percent + random() * 10 + 5;\n if (percent < 70) return percent + random() * 10 + 3;\n else if (percent < 80) return percent + random() + 5;\n else if (percent < 90) return percent + random() + 1;\n else if (percent < 95) return percent + 0.1;\n else return percent;\n};\n\ninterface LoadingBarProps {\n LoadingBarComponent: React.ComponentType<{ progress: number }>;\n}\n\ninterface LoadingBarState {\n loading: boolean;\n hidden: boolean;\n progress: number;\n}\n\ninterface WebsocketInterface {\n isConnected: () => boolean;\n on: (event: 'connect' | 'disconnect', callback: () => unknown) => void;\n}\n\nexport default class LoadingBar extends PureComponent<\n LoadingBarProps,\n LoadingBarState\n> {\n static contextType = ReactAlpContext;\n\n context!: React.ContextType<typeof ReactAlpContext>;\n\n state = {\n loading: true,\n hidden: true,\n progress: 1,\n };\n\n fadeOffTimeout?: any;\n\n resetTimeout?: any;\n\n first20Timeout?: any;\n\n progressTimer?: any;\n\n componentDidMount(): void {\n const websocket = this.getWebsocket();\n if (websocket.isConnected()) {\n this.setState((prevState) => ({\n loading: false,\n progress: 100,\n hidden: prevState.hidden || prevState.progress === 100,\n }));\n }\n websocket.on('connect', () => {\n this.setState({ loading: false });\n });\n websocket.on('disconnect', () => {\n this.setState({ loading: true, progress: 1, hidden: false });\n });\n }\n\n componentDidUpdate(\n prevProps: LoadingBarProps,\n prevState: LoadingBarState,\n ): void {\n if (this.state.loading !== prevState.loading) {\n if (this.state.loading) {\n this.showBar();\n } else {\n this.hideBar();\n }\n }\n }\n\n componentWillUnmount(): void {\n clearTimeout(this.fadeOffTimeout);\n clearTimeout(this.resetTimeout);\n clearTimeout(this.first20Timeout);\n clearInterval(this.progressTimer);\n }\n\n getWebsocket(): WebsocketInterface {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return\n return this.context.app.websocket;\n }\n\n private showBar(): void {\n clearTimeout(this.fadeOffTimeout);\n clearTimeout(this.resetTimeout);\n\n this.first20Timeout = setTimeout(() => {\n this.setState({ progress: 20 });\n }, 100);\n\n this.progressTimer = setInterval(() => {\n this.setState((prevState) => {\n const newValue = calculatePercent(prevState.progress);\n return { progress: newValue };\n });\n }, 500);\n }\n\n private hideBar(): void {\n clearTimeout(this.first20Timeout);\n clearInterval(this.progressTimer);\n\n this.fadeOffTimeout = setTimeout(() => {\n this.setState({\n progress: 100,\n });\n }, 500);\n\n this.resetTimeout = setTimeout(() => {\n this.setState({\n hidden: true,\n progress: 1,\n });\n }, 1000);\n }\n\n render(): ReactElement {\n const LoadingBarComponent = this.props.LoadingBarComponent;\n\n return (\n <div\n hidden={this.state.hidden}\n style={{\n position: 'fixed',\n top: 0,\n left: 0,\n right: 0,\n zIndex: 4,\n pointerEvents: 'none',\n }}\n >\n <LoadingBarComponent progress={this.state.progress} />\n </div>\n );\n }\n}\n"],"names":["random","Math","ceil","calculatePercent","percent","LoadingBar","state","loading","hidden","progress","componentDidMount","websocket","getWebsocket","isConnected","setState","prevState","on","componentDidUpdate","prevProps","showBar","hideBar","componentWillUnmount","clearTimeout","fadeOffTimeout","resetTimeout","first20Timeout","clearInterval","progressTimer","context","app","setTimeout","setInterval","newValue","render","LoadingBarComponent","props","position","top","left","right","zIndex","pointerEvents","PureComponent","contextType","ReactAlpContext"],"mappings":";;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AACA,IAAMA,MAAM,GAAG,SAATA,MAAS;AAAA,SAAcC,IAAI,CAACC,IAAL,CAAUD,IAAI,CAACD,MAAL,KAAgB,GAA1B,IAAiC,GAA/C;AAAA,CAAf;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,IAAMG,gBAAgB,GAAG,SAAnBA,gBAAmB,CAACC,OAAD,EAA6B;AACpD,MAAIA,OAAO,GAAG,EAAd,EAAkB,OAAOA,OAAO,GAAGJ,MAAM,KAAK,EAArB,GAA0B,CAAjC;AAClB,MAAII,OAAO,GAAG,EAAd,EAAkB,OAAOA,OAAO,GAAGJ,MAAM,KAAK,EAArB,GAA0B,CAAjC,CAAlB,KACK,IAAII,OAAO,GAAG,EAAd,EAAkB,OAAOA,OAAO,GAAGJ,MAAM,EAAhB,GAAqB,CAA5B,CAA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AAU,CAAC,YAAM;AACnC,MAAA,MAAI,CAAChB,QAAL,CAAc;AACZN,QAAAA,MAAM,EAAE,IADI;AAEZC,QAAAA,QAAQ,EAAE;AAFE,OAAd;AAID,KAL6B,EAK3B,IAL2B,CAA9B;AAMD;;SAEDwB,SAAA,kBAAuB;AACrB,QAAMC,mBAAmB,GAAG,KAAKC,KAAL,CAAWD,mBAAvC;AAEA,wBACE;AACE,MAAA,MAAM,EAAE,KAAK5B,KAAL,CAAWE,MADrB;AAEE,MAAA,KAAK,EAAE;AACL4B,QAAAA,QAAQ,EAAE,OADL;AAELC,QAAAA,GAAG,EAAE,CAFA;AAGLC,QAAAA,IAAI,EAAE,CAHD;AAILC,QAAAA,KAAK,EAAE,CAJF;AAKLC,QAAAA,MAAM,EAAE,CALH;AAMLC,QAAAA,aAAa,EAAE;AANV;AAFT,oBAWE,oBAAC,mBAAD;AAAqB,MAAA,QAAQ,EAAE,KAAKnC,KAAL,CAAWG;AAA1C,MAXF,CADF;AAeD;;;EApHqCiC;;AAAnBrC,WAIZsC,cAAcC;;;;"}
@@ -1,181 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _inheritsLoose = require('@babel/runtime/helpers/esm/inheritsLoose');
6
- var React = require('react');
7
- var ReactAlpContext = require('react-alp-context');
8
-
9
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
10
-
11
- var _inheritsLoose__default = /*#__PURE__*/_interopDefaultLegacy(_inheritsLoose);
12
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
13
- var ReactAlpContext__default = /*#__PURE__*/_interopDefaultLegacy(ReactAlpContext);
14
-
15
- /*
16
- Example with antd:
17
- import { Progress } from 'antd';
18
-
19
- const LoadingBarComponent = ({ progress }) => (
20
- <Progress
21
- type="line"
22
- status="active"
23
- percent={progress}
24
- showInfo={false}
25
- />
26
- );
27
- */
28
-
29
- /* number between 0 and 1 */
30
-
31
- var random = function random() {
32
- return Math.ceil(Math.random() * 100) / 100;
33
- };
34
- /**
35
- * around:
36
- * at 100ms 20%
37
- * at 1s 40%
38
- * at 2s 60%
39
- * at 3s 80%
40
- */
41
-
42
-
43
- var calculatePercent = function calculatePercent(percent) {
44
- if (percent < 60) return percent + random() * 10 + 5;
45
- if (percent < 70) return percent + random() * 10 + 3;else if (percent < 80) return percent + random() + 5;else if (percent < 90) return percent + random() + 1;else if (percent < 95) return percent + 0.1;else return percent;
46
- };
47
-
48
- var LoadingBar = /*#__PURE__*/function (_PureComponent) {
49
- _inheritsLoose__default(LoadingBar, _PureComponent);
50
-
51
- function LoadingBar() {
52
- var _this, _len, args, _key;
53
-
54
- for (_len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
55
- args[_key] = arguments[_key];
56
- }
57
-
58
- _this = _PureComponent.call.apply(_PureComponent, [this].concat(args)) || this;
59
- _this.state = {
60
- loading: true,
61
- hidden: true,
62
- progress: 1
63
- };
64
- return _this;
65
- }
66
-
67
- var _proto = LoadingBar.prototype;
68
-
69
- _proto.componentDidMount = function componentDidMount() {
70
- var _this2 = this;
71
-
72
- var websocket = this.getWebsocket();
73
-
74
- if (websocket.isConnected()) {
75
- this.setState(function (prevState) {
76
- return {
77
- loading: false,
78
- progress: 100,
79
- hidden: prevState.hidden || prevState.progress === 100
80
- };
81
- });
82
- }
83
-
84
- websocket.on('connect', function () {
85
- _this2.setState({
86
- loading: false
87
- });
88
- });
89
- websocket.on('disconnect', function () {
90
- _this2.setState({
91
- loading: true,
92
- progress: 1,
93
- hidden: false
94
- });
95
- });
96
- };
97
-
98
- _proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
99
- if (this.state.loading !== prevState.loading) {
100
- if (this.state.loading) {
101
- this.showBar();
102
- } else {
103
- this.hideBar();
104
- }
105
- }
106
- };
107
-
108
- _proto.componentWillUnmount = function componentWillUnmount() {
109
- clearTimeout(this.fadeOffTimeout);
110
- clearTimeout(this.resetTimeout);
111
- clearTimeout(this.first20Timeout);
112
- clearInterval(this.progressTimer);
113
- };
114
-
115
- _proto.getWebsocket = function getWebsocket() {
116
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return
117
- return this.context.app.websocket;
118
- };
119
-
120
- _proto.showBar = function showBar() {
121
- var _this3 = this;
122
-
123
- clearTimeout(this.fadeOffTimeout);
124
- clearTimeout(this.resetTimeout);
125
- this.first20Timeout = setTimeout(function () {
126
- _this3.setState({
127
- progress: 20
128
- });
129
- }, 100);
130
- this.progressTimer = setInterval(function () {
131
- _this3.setState(function (prevState) {
132
- var newValue = calculatePercent(prevState.progress);
133
- return {
134
- progress: newValue
135
- };
136
- });
137
- }, 500);
138
- };
139
-
140
- _proto.hideBar = function hideBar() {
141
- var _this4 = this;
142
-
143
- clearTimeout(this.first20Timeout);
144
- clearInterval(this.progressTimer);
145
- this.fadeOffTimeout = setTimeout(function () {
146
- _this4.setState({
147
- progress: 100
148
- });
149
- }, 500);
150
- this.resetTimeout = setTimeout(function () {
151
- _this4.setState({
152
- hidden: true,
153
- progress: 1
154
- });
155
- }, 1000);
156
- };
157
-
158
- _proto.render = function render() {
159
- var LoadingBarComponent = this.props.LoadingBarComponent;
160
- return /*#__PURE__*/React__default.createElement("div", {
161
- hidden: this.state.hidden,
162
- style: {
163
- position: 'fixed',
164
- top: 0,
165
- left: 0,
166
- right: 0,
167
- zIndex: 4,
168
- pointerEvents: 'none'
169
- }
170
- }, /*#__PURE__*/React__default.createElement(LoadingBarComponent, {
171
- progress: this.state.progress
172
- }));
173
- };
174
-
175
- return LoadingBar;
176
- }(React.PureComponent);
177
-
178
- LoadingBar.contextType = ReactAlpContext__default;
179
-
180
- exports.default = LoadingBar;
181
- //# sourceMappingURL=index-browser.cjs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-browser.cjs.js","sources":["../src/index.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport React, { PureComponent } from 'react';\nimport ReactAlpContext from 'react-alp-context';\n\n/*\nExample with antd:\nimport { Progress } from 'antd';\n\nconst LoadingBarComponent = ({ progress }) => (\n <Progress\n type=\"line\"\n status=\"active\"\n percent={progress}\n showInfo={false}\n />\n);\n*/\n\n/* number between 0 and 1 */\nconst random = (): number => Math.ceil(Math.random() * 100) / 100;\n\n/**\n * around:\n * at 100ms 20%\n * at 1s 40%\n * at 2s 60%\n * at 3s 80%\n */\nconst calculatePercent = (percent: number): number => {\n if (percent < 60) return percent + random() * 10 + 5;\n if (percent < 70) return percent + random() * 10 + 3;\n else if (percent < 80) return percent + random() + 5;\n else if (percent < 90) return percent + random() + 1;\n else if (percent < 95) return percent + 0.1;\n else return percent;\n};\n\ninterface LoadingBarProps {\n LoadingBarComponent: React.ComponentType<{ progress: number }>;\n}\n\ninterface LoadingBarState {\n loading: boolean;\n hidden: boolean;\n progress: number;\n}\n\ninterface WebsocketInterface {\n isConnected: () => boolean;\n on: (event: 'connect' | 'disconnect', callback: () => unknown) => void;\n}\n\nexport default class LoadingBar extends PureComponent<\n LoadingBarProps,\n LoadingBarState\n> {\n static contextType = ReactAlpContext;\n\n context!: React.ContextType<typeof ReactAlpContext>;\n\n state = {\n loading: true,\n hidden: true,\n progress: 1,\n };\n\n fadeOffTimeout?: any;\n\n resetTimeout?: any;\n\n first20Timeout?: any;\n\n progressTimer?: any;\n\n componentDidMount(): void {\n const websocket = this.getWebsocket();\n if (websocket.isConnected()) {\n this.setState((prevState) => ({\n loading: false,\n progress: 100,\n hidden: prevState.hidden || prevState.progress === 100,\n }));\n }\n websocket.on('connect', () => {\n this.setState({ loading: false });\n });\n websocket.on('disconnect', () => {\n this.setState({ loading: true, progress: 1, hidden: false });\n });\n }\n\n componentDidUpdate(\n prevProps: LoadingBarProps,\n prevState: LoadingBarState,\n ): void {\n if (this.state.loading !== prevState.loading) {\n if (this.state.loading) {\n this.showBar();\n } else {\n this.hideBar();\n }\n }\n }\n\n componentWillUnmount(): void {\n clearTimeout(this.fadeOffTimeout);\n clearTimeout(this.resetTimeout);\n clearTimeout(this.first20Timeout);\n clearInterval(this.progressTimer);\n }\n\n getWebsocket(): WebsocketInterface {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return\n return this.context.app.websocket;\n }\n\n private showBar(): void {\n clearTimeout(this.fadeOffTimeout);\n clearTimeout(this.resetTimeout);\n\n this.first20Timeout = setTimeout(() => {\n this.setState({ progress: 20 });\n }, 100);\n\n this.progressTimer = setInterval(() => {\n this.setState((prevState) => {\n const newValue = calculatePercent(prevState.progress);\n return { progress: newValue };\n });\n }, 500);\n }\n\n private hideBar(): void {\n clearTimeout(this.first20Timeout);\n clearInterval(this.progressTimer);\n\n this.fadeOffTimeout = setTimeout(() => {\n this.setState({\n progress: 100,\n });\n }, 500);\n\n this.resetTimeout = setTimeout(() => {\n this.setState({\n hidden: true,\n progress: 1,\n });\n }, 1000);\n }\n\n render(): ReactElement {\n const LoadingBarComponent = this.props.LoadingBarComponent;\n\n return (\n <div\n hidden={this.state.hidden}\n style={{\n position: 'fixed',\n top: 0,\n left: 0,\n right: 0,\n zIndex: 4,\n pointerEvents: 'none',\n }}\n >\n <LoadingBarComponent progress={this.state.progress} />\n </div>\n );\n }\n}\n"],"names":["random","Math","ceil","calculatePercent","percent","LoadingBar","state","loading","hidden","progress","componentDidMount","websocket","getWebsocket","isConnected","setState","prevState","on","componentDidUpdate","prevProps","showBar","hideBar","componentWillUnmount","clearTimeout","fadeOffTimeout","resetTimeout","first20Timeout","clearInterval","progressTimer","context","app","setTimeout","setInterval","newValue","render","LoadingBarComponent","props","React","position","top","left","right","zIndex","pointerEvents","PureComponent","contextType","ReactAlpContext"],"mappings":";;;;;;;;;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AACA,IAAMA,MAAM,GAAG,SAATA,MAAS;AAAA,SAAcC,IAAI,CAACC,IAAL,CAAUD,IAAI,CAACD,MAAL,K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