@geneui/components 3.0.0-next-9ffcb93-16102024 → 3.0.0-next-48d0ef7-31102024

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.
Files changed (248) hide show
  1. package/Avatar.js +63 -0
  2. package/CHANGELOG.md +7 -0
  3. package/Divider.js +23 -0
  4. package/{GeneUIProvider/index.js → GeneUIProvider.js} +52 -65
  5. package/HelperText.js +69 -0
  6. package/Info.js +64 -0
  7. package/Label.js +38 -0
  8. package/Loader.js +21 -0
  9. package/Pill.js +64 -0
  10. package/TextLink.js +20 -0
  11. package/{index-65217440.js → Tooltip.js} +104 -80
  12. package/{lib → components}/atoms/Avatar/Avatar.d.ts +7 -6
  13. package/components/atoms/Avatar/index.d.ts +1 -0
  14. package/{lib → components}/atoms/Divider/Divider.d.ts +5 -5
  15. package/components/atoms/Divider/index.d.ts +1 -0
  16. package/{lib → components}/atoms/HelperText/HelperText.d.ts +6 -5
  17. package/components/atoms/HelperText/index.d.ts +1 -0
  18. package/{lib → components}/atoms/Info/Info.d.ts +5 -5
  19. package/components/atoms/Info/index.d.ts +1 -0
  20. package/{lib → components}/atoms/Label/Label.d.ts +3 -3
  21. package/components/atoms/Label/index.d.ts +1 -0
  22. package/{lib → components}/atoms/Loader/Loader.d.ts +5 -5
  23. package/components/atoms/Loader/index.d.ts +1 -0
  24. package/{lib → components}/atoms/Pill/Pill.d.ts +7 -6
  25. package/components/atoms/Pill/index.d.ts +1 -0
  26. package/{lib → components}/atoms/TextLink/TextLink.d.ts +5 -5
  27. package/components/atoms/TextLink/index.d.ts +1 -0
  28. package/{lib → components}/molecules/Tooltip/Tooltip.d.ts +26 -21
  29. package/components/molecules/Tooltip/index.d.ts +1 -0
  30. package/components/providers/GeneUIProvider/GeneUIProvider.d.ts +30 -0
  31. package/components/providers/GeneUIProvider/index.d.ts +1 -0
  32. package/hooks/index.d.ts +2 -20
  33. package/hooks/useDebounceCallback/index.d.ts +1 -0
  34. package/hooks/useDebounceCallback/useDebounceCallback.d.ts +2 -0
  35. package/hooks/useEllipsisDetection/index.d.ts +1 -1
  36. package/hooks/useEllipsisDetection/useEllipsisDetection.d.ts +2 -2
  37. package/{index-031ff73c.js → index-ce02421b.js} +4 -4
  38. package/index.d.ts +11 -121
  39. package/index.js +12 -159
  40. package/package.json +24 -43
  41. package/tokens-0abb4e1b.js +6 -0
  42. package/types/index.d.ts +0 -3
  43. package/useEllipsisDetection-46d712b6.js +34 -0
  44. package/ActionableList/index.js +0 -1694
  45. package/AdvancedSearch/index.js +0 -892
  46. package/Alert/index.js +0 -98
  47. package/Avatar/index.js +0 -58
  48. package/Badge/index.js +0 -29
  49. package/Breadcrumb/index.js +0 -130
  50. package/BusyLoader/index.js +0 -31
  51. package/Button/index.js +0 -30
  52. package/Card/index.js +0 -502
  53. package/CardList/index.js +0 -662
  54. package/CellMeasurerCache-80be385d.js +0 -229
  55. package/Charts/index.js +0 -17662
  56. package/Checkbox/index.js +0 -229
  57. package/CheckboxGroup/index.js +0 -203
  58. package/CheckboxGroupWithSearch/index.js +0 -280
  59. package/Collapse/index.js +0 -195
  60. package/ColorPicker/index.js +0 -210
  61. package/ComboBox/index.js +0 -524
  62. package/Copy/index.js +0 -56
  63. package/Counter/index.js +0 -312
  64. package/DateFilter/index.js +0 -183
  65. package/DatePicker/index.js +0 -1229
  66. package/DatePickerInput/index.js +0 -883
  67. package/Divider/index.js +0 -23
  68. package/Drawer/index.js +0 -261
  69. package/Dropdown/index.js +0 -43
  70. package/Editor/index.js +0 -22975
  71. package/Empty/index.js +0 -76
  72. package/ExtendedInput/index.js +0 -590
  73. package/Form/index.js +0 -85
  74. package/FormContainer/index.js +0 -189
  75. package/FormableCheckbox/index.js +0 -24
  76. package/FormableDatePicker/index.js +0 -43
  77. package/FormableDropdown/index.js +0 -50
  78. package/FormableEditor/index.js +0 -26
  79. package/FormableHOC-85f89a81.js +0 -83
  80. package/FormableMultiSelectDropdown/index.js +0 -50
  81. package/FormableNumberInput/index.js +0 -34
  82. package/FormableRadio/index.js +0 -22
  83. package/FormableSwitcher/index.js +0 -22
  84. package/FormableTextInput/index.js +0 -34
  85. package/FormableUploader/index.js +0 -44
  86. package/Grid/index.js +0 -167
  87. package/HelperText/index.js +0 -86
  88. package/Holder/index.js +0 -261
  89. package/Icon/index.js +0 -62
  90. package/Image/index.js +0 -45
  91. package/ImagePreview/index.js +0 -217
  92. package/Info/index.js +0 -41
  93. package/InfoOutline-dd2e89d9.js +0 -29
  94. package/InteractiveWidget/index.js +0 -78
  95. package/KeyValue/index.js +0 -22
  96. package/Label/index.js +0 -48
  97. package/LinkButton/index.js +0 -34
  98. package/Loader/index.js +0 -23
  99. package/Menu/index.js +0 -281
  100. package/MobileNavigation/index.js +0 -94
  101. package/MobilePopup/index.js +0 -182
  102. package/Modal/index.js +0 -251
  103. package/ModuleTitle/index.js +0 -141
  104. package/NavigationMenu/index.js +0 -222
  105. package/Notification/index.js +0 -120
  106. package/Option/index.js +0 -184
  107. package/Overlay/index.js +0 -187
  108. package/Overspread/index.js +0 -291
  109. package/Pagination/index.js +0 -261
  110. package/Paper/index.js +0 -96
  111. package/Pill/index.js +0 -67
  112. package/Popover/index.js +0 -725
  113. package/PopoverV2/index.js +0 -19
  114. package/Portal/index.js +0 -58
  115. package/Products/index.js +0 -115
  116. package/Profile/index.js +0 -589
  117. package/Progress/index.js +0 -200
  118. package/QRCode/index.js +0 -814
  119. package/Radio/index.js +0 -151
  120. package/RadioGroup/index.js +0 -104
  121. package/Range/index.js +0 -191
  122. package/Rating/index.js +0 -174
  123. package/RichEditor/index.js +0 -13
  124. package/RichEditor-78c2617e.js +0 -228
  125. package/Scrollbar/index.js +0 -1585
  126. package/Search/index.js +0 -75
  127. package/SearchWithDropdown/index.js +0 -140
  128. package/Section/index.js +0 -61
  129. package/SkeletonLoader/index.js +0 -81
  130. package/Slider/index.js +0 -261
  131. package/Status/index.js +0 -97
  132. package/Steps/index.js +0 -314
  133. package/SuggestionList/index.js +0 -385
  134. package/Switcher/index.js +0 -193
  135. package/Table/index.js +0 -57
  136. package/TableCompositions/index.js +0 -16995
  137. package/Tabs/index.js +0 -235
  138. package/Tag/index.js +0 -102
  139. package/TextLink/index.js +0 -20
  140. package/Textarea/index.js +0 -242
  141. package/Time/index.js +0 -62
  142. package/TimePicker/index.js +0 -575
  143. package/Timeline/index.js +0 -113
  144. package/Title/index.js +0 -65
  145. package/Toaster/index.js +0 -116
  146. package/Tooltip/index.js +0 -6
  147. package/TransferList/index.js +0 -493
  148. package/Uploader/index.js +0 -992
  149. package/ValidatableCheckbox/index.js +0 -123
  150. package/ValidatableDatePicker/index.js +0 -316
  151. package/ValidatableDropdown/index.js +0 -141
  152. package/ValidatableElements/index.js +0 -67
  153. package/ValidatableMultiSelectDropdown/index.js +0 -152
  154. package/ValidatableNumberInput/index.js +0 -204
  155. package/ValidatableRadio/index.js +0 -116
  156. package/ValidatableSwitcher/index.js +0 -93
  157. package/ValidatableTextInput/index.js +0 -167
  158. package/ValidatableTimeInput/index.js +0 -174
  159. package/ValidatableUploader/index.js +0 -98
  160. package/Widget/index.js +0 -225
  161. package/_commonjsHelpers-24198af3.js +0 -35
  162. package/_rollupPluginBabelHelpers-a83240e1.js +0 -11
  163. package/callAfterDelay-7272faca.js +0 -12
  164. package/checkTimeValidation-e56771be.js +0 -16
  165. package/checkboxRadioSwitcher-5b69d7bd.js +0 -4
  166. package/clsx.m-2bb6df4b.js +0 -3
  167. package/config-1053d64d.js +0 -20
  168. package/configs-00612ce0.js +0 -103
  169. package/configs.js +0 -111
  170. package/dateValidation-67caec66.js +0 -225
  171. package/debounce-4419bc2f.js +0 -17
  172. package/guid-8ddf77b3.js +0 -16
  173. package/hooks/useBodyScroll.js +0 -16
  174. package/hooks/useClick.js +0 -18
  175. package/hooks/useClickOutside.js +0 -25
  176. package/hooks/useDebounce.js +0 -28
  177. package/hooks/useDeviceType.js +0 -17
  178. package/hooks/useDidMount.js +0 -15
  179. package/hooks/useForceUpdate.js +0 -8
  180. package/hooks/useHover.js +0 -20
  181. package/hooks/useImgDownload.js +0 -18
  182. package/hooks/useKeyDown.js +0 -21
  183. package/hooks/useMount.js +0 -13
  184. package/hooks/useMutationObserver.js +0 -21
  185. package/hooks/usePrevious.js +0 -10
  186. package/hooks/useThrottle.js +0 -16
  187. package/hooks/useToggle.js +0 -11
  188. package/hooks/useUpdatableRef.js +0 -14
  189. package/hooks/useUpdate.js +0 -10
  190. package/hooks/useWidth.js +0 -16
  191. package/hooks/useWindowSize.js +0 -40
  192. package/index-122432cd.js +0 -270
  193. package/index-262edd7a.js +0 -77
  194. package/index-2f5aa51e.js +0 -6483
  195. package/index-370f9acd.js +0 -4
  196. package/index-45eafea6.js +0 -90
  197. package/index-480fd7d9.js +0 -10032
  198. package/index-5f37f281.js +0 -168
  199. package/index-73aaa093.js +0 -1940
  200. package/index.mobile.d.ts +0 -14
  201. package/lib/atoms/Avatar/index.d.ts +0 -1
  202. package/lib/atoms/Badge/Badge.d.ts +0 -36
  203. package/lib/atoms/Badge/index.d.ts +0 -1
  204. package/lib/atoms/BusyLoader/BusyLoader.d.ts +0 -32
  205. package/lib/atoms/BusyLoader/BusyLoaderHolderHOC.d.ts +0 -8
  206. package/lib/atoms/BusyLoader/index.d.ts +0 -1
  207. package/lib/atoms/Button/Button.d.ts +0 -70
  208. package/lib/atoms/Button/index.d.ts +0 -1
  209. package/lib/atoms/Divider/index.d.ts +0 -1
  210. package/lib/atoms/Empty/Empty.d.ts +0 -39
  211. package/lib/atoms/Empty/index.d.ts +0 -1
  212. package/lib/atoms/Empty/utils.d.ts +0 -9
  213. package/lib/atoms/HelperText/index.d.ts +0 -1
  214. package/lib/atoms/Image/Image.d.ts +0 -51
  215. package/lib/atoms/Image/index.d.ts +0 -1
  216. package/lib/atoms/ImagePreview/ImagePreview.d.ts +0 -56
  217. package/lib/atoms/ImagePreview/ImagePreviewHOC.d.ts +0 -4
  218. package/lib/atoms/ImagePreview/Magnifier.d.ts +0 -40
  219. package/lib/atoms/ImagePreview/index.d.ts +0 -1
  220. package/lib/atoms/Info/index.d.ts +0 -1
  221. package/lib/atoms/KeyValue/KeyValue.d.ts +0 -29
  222. package/lib/atoms/KeyValue/index.d.ts +0 -1
  223. package/lib/atoms/Label/index.d.ts +0 -1
  224. package/lib/atoms/LinkButton/LinkButton.d.ts +0 -46
  225. package/lib/atoms/LinkButton/index.d.ts +0 -1
  226. package/lib/atoms/Loader/index.d.ts +0 -1
  227. package/lib/atoms/Pill/index.d.ts +0 -1
  228. package/lib/atoms/Rating/DefaultSvg.d.ts +0 -3
  229. package/lib/atoms/Rating/Rating.d.ts +0 -49
  230. package/lib/atoms/Rating/index.d.ts +0 -1
  231. package/lib/atoms/TextLink/index.d.ts +0 -1
  232. package/lib/molecules/Copy/Copy.d.ts +0 -38
  233. package/lib/molecules/Copy/index.d.ts +0 -1
  234. package/lib/molecules/InteractiveWidget/InteractiveWidget.d.ts +0 -70
  235. package/lib/molecules/InteractiveWidget/InteractiveWidgetIcon.d.ts +0 -8
  236. package/lib/molecules/InteractiveWidget/index.d.ts +0 -1
  237. package/lib/molecules/Tooltip/index.d.ts +0 -1
  238. package/lib/providers/GeneUIProvider/GeneUIProvider.d.ts +0 -30
  239. package/lib/providers/GeneUIProvider/index.d.ts +0 -1
  240. package/localization-4ba17032.js +0 -46
  241. package/objectWithoutPropertiesLoose-e1596bdb.js +0 -62
  242. package/rangeAndSlider-693a3d41.js +0 -8684
  243. package/react-beautiful-dnd.esm-b637016a.js +0 -10116
  244. package/react-lifecycles-compat.es-6e1f3768.js +0 -158
  245. package/redux-e591c1b8.js +0 -536
  246. package/tokens-8ab1179c.js +0 -6
  247. package/tslib.es6-f211516f.js +0 -35
  248. package/useEllipsisDetection-c1c9ad94.js +0 -38
@@ -1,158 +0,0 @@
1
- /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- function componentWillMount() {
9
- // Call this.constructor.gDSFP to support sub-classes.
10
- var state = this.constructor.getDerivedStateFromProps(this.props, this.state);
11
- if (state !== null && state !== undefined) {
12
- this.setState(state);
13
- }
14
- }
15
-
16
- function componentWillReceiveProps(nextProps) {
17
- // Call this.constructor.gDSFP to support sub-classes.
18
- // Use the setState() updater to ensure state isn't stale in certain edge cases.
19
- function updater(prevState) {
20
- var state = this.constructor.getDerivedStateFromProps(nextProps, prevState);
21
- return state !== null && state !== undefined ? state : null;
22
- }
23
- // Binding "this" is important for shallow renderer support.
24
- this.setState(updater.bind(this));
25
- }
26
-
27
- function componentWillUpdate(nextProps, nextState) {
28
- try {
29
- var prevProps = this.props;
30
- var prevState = this.state;
31
- this.props = nextProps;
32
- this.state = nextState;
33
- this.__reactInternalSnapshotFlag = true;
34
- this.__reactInternalSnapshot = this.getSnapshotBeforeUpdate(
35
- prevProps,
36
- prevState
37
- );
38
- } finally {
39
- this.props = prevProps;
40
- this.state = prevState;
41
- }
42
- }
43
-
44
- // React may warn about cWM/cWRP/cWU methods being deprecated.
45
- // Add a flag to suppress these warnings for this special case.
46
- componentWillMount.__suppressDeprecationWarning = true;
47
- componentWillReceiveProps.__suppressDeprecationWarning = true;
48
- componentWillUpdate.__suppressDeprecationWarning = true;
49
-
50
- function polyfill(Component) {
51
- var prototype = Component.prototype;
52
-
53
- if (!prototype || !prototype.isReactComponent) {
54
- throw new Error('Can only polyfill class components');
55
- }
56
-
57
- if (
58
- typeof Component.getDerivedStateFromProps !== 'function' &&
59
- typeof prototype.getSnapshotBeforeUpdate !== 'function'
60
- ) {
61
- return Component;
62
- }
63
-
64
- // If new component APIs are defined, "unsafe" lifecycles won't be called.
65
- // Error if any of these lifecycles are present,
66
- // Because they would work differently between older and newer (16.3+) versions of React.
67
- var foundWillMountName = null;
68
- var foundWillReceivePropsName = null;
69
- var foundWillUpdateName = null;
70
- if (typeof prototype.componentWillMount === 'function') {
71
- foundWillMountName = 'componentWillMount';
72
- } else if (typeof prototype.UNSAFE_componentWillMount === 'function') {
73
- foundWillMountName = 'UNSAFE_componentWillMount';
74
- }
75
- if (typeof prototype.componentWillReceiveProps === 'function') {
76
- foundWillReceivePropsName = 'componentWillReceiveProps';
77
- } else if (typeof prototype.UNSAFE_componentWillReceiveProps === 'function') {
78
- foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps';
79
- }
80
- if (typeof prototype.componentWillUpdate === 'function') {
81
- foundWillUpdateName = 'componentWillUpdate';
82
- } else if (typeof prototype.UNSAFE_componentWillUpdate === 'function') {
83
- foundWillUpdateName = 'UNSAFE_componentWillUpdate';
84
- }
85
- if (
86
- foundWillMountName !== null ||
87
- foundWillReceivePropsName !== null ||
88
- foundWillUpdateName !== null
89
- ) {
90
- var componentName = Component.displayName || Component.name;
91
- var newApiName =
92
- typeof Component.getDerivedStateFromProps === 'function'
93
- ? 'getDerivedStateFromProps()'
94
- : 'getSnapshotBeforeUpdate()';
95
-
96
- throw Error(
97
- 'Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' +
98
- componentName +
99
- ' uses ' +
100
- newApiName +
101
- ' but also contains the following legacy lifecycles:' +
102
- (foundWillMountName !== null ? '\n ' + foundWillMountName : '') +
103
- (foundWillReceivePropsName !== null
104
- ? '\n ' + foundWillReceivePropsName
105
- : '') +
106
- (foundWillUpdateName !== null ? '\n ' + foundWillUpdateName : '') +
107
- '\n\nThe above lifecycles should be removed. Learn more about this warning here:\n' +
108
- 'https://fb.me/react-async-component-lifecycle-hooks'
109
- );
110
- }
111
-
112
- // React <= 16.2 does not support static getDerivedStateFromProps.
113
- // As a workaround, use cWM and cWRP to invoke the new static lifecycle.
114
- // Newer versions of React will ignore these lifecycles if gDSFP exists.
115
- if (typeof Component.getDerivedStateFromProps === 'function') {
116
- prototype.componentWillMount = componentWillMount;
117
- prototype.componentWillReceiveProps = componentWillReceiveProps;
118
- }
119
-
120
- // React <= 16.2 does not support getSnapshotBeforeUpdate.
121
- // As a workaround, use cWU to invoke the new lifecycle.
122
- // Newer versions of React will ignore that lifecycle if gSBU exists.
123
- if (typeof prototype.getSnapshotBeforeUpdate === 'function') {
124
- if (typeof prototype.componentDidUpdate !== 'function') {
125
- throw new Error(
126
- 'Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype'
127
- );
128
- }
129
-
130
- prototype.componentWillUpdate = componentWillUpdate;
131
-
132
- var componentDidUpdate = prototype.componentDidUpdate;
133
-
134
- prototype.componentDidUpdate = function componentDidUpdatePolyfill(
135
- prevProps,
136
- prevState,
137
- maybeSnapshot
138
- ) {
139
- // 16.3+ will not execute our will-update method;
140
- // It will pass a snapshot value to did-update though.
141
- // Older versions will require our polyfilled will-update value.
142
- // We need to handle both cases, but can't just check for the presence of "maybeSnapshot",
143
- // Because for <= 15.x versions this might be a "prevContext" object.
144
- // We also can't just check "__reactInternalSnapshot",
145
- // Because get-snapshot might return a falsy value.
146
- // So check for the explicit __reactInternalSnapshotFlag flag to determine behavior.
147
- var snapshot = this.__reactInternalSnapshotFlag
148
- ? this.__reactInternalSnapshot
149
- : maybeSnapshot;
150
-
151
- componentDidUpdate.call(this, prevProps, prevState, snapshot);
152
- };
153
- }
154
-
155
- return Component;
156
- }
157
-
158
- export { polyfill as p };
package/redux-e591c1b8.js DELETED
@@ -1,536 +0,0 @@
1
- import { _ as _defineProperty } from './objectWithoutPropertiesLoose-e1596bdb.js';
2
-
3
- function ownKeys(e, r) {
4
- var t = Object.keys(e);
5
- if (Object.getOwnPropertySymbols) {
6
- var o = Object.getOwnPropertySymbols(e);
7
- r && (o = o.filter(function (r) {
8
- return Object.getOwnPropertyDescriptor(e, r).enumerable;
9
- })), t.push.apply(t, o);
10
- }
11
- return t;
12
- }
13
- function _objectSpread2(e) {
14
- for (var r = 1; r < arguments.length; r++) {
15
- var t = null != arguments[r] ? arguments[r] : {};
16
- r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
17
- _defineProperty(e, r, t[r]);
18
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
19
- Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
20
- });
21
- }
22
- return e;
23
- }
24
-
25
- /**
26
- * Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js
27
- *
28
- * Do not require this module directly! Use normal throw error calls. These messages will be replaced with error codes
29
- * during build.
30
- * @param {number} code
31
- */
32
- function formatProdErrorMessage(code) {
33
- return "Minified Redux error #" + code + "; visit https://redux.js.org/Errors?code=" + code + " for the full message or " + 'use the non-minified dev environment for full errors. ';
34
- }
35
-
36
- // Inlined version of the `symbol-observable` polyfill
37
- var $$observable = (function () {
38
- return typeof Symbol === 'function' && Symbol.observable || '@@observable';
39
- })();
40
-
41
- /**
42
- * These are private action types reserved by Redux.
43
- * For any unknown actions, you must return the current state.
44
- * If the current state is undefined, you must return the initial state.
45
- * Do not reference these action types directly in your code.
46
- */
47
- var randomString = function randomString() {
48
- return Math.random().toString(36).substring(7).split('').join('.');
49
- };
50
-
51
- var ActionTypes = {
52
- INIT: "@@redux/INIT" + randomString(),
53
- REPLACE: "@@redux/REPLACE" + randomString(),
54
- PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
55
- return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
56
- }
57
- };
58
-
59
- /**
60
- * @param {any} obj The object to inspect.
61
- * @returns {boolean} True if the argument appears to be a plain object.
62
- */
63
- function isPlainObject(obj) {
64
- if (typeof obj !== 'object' || obj === null) return false;
65
- var proto = obj;
66
-
67
- while (Object.getPrototypeOf(proto) !== null) {
68
- proto = Object.getPrototypeOf(proto);
69
- }
70
-
71
- return Object.getPrototypeOf(obj) === proto;
72
- }
73
-
74
- // Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of
75
- function miniKindOf(val) {
76
- if (val === void 0) return 'undefined';
77
- if (val === null) return 'null';
78
- var type = typeof val;
79
-
80
- switch (type) {
81
- case 'boolean':
82
- case 'string':
83
- case 'number':
84
- case 'symbol':
85
- case 'function':
86
- {
87
- return type;
88
- }
89
- }
90
-
91
- if (Array.isArray(val)) return 'array';
92
- if (isDate(val)) return 'date';
93
- if (isError(val)) return 'error';
94
- var constructorName = ctorName(val);
95
-
96
- switch (constructorName) {
97
- case 'Symbol':
98
- case 'Promise':
99
- case 'WeakMap':
100
- case 'WeakSet':
101
- case 'Map':
102
- case 'Set':
103
- return constructorName;
104
- } // other
105
-
106
-
107
- return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
108
- }
109
-
110
- function ctorName(val) {
111
- return typeof val.constructor === 'function' ? val.constructor.name : null;
112
- }
113
-
114
- function isError(val) {
115
- return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number';
116
- }
117
-
118
- function isDate(val) {
119
- if (val instanceof Date) return true;
120
- return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function';
121
- }
122
-
123
- function kindOf(val) {
124
- var typeOfVal = typeof val;
125
-
126
- if (process.env.NODE_ENV !== 'production') {
127
- typeOfVal = miniKindOf(val);
128
- }
129
-
130
- return typeOfVal;
131
- }
132
-
133
- /**
134
- * @deprecated
135
- *
136
- * **We recommend using the `configureStore` method
137
- * of the `@reduxjs/toolkit` package**, which replaces `createStore`.
138
- *
139
- * Redux Toolkit is our recommended approach for writing Redux logic today,
140
- * including store setup, reducers, data fetching, and more.
141
- *
142
- * **For more details, please read this Redux docs page:**
143
- * **https://redux.js.org/introduction/why-rtk-is-redux-today**
144
- *
145
- * `configureStore` from Redux Toolkit is an improved version of `createStore` that
146
- * simplifies setup and helps avoid common bugs.
147
- *
148
- * You should not be using the `redux` core package by itself today, except for learning purposes.
149
- * The `createStore` method from the core `redux` package will not be removed, but we encourage
150
- * all users to migrate to using Redux Toolkit for all Redux code.
151
- *
152
- * If you want to use `createStore` without this visual deprecation warning, use
153
- * the `legacy_createStore` import instead:
154
- *
155
- * `import { legacy_createStore as createStore} from 'redux'`
156
- *
157
- */
158
-
159
- function createStore(reducer, preloadedState, enhancer) {
160
- var _ref2;
161
-
162
- if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {
163
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(0) : 'It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.');
164
- }
165
-
166
- if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
167
- enhancer = preloadedState;
168
- preloadedState = undefined;
169
- }
170
-
171
- if (typeof enhancer !== 'undefined') {
172
- if (typeof enhancer !== 'function') {
173
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(1) : "Expected the enhancer to be a function. Instead, received: '" + kindOf(enhancer) + "'");
174
- }
175
-
176
- return enhancer(createStore)(reducer, preloadedState);
177
- }
178
-
179
- if (typeof reducer !== 'function') {
180
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(2) : "Expected the root reducer to be a function. Instead, received: '" + kindOf(reducer) + "'");
181
- }
182
-
183
- var currentReducer = reducer;
184
- var currentState = preloadedState;
185
- var currentListeners = [];
186
- var nextListeners = currentListeners;
187
- var isDispatching = false;
188
- /**
189
- * This makes a shallow copy of currentListeners so we can use
190
- * nextListeners as a temporary list while dispatching.
191
- *
192
- * This prevents any bugs around consumers calling
193
- * subscribe/unsubscribe in the middle of a dispatch.
194
- */
195
-
196
- function ensureCanMutateNextListeners() {
197
- if (nextListeners === currentListeners) {
198
- nextListeners = currentListeners.slice();
199
- }
200
- }
201
- /**
202
- * Reads the state tree managed by the store.
203
- *
204
- * @returns {any} The current state tree of your application.
205
- */
206
-
207
-
208
- function getState() {
209
- if (isDispatching) {
210
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(3) : 'You may not call store.getState() while the reducer is executing. ' + 'The reducer has already received the state as an argument. ' + 'Pass it down from the top reducer instead of reading it from the store.');
211
- }
212
-
213
- return currentState;
214
- }
215
- /**
216
- * Adds a change listener. It will be called any time an action is dispatched,
217
- * and some part of the state tree may potentially have changed. You may then
218
- * call `getState()` to read the current state tree inside the callback.
219
- *
220
- * You may call `dispatch()` from a change listener, with the following
221
- * caveats:
222
- *
223
- * 1. The subscriptions are snapshotted just before every `dispatch()` call.
224
- * If you subscribe or unsubscribe while the listeners are being invoked, this
225
- * will not have any effect on the `dispatch()` that is currently in progress.
226
- * However, the next `dispatch()` call, whether nested or not, will use a more
227
- * recent snapshot of the subscription list.
228
- *
229
- * 2. The listener should not expect to see all state changes, as the state
230
- * might have been updated multiple times during a nested `dispatch()` before
231
- * the listener is called. It is, however, guaranteed that all subscribers
232
- * registered before the `dispatch()` started will be called with the latest
233
- * state by the time it exits.
234
- *
235
- * @param {Function} listener A callback to be invoked on every dispatch.
236
- * @returns {Function} A function to remove this change listener.
237
- */
238
-
239
-
240
- function subscribe(listener) {
241
- if (typeof listener !== 'function') {
242
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(4) : "Expected the listener to be a function. Instead, received: '" + kindOf(listener) + "'");
243
- }
244
-
245
- if (isDispatching) {
246
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(5) : 'You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api/store#subscribelistener for more details.');
247
- }
248
-
249
- var isSubscribed = true;
250
- ensureCanMutateNextListeners();
251
- nextListeners.push(listener);
252
- return function unsubscribe() {
253
- if (!isSubscribed) {
254
- return;
255
- }
256
-
257
- if (isDispatching) {
258
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(6) : 'You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api/store#subscribelistener for more details.');
259
- }
260
-
261
- isSubscribed = false;
262
- ensureCanMutateNextListeners();
263
- var index = nextListeners.indexOf(listener);
264
- nextListeners.splice(index, 1);
265
- currentListeners = null;
266
- };
267
- }
268
- /**
269
- * Dispatches an action. It is the only way to trigger a state change.
270
- *
271
- * The `reducer` function, used to create the store, will be called with the
272
- * current state tree and the given `action`. Its return value will
273
- * be considered the **next** state of the tree, and the change listeners
274
- * will be notified.
275
- *
276
- * The base implementation only supports plain object actions. If you want to
277
- * dispatch a Promise, an Observable, a thunk, or something else, you need to
278
- * wrap your store creating function into the corresponding middleware. For
279
- * example, see the documentation for the `redux-thunk` package. Even the
280
- * middleware will eventually dispatch plain object actions using this method.
281
- *
282
- * @param {Object} action A plain object representing “what changed”. It is
283
- * a good idea to keep actions serializable so you can record and replay user
284
- * sessions, or use the time travelling `redux-devtools`. An action must have
285
- * a `type` property which may not be `undefined`. It is a good idea to use
286
- * string constants for action types.
287
- *
288
- * @returns {Object} For convenience, the same action object you dispatched.
289
- *
290
- * Note that, if you use a custom middleware, it may wrap `dispatch()` to
291
- * return something else (for example, a Promise you can await).
292
- */
293
-
294
-
295
- function dispatch(action) {
296
- if (!isPlainObject(action)) {
297
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(7) : "Actions must be plain objects. Instead, the actual type was: '" + kindOf(action) + "'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");
298
- }
299
-
300
- if (typeof action.type === 'undefined') {
301
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(8) : 'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');
302
- }
303
-
304
- if (isDispatching) {
305
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(9) : 'Reducers may not dispatch actions.');
306
- }
307
-
308
- try {
309
- isDispatching = true;
310
- currentState = currentReducer(currentState, action);
311
- } finally {
312
- isDispatching = false;
313
- }
314
-
315
- var listeners = currentListeners = nextListeners;
316
-
317
- for (var i = 0; i < listeners.length; i++) {
318
- var listener = listeners[i];
319
- listener();
320
- }
321
-
322
- return action;
323
- }
324
- /**
325
- * Replaces the reducer currently used by the store to calculate the state.
326
- *
327
- * You might need this if your app implements code splitting and you want to
328
- * load some of the reducers dynamically. You might also need this if you
329
- * implement a hot reloading mechanism for Redux.
330
- *
331
- * @param {Function} nextReducer The reducer for the store to use instead.
332
- * @returns {void}
333
- */
334
-
335
-
336
- function replaceReducer(nextReducer) {
337
- if (typeof nextReducer !== 'function') {
338
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(10) : "Expected the nextReducer to be a function. Instead, received: '" + kindOf(nextReducer));
339
- }
340
-
341
- currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT.
342
- // Any reducers that existed in both the new and old rootReducer
343
- // will receive the previous state. This effectively populates
344
- // the new state tree with any relevant data from the old one.
345
-
346
- dispatch({
347
- type: ActionTypes.REPLACE
348
- });
349
- }
350
- /**
351
- * Interoperability point for observable/reactive libraries.
352
- * @returns {observable} A minimal observable of state changes.
353
- * For more information, see the observable proposal:
354
- * https://github.com/tc39/proposal-observable
355
- */
356
-
357
-
358
- function observable() {
359
- var _ref;
360
-
361
- var outerSubscribe = subscribe;
362
- return _ref = {
363
- /**
364
- * The minimal observable subscription method.
365
- * @param {Object} observer Any object that can be used as an observer.
366
- * The observer object should have a `next` method.
367
- * @returns {subscription} An object with an `unsubscribe` method that can
368
- * be used to unsubscribe the observable from the store, and prevent further
369
- * emission of values from the observable.
370
- */
371
- subscribe: function subscribe(observer) {
372
- if (typeof observer !== 'object' || observer === null) {
373
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(11) : "Expected the observer to be an object. Instead, received: '" + kindOf(observer) + "'");
374
- }
375
-
376
- function observeState() {
377
- if (observer.next) {
378
- observer.next(getState());
379
- }
380
- }
381
-
382
- observeState();
383
- var unsubscribe = outerSubscribe(observeState);
384
- return {
385
- unsubscribe: unsubscribe
386
- };
387
- }
388
- }, _ref[$$observable] = function () {
389
- return this;
390
- }, _ref;
391
- } // When a store is created, an "INIT" action is dispatched so that every
392
- // reducer returns their initial state. This effectively populates
393
- // the initial state tree.
394
-
395
-
396
- dispatch({
397
- type: ActionTypes.INIT
398
- });
399
- return _ref2 = {
400
- dispatch: dispatch,
401
- subscribe: subscribe,
402
- getState: getState,
403
- replaceReducer: replaceReducer
404
- }, _ref2[$$observable] = observable, _ref2;
405
- }
406
-
407
- function bindActionCreator(actionCreator, dispatch) {
408
- return function () {
409
- return dispatch(actionCreator.apply(this, arguments));
410
- };
411
- }
412
- /**
413
- * Turns an object whose values are action creators, into an object with the
414
- * same keys, but with every function wrapped into a `dispatch` call so they
415
- * may be invoked directly. This is just a convenience method, as you can call
416
- * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.
417
- *
418
- * For convenience, you can also pass an action creator as the first argument,
419
- * and get a dispatch wrapped function in return.
420
- *
421
- * @param {Function|Object} actionCreators An object whose values are action
422
- * creator functions. One handy way to obtain it is to use ES6 `import * as`
423
- * syntax. You may also pass a single function.
424
- *
425
- * @param {Function} dispatch The `dispatch` function available on your Redux
426
- * store.
427
- *
428
- * @returns {Function|Object} The object mimicking the original object, but with
429
- * every action creator wrapped into the `dispatch` call. If you passed a
430
- * function as `actionCreators`, the return value will also be a single
431
- * function.
432
- */
433
-
434
-
435
- function bindActionCreators(actionCreators, dispatch) {
436
- if (typeof actionCreators === 'function') {
437
- return bindActionCreator(actionCreators, dispatch);
438
- }
439
-
440
- if (typeof actionCreators !== 'object' || actionCreators === null) {
441
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(16) : "bindActionCreators expected an object or a function, but instead received: '" + kindOf(actionCreators) + "'. " + "Did you write \"import ActionCreators from\" instead of \"import * as ActionCreators from\"?");
442
- }
443
-
444
- var boundActionCreators = {};
445
-
446
- for (var key in actionCreators) {
447
- var actionCreator = actionCreators[key];
448
-
449
- if (typeof actionCreator === 'function') {
450
- boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);
451
- }
452
- }
453
-
454
- return boundActionCreators;
455
- }
456
-
457
- /**
458
- * Composes single-argument functions from right to left. The rightmost
459
- * function can take multiple arguments as it provides the signature for
460
- * the resulting composite function.
461
- *
462
- * @param {...Function} funcs The functions to compose.
463
- * @returns {Function} A function obtained by composing the argument functions
464
- * from right to left. For example, compose(f, g, h) is identical to doing
465
- * (...args) => f(g(h(...args))).
466
- */
467
- function compose() {
468
- for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
469
- funcs[_key] = arguments[_key];
470
- }
471
-
472
- if (funcs.length === 0) {
473
- return function (arg) {
474
- return arg;
475
- };
476
- }
477
-
478
- if (funcs.length === 1) {
479
- return funcs[0];
480
- }
481
-
482
- return funcs.reduce(function (a, b) {
483
- return function () {
484
- return a(b.apply(void 0, arguments));
485
- };
486
- });
487
- }
488
-
489
- /**
490
- * Creates a store enhancer that applies middleware to the dispatch method
491
- * of the Redux store. This is handy for a variety of tasks, such as expressing
492
- * asynchronous actions in a concise manner, or logging every action payload.
493
- *
494
- * See `redux-thunk` package as an example of the Redux middleware.
495
- *
496
- * Because middleware is potentially asynchronous, this should be the first
497
- * store enhancer in the composition chain.
498
- *
499
- * Note that each middleware will be given the `dispatch` and `getState` functions
500
- * as named arguments.
501
- *
502
- * @param {...Function} middlewares The middleware chain to be applied.
503
- * @returns {Function} A store enhancer applying the middleware.
504
- */
505
-
506
- function applyMiddleware() {
507
- for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {
508
- middlewares[_key] = arguments[_key];
509
- }
510
-
511
- return function (createStore) {
512
- return function () {
513
- var store = createStore.apply(void 0, arguments);
514
-
515
- var _dispatch = function dispatch() {
516
- throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(15) : 'Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.');
517
- };
518
-
519
- var middlewareAPI = {
520
- getState: store.getState,
521
- dispatch: function dispatch() {
522
- return _dispatch.apply(void 0, arguments);
523
- }
524
- };
525
- var chain = middlewares.map(function (middleware) {
526
- return middleware(middlewareAPI);
527
- });
528
- _dispatch = compose.apply(void 0, chain)(store.dispatch);
529
- return _objectSpread2(_objectSpread2({}, store), {}, {
530
- dispatch: _dispatch
531
- });
532
- };
533
- };
534
- }
535
-
536
- export { createStore as a, bindActionCreators as b, compose as c, applyMiddleware as d };