@jetbrains/ring-ui 5.0.36 → 5.0.38

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 (239) hide show
  1. package/components/editable-heading/editable-heading.d.ts +4 -2
  2. package/components/editable-heading/editable-heading.js +3 -3
  3. package/components/input/input.css +2 -0
  4. package/components/query-assist/query-assist.js +1 -1
  5. package/dist/_helpers/_rollupPluginBabelHelpers.js +0 -4
  6. package/dist/_helpers/anchor.js +0 -1
  7. package/dist/_helpers/card.js +0 -3
  8. package/dist/_helpers/dialog__body-scroll-preventer.js +0 -11
  9. package/dist/_helpers/footer.js +2 -13
  10. package/dist/_helpers/query-assist__suggestions.js +0 -10
  11. package/dist/_helpers/select__filter.js +0 -11
  12. package/dist/_helpers/services-link.js +0 -2
  13. package/dist/_helpers/sidebar.js +0 -12
  14. package/dist/_helpers/theme.js +0 -3
  15. package/dist/_helpers/title.js +0 -9
  16. package/dist/alert/alert.js +2 -32
  17. package/dist/alert/container.js +0 -5
  18. package/dist/alert-service/alert-service.js +0 -26
  19. package/dist/analytics/analytics.js +0 -22
  20. package/dist/analytics/analytics__custom-plugin.js +0 -38
  21. package/dist/analytics/analytics__fus-plugin.js +0 -20
  22. package/dist/analytics/analytics__ga-plugin.js +0 -13
  23. package/dist/analytics/analytics__plugin-utils.js +0 -8
  24. package/dist/analytics-ng/analytics-ng.js +3 -9
  25. package/dist/auth/auth.js +2 -3
  26. package/dist/auth/auth__core.js +30 -243
  27. package/dist/auth/background-flow.js +2 -25
  28. package/dist/auth/down-notification.js +0 -7
  29. package/dist/auth/iframe-flow.js +2 -26
  30. package/dist/auth/landing.js +2 -6
  31. package/dist/auth/request-builder.js +0 -11
  32. package/dist/auth/response-parser.js +4 -26
  33. package/dist/auth/storage.js +4 -60
  34. package/dist/auth/token-validator.js +6 -42
  35. package/dist/auth/window-flow.js +2 -34
  36. package/dist/auth-dialog/auth-dialog.js +2 -12
  37. package/dist/auth-dialog-service/auth-dialog-service.js +2 -4
  38. package/dist/auth-ng/auth-ng.js +6 -22
  39. package/dist/auth-ng/auth-ng.mock.js +0 -4
  40. package/dist/autofocus-ng/autofocus-ng.js +0 -5
  41. package/dist/avatar/avatar.js +4 -17
  42. package/dist/avatar/fallback-avatar.js +2 -9
  43. package/dist/avatar-editor-ng/avatar-editor-ng.js +1 -17
  44. package/dist/badge/badge.js +0 -3
  45. package/dist/button/button.js +0 -8
  46. package/dist/button-group/button-group.js +0 -3
  47. package/dist/button-group/caption.js +0 -2
  48. package/dist/button-group-ng/button-group-ng.js +0 -4
  49. package/dist/button-ng/button-ng.js +3 -21
  50. package/dist/button-set/button-set.js +0 -3
  51. package/dist/button-set-ng/button-set-ng.js +0 -2
  52. package/dist/button-toolbar/button-toolbar.js +0 -3
  53. package/dist/button-toolbar-ng/button-toolbar-ng.js +0 -2
  54. package/dist/caret/caret.js +2 -53
  55. package/dist/checkbox/checkbox.js +0 -12
  56. package/dist/code/code.js +3 -25
  57. package/dist/compiler-ng/compiler-ng.js +0 -5
  58. package/dist/confirm/confirm.js +0 -6
  59. package/dist/confirm-service/confirm-service.js +10 -8
  60. package/dist/content-layout/content-layout.js +0 -7
  61. package/dist/contenteditable/contenteditable.js +6 -13
  62. package/dist/data-list/data-list.js +4 -28
  63. package/dist/data-list/item.js +0 -15
  64. package/dist/data-list/selection.js +0 -27
  65. package/dist/date-picker/consts.js +0 -7
  66. package/dist/date-picker/date-input.js +0 -20
  67. package/dist/date-picker/date-picker.js +2 -36
  68. package/dist/date-picker/date-popup.js +18 -71
  69. package/dist/date-picker/day.js +0 -14
  70. package/dist/date-picker/month-names.js +0 -9
  71. package/dist/date-picker/month-slider.js +0 -10
  72. package/dist/date-picker/month.js +2 -4
  73. package/dist/date-picker/months.js +6 -13
  74. package/dist/date-picker/years.js +0 -14
  75. package/dist/dialog/dialog.js +0 -19
  76. package/dist/dialog-ng/dialog-ng.js +17 -105
  77. package/dist/docked-panel-ng/docked-panel-ng.js +6 -29
  78. package/dist/dropdown/dropdown.js +2 -33
  79. package/dist/dropdown-menu/dropdown-menu.js +4 -8
  80. package/dist/editable-heading/editable-heading.d.ts +4 -2
  81. package/dist/editable-heading/editable-heading.js +7 -6
  82. package/dist/error-bubble/error-bubble.js +2 -4
  83. package/dist/error-message/error-message.js +0 -3
  84. package/dist/footer-ng/footer-ng.js +0 -13
  85. package/dist/form-ng/form-ng.js +1 -21
  86. package/dist/global/angular-component-factory.js +0 -10
  87. package/dist/global/compose.js +0 -1
  88. package/dist/global/composeRefs.js +0 -1
  89. package/dist/global/controls-height.js +0 -2
  90. package/dist/global/create-stateful-context.js +0 -5
  91. package/dist/global/data-tests.js +0 -4
  92. package/dist/global/dom.js +2 -11
  93. package/dist/global/focus-sensor-hoc.js +4 -33
  94. package/dist/global/fuzzy-highlight.js +2 -16
  95. package/dist/global/get-event-key.js +8 -17
  96. package/dist/global/get-uid.js +0 -2
  97. package/dist/global/linear-function.js +0 -2
  98. package/dist/global/listeners.js +0 -13
  99. package/dist/global/memoize.js +0 -2
  100. package/dist/global/normalize-indent.js +2 -5
  101. package/dist/global/react-dom-renderer.js +0 -8
  102. package/dist/global/react-render-adapter.js +0 -7
  103. package/dist/global/rerender-hoc.js +0 -7
  104. package/dist/global/ring-angular-component.js +0 -5
  105. package/dist/global/schedule-raf.js +0 -5
  106. package/dist/global/trivial-template-tag.js +2 -3
  107. package/dist/global/url.js +0 -27
  108. package/dist/grid/col.js +0 -4
  109. package/dist/grid/grid.js +0 -3
  110. package/dist/grid/row.js +0 -5
  111. package/dist/group/group.js +0 -3
  112. package/dist/header/header.js +0 -5
  113. package/dist/header/logo.js +0 -4
  114. package/dist/header/profile.js +0 -7
  115. package/dist/header/services.js +0 -11
  116. package/dist/header/smart-profile.js +4 -18
  117. package/dist/header/smart-services.js +0 -17
  118. package/dist/header/tray-icon.js +2 -3
  119. package/dist/header/tray.js +0 -3
  120. package/dist/heading/heading.js +0 -5
  121. package/dist/http/http.js +20 -65
  122. package/dist/http/http.mock.js +2 -14
  123. package/dist/hub-source/hub-source.js +0 -32
  124. package/dist/hub-source/hub-source__user.js +0 -1
  125. package/dist/hub-source/hub-source__users-groups.js +0 -12
  126. package/dist/icon/icon.js +0 -13
  127. package/dist/icon/icon__constants.js +0 -4
  128. package/dist/icon/icon__svg.js +0 -10
  129. package/dist/icon-ng/icon-ng.js +2 -7
  130. package/dist/input/input.js +0 -30
  131. package/dist/input-ng/input-ng.js +0 -17
  132. package/dist/island/adaptive-island-hoc.js +0 -7
  133. package/dist/island/content.js +0 -25
  134. package/dist/island/header.js +0 -7
  135. package/dist/island/island.js +0 -4
  136. package/dist/island-legacy/content-legacy.js +0 -2
  137. package/dist/island-legacy/header-legacy.js +0 -2
  138. package/dist/island-legacy/island-legacy.js +0 -2
  139. package/dist/island-ng/island-content-ng.js +0 -3
  140. package/dist/link/clickableLink.js +2 -10
  141. package/dist/link/link.js +2 -9
  142. package/dist/link-ng/link-ng.js +0 -2
  143. package/dist/list/consts.js +0 -4
  144. package/dist/list/list.js +6 -128
  145. package/dist/list/list__custom.js +0 -4
  146. package/dist/list/list__hint.js +0 -3
  147. package/dist/list/list__item.js +0 -8
  148. package/dist/list/list__link.js +2 -3
  149. package/dist/list/list__separator.js +0 -1
  150. package/dist/list/list__title.js +0 -1
  151. package/dist/list/list__users-groups-source.js +4 -17
  152. package/dist/loader/loader.js +0 -10
  153. package/dist/loader/loader__core.js +6 -70
  154. package/dist/loader-inline/loader-inline.js +0 -3
  155. package/dist/loader-ng/loader-ng.js +0 -7
  156. package/dist/loader-screen/loader-screen.js +0 -3
  157. package/dist/loader-screen-ng/loader-screen-ng.js +2 -14
  158. package/dist/login-dialog/login-dialog.js +0 -15
  159. package/dist/login-dialog/service.js +2 -4
  160. package/dist/markdown/code.js +0 -2
  161. package/dist/markdown/heading.js +0 -1
  162. package/dist/markdown/link.js +0 -1
  163. package/dist/markdown/markdown.js +0 -2
  164. package/dist/message/message.js +0 -24
  165. package/dist/message-bundle-ng/message-bundle-ng.js +2 -45
  166. package/dist/old-browsers-message/old-browsers-message.js +2 -21
  167. package/dist/old-browsers-message/white-list.js +2 -6
  168. package/dist/pager/pager.js +2 -39
  169. package/dist/panel/panel.js +0 -3
  170. package/dist/permissions/permissions.js +1 -43
  171. package/dist/permissions/permissions__cache.js +12 -63
  172. package/dist/permissions-ng/permissions-ng.js +11 -19
  173. package/dist/place-under-ng/place-under-ng.js +0 -19
  174. package/dist/popup/popup.consts.js +0 -11
  175. package/dist/popup/popup.js +6 -68
  176. package/dist/popup/position.js +8 -30
  177. package/dist/popup-menu/popup-menu.js +4 -13
  178. package/dist/progress-bar/progress-bar.js +0 -14
  179. package/dist/promised-click-ng/promised-click-ng.js +3 -22
  180. package/dist/query-assist/query-assist.js +17 -201
  181. package/dist/radio/radio.js +0 -6
  182. package/dist/radio/radio__item.js +0 -9
  183. package/dist/radio-ng/radio-ng.js +0 -4
  184. package/dist/save-field-ng/save-field-ng.js +1 -37
  185. package/dist/select/select.js +18 -208
  186. package/dist/select/select__popup.js +4 -76
  187. package/dist/select-ng/select-ng.js +18 -74
  188. package/dist/select-ng/select-ng__lazy.js +2 -17
  189. package/dist/select-ng/select-ng__options.js +3 -29
  190. package/dist/shortcuts/core.js +4 -56
  191. package/dist/shortcuts/shortcuts-hoc.js +0 -4
  192. package/dist/shortcuts/shortcuts.js +0 -10
  193. package/dist/shortcuts-hint-ng/shortcuts-hint-ng.js +0 -13
  194. package/dist/shortcuts-ng/shortcuts-ng.js +16 -46
  195. package/dist/sidebar-ng/sidebar-ng.js +2 -12
  196. package/dist/storage/storage.js +2 -5
  197. package/dist/storage/storage__fallback.js +2 -48
  198. package/dist/storage/storage__local.js +0 -23
  199. package/dist/style.css +1 -1
  200. package/dist/tab-trap/tab-trap.js +0 -37
  201. package/dist/table/cell.js +0 -2
  202. package/dist/table/disable-hover-hoc.js +0 -9
  203. package/dist/table/header-cell.js +0 -8
  204. package/dist/table/header.js +0 -16
  205. package/dist/table/multitable.js +0 -23
  206. package/dist/table/row-with-focus-sensor.js +0 -12
  207. package/dist/table/row.js +0 -18
  208. package/dist/table/selection-adapter.js +0 -2
  209. package/dist/table/selection-shortcuts-hoc.js +8 -42
  210. package/dist/table/selection.js +0 -50
  211. package/dist/table/smart-table.js +0 -9
  212. package/dist/table/table.js +6 -37
  213. package/dist/table-legacy-ng/table-legacy-ng.js +12 -42
  214. package/dist/table-legacy-ng/table-legacy-ng__selection-navigate-actions.js +0 -31
  215. package/dist/table-legacy-ng/table-legacy-ng__selection.js +0 -32
  216. package/dist/table-legacy-ng/table-legacy-ng__toolbar.js +2 -5
  217. package/dist/tabs/collapsible-more.js +0 -5
  218. package/dist/tabs/collapsible-tab.js +0 -4
  219. package/dist/tabs/collapsible-tabs.js +8 -28
  220. package/dist/tabs/dumb-tabs.js +0 -8
  221. package/dist/tabs/smart-tabs.js +0 -6
  222. package/dist/tabs/tab-link.js +0 -1
  223. package/dist/tabs/tab.js +0 -2
  224. package/dist/tabs-ng/tabs-ng.js +13 -29
  225. package/dist/tag/tag.js +0 -24
  226. package/dist/tags-input/tags-input.js +0 -76
  227. package/dist/tags-list/tags-list.js +0 -6
  228. package/dist/template-ng/template-ng.js +0 -12
  229. package/dist/text/text.js +0 -3
  230. package/dist/theme-ng/theme-ng.js +0 -8
  231. package/dist/title-ng/title-ng.js +6 -17
  232. package/dist/toggle/toggle.js +0 -4
  233. package/dist/tooltip/tooltip.js +4 -35
  234. package/dist/tooltip-ng/tooltip-ng.js +2 -8
  235. package/dist/user-agreement/service.js +0 -62
  236. package/dist/user-agreement/user-agreement.js +0 -8
  237. package/dist/user-card/smart-user-card-tooltip.js +2 -8
  238. package/dist/user-card/tooltip.js +0 -3
  239. package/package.json +37 -37
@@ -26,21 +26,16 @@ var modules_5b0fb3e8 = {"unit":"8px","footer-height":"64px","breakpoint-small":"
26
26
  * @constructor
27
27
  * @extends {ReactComponent}
28
28
  */
29
-
30
29
  const RING_UNIT = 8;
31
30
  const DEFAULT_PADDING = 16;
32
31
  const CHECKBOX_WIDTH = 28;
33
32
  class ListItem extends PureComponent {
34
33
  constructor() {
35
34
  super(...arguments);
36
-
37
35
  _defineProperty(this, "id", getUID('list-item-'));
38
-
39
36
  _defineProperty(this, "stopBubbling", e => e.stopPropagation());
40
-
41
37
  _defineProperty(this, "_isString", val => typeof val === 'string' || val instanceof String);
42
38
  }
43
-
44
39
  render() {
45
40
  const {
46
41
  scrolling,
@@ -91,7 +86,6 @@ class ListItem extends PureComponent {
91
86
  paddingLeft: `${(Number(level) || 0) * RING_UNIT + DEFAULT_PADDING + (showCheckbox ? CHECKBOX_WIDTH : 0)}px`
92
87
  };
93
88
  let computedTitle = null;
94
-
95
89
  if (this._isString(title)) {
96
90
  // if title is specified and is a string then use it
97
91
  computedTitle = title;
@@ -100,7 +94,6 @@ class ListItem extends PureComponent {
100
94
  // label can also be an element, use empty string in this case
101
95
  computedTitle = this._isString(label) ? label : '';
102
96
  }
103
-
104
97
  const dataTest = joinDataTestAttributes({
105
98
  'ring-list-item': (restProps['data-test'] || '').indexOf('ring-list-item') === -1,
106
99
  'ring-list-item-action': !disabled,
@@ -166,7 +159,6 @@ class ListItem extends PureComponent {
166
159
  className: detailsClasses
167
160
  }, details)));
168
161
  }
169
-
170
162
  }
171
163
  ListItem.propTypes = {
172
164
  scrolling: PropTypes.bool,
@@ -14,7 +14,6 @@ import '../_helpers/link.js';
14
14
  * @constructor
15
15
  * @extends {ReactComponent}
16
16
  */
17
-
18
17
  class ListLink extends PureComponent {
19
18
  render() {
20
19
  const {
@@ -48,9 +47,9 @@ class ListLink extends PureComponent {
48
47
  "data-test": joinDataTestAttributes('ring-list-link', dataTest)
49
48
  }), label !== null && label !== void 0 ? label : children);
50
49
  }
51
-
52
50
  }
53
- ListLink.propTypes = { ...Link.propTypes,
51
+ ListLink.propTypes = {
52
+ ...Link.propTypes,
54
53
  description: PropTypes.string,
55
54
  label: PropTypes.oneOfType([PropTypes.element, PropTypes.string, PropTypes.func]),
56
55
  rgItemType: PropTypes.number,
@@ -17,7 +17,6 @@ class ListSeparator extends PureComponent {
17
17
  className: classes
18
18
  }, description);
19
19
  }
20
-
21
20
  }
22
21
  ListSeparator.propTypes = {
23
22
  className: PropTypes.string,
@@ -25,7 +25,6 @@ class ListTitle extends PureComponent {
25
25
  "data-test": "ring-list-title-description"
26
26
  }, description));
27
27
  }
28
-
29
28
  }
30
29
  ListTitle.propTypes = {
31
30
  className: PropTypes.string,
@@ -60,35 +60,27 @@ const defaultOptions = {
60
60
  }
61
61
  };
62
62
  var Filter;
63
-
64
63
  (function (Filter) {
65
64
  Filter[Filter["ALL"] = 0] = "ALL";
66
65
  Filter[Filter["USERS"] = 1] = "USERS";
67
66
  Filter[Filter["GROUPS"] = 2] = "GROUPS";
68
67
  })(Filter || (Filter = {}));
69
-
70
68
  class ListUsersGroupsSource extends HubSourceUsersGroups {
71
69
  constructor(auth, options) {
72
70
  super(auth, options);
73
-
74
71
  _defineProperty(this, "listSourceOptions", void 0);
75
-
76
72
  this.listSourceOptions = Object.assign({}, defaultOptions, options);
77
73
  }
78
-
79
74
  getGroupsSectionTitle(groups) {
80
75
  return groups.length ? this.listSourceOptions.GroupsTitle : this.listSourceOptions.NoGroupsTitle;
81
76
  }
82
-
83
77
  getUsersSectionTitle(users) {
84
78
  return users.length ? this.listSourceOptions.UsersTitle : this.listSourceOptions.NoUsersTitle;
85
79
  }
86
-
87
80
  async getForList(query) {
88
81
  let filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Filter.ALL;
89
82
  const [users, groups] = await this.getUserAndGroups(query);
90
83
  const items = [];
91
-
92
84
  if (filter === Filter.ALL) {
93
85
  items.push({
94
86
  rgItemType: List.ListProps.Type.SEPARATOR,
@@ -96,12 +88,11 @@ class ListUsersGroupsSource extends HubSourceUsersGroups {
96
88
  description: this.getUsersSectionTitle(users)
97
89
  });
98
90
  }
99
-
100
91
  if (filter !== Filter.GROUPS) {
101
92
  users.forEach(user => {
102
93
  var _user$profile$avatar;
103
-
104
- return items.push({ ...user,
94
+ return items.push({
95
+ ...user,
105
96
  key: user.id,
106
97
  label: user.name,
107
98
  avatar: user.profile ? (_user$profile$avatar = user.profile.avatar) === null || _user$profile$avatar === void 0 ? void 0 : _user$profile$avatar.url : null,
@@ -109,7 +100,6 @@ class ListUsersGroupsSource extends HubSourceUsersGroups {
109
100
  });
110
101
  });
111
102
  }
112
-
113
103
  if (filter === Filter.ALL) {
114
104
  items.push({
115
105
  rgItemType: List.ListProps.Type.SEPARATOR,
@@ -117,9 +107,9 @@ class ListUsersGroupsSource extends HubSourceUsersGroups {
117
107
  description: this.getGroupsSectionTitle(groups)
118
108
  });
119
109
  }
120
-
121
110
  if (filter !== Filter.USERS) {
122
- groups.forEach(group => items.push({ ...group,
111
+ groups.forEach(group => items.push({
112
+ ...group,
123
113
  key: group.id,
124
114
  label: group.name,
125
115
  avatar: group.iconUrl,
@@ -127,12 +117,9 @@ class ListUsersGroupsSource extends HubSourceUsersGroups {
127
117
  description: this.listSourceOptions.getPluralForUserCount(group.userCount)
128
118
  }));
129
119
  }
130
-
131
120
  return items;
132
121
  }
133
-
134
122
  }
135
-
136
123
  _defineProperty(ListUsersGroupsSource, "Filter", Filter);
137
124
 
138
125
  export { ListUsersGroupsSource as default };
@@ -8,24 +8,19 @@ import '../global/dom.js';
8
8
  /**
9
9
  * @name Loader
10
10
  */
11
-
12
11
  /**
13
12
  * Displays a large animated loader with an optional caption. Typical use cases: page loading animation, major action animation.
14
13
  */
15
-
16
14
  class Loader extends PureComponent {
17
15
  constructor() {
18
16
  super(...arguments);
19
-
20
17
  _defineProperty(this, "loader", void 0);
21
-
22
18
  _defineProperty(this, "initLoader", el => {
23
19
  if (el) {
24
20
  this.loader = new LoaderCore(el, this.props);
25
21
  }
26
22
  });
27
23
  }
28
-
29
24
  componentDidUpdate(prevProps) {
30
25
  if (this.loader) {
31
26
  if (!prevProps.stop && this.props.stop) {
@@ -35,13 +30,10 @@ class Loader extends PureComponent {
35
30
  }
36
31
  }
37
32
  }
38
-
39
33
  componentWillUnmount() {
40
34
  var _this$loader;
41
-
42
35
  (_this$loader = this.loader) === null || _this$loader === void 0 ? void 0 : _this$loader.destroy();
43
36
  }
44
-
45
37
  render() {
46
38
  const {
47
39
  message,
@@ -58,9 +50,7 @@ class Loader extends PureComponent {
58
50
  ref: this.initLoader
59
51
  }));
60
52
  }
61
-
62
53
  }
63
-
64
54
  _defineProperty(Loader, "propTypes", {
65
55
  className: PropTypes.string,
66
56
  size: PropTypes.number,
@@ -4,7 +4,6 @@ import { getPixelRatio } from '../global/dom.js';
4
4
  var modules_00b5ad26 = {"unit":"8px","canvas":"canvas_rui_47a4","animate":"animate_rui_47a4","rotation-keyframes":"rotation-keyframes_rui_47a4","text":"text_rui_47a4"};
5
5
 
6
6
  const INITIAL_TICKS = 100;
7
-
8
7
  class Particle {
9
8
  constructor(_ref) {
10
9
  let {
@@ -13,19 +12,12 @@ class Particle {
13
12
  radius,
14
13
  color
15
14
  } = _ref;
16
-
17
15
  _defineProperty(this, "radius", void 0);
18
-
19
16
  _defineProperty(this, "x", void 0);
20
-
21
17
  _defineProperty(this, "y", void 0);
22
-
23
18
  _defineProperty(this, "color", void 0);
24
-
25
19
  _defineProperty(this, "decay", void 0);
26
-
27
20
  _defineProperty(this, "life", void 0);
28
-
29
21
  this.radius = radius;
30
22
  this.x = x;
31
23
  this.y = y;
@@ -33,15 +25,12 @@ class Particle {
33
25
  this.decay = 0.01;
34
26
  this.life = 1;
35
27
  }
36
-
37
28
  step() {
38
29
  this.life -= this.decay;
39
30
  }
40
-
41
31
  isAlive() {
42
32
  return this.life >= 0;
43
33
  }
44
-
45
34
  draw(ctx) {
46
35
  const alpha = this.life >= 0 ? this.life : 0;
47
36
  ctx.fillStyle = `rgba(${this.color.r}, ${this.color.g}, ${this.color.b}, ${alpha})`;
@@ -49,69 +38,42 @@ class Particle {
49
38
  ctx.arc(this.x + this.radius, this.y + this.radius, this.radius, 0, Math.PI * 2);
50
39
  ctx.fill();
51
40
  }
52
-
53
41
  }
54
-
55
42
  const DETERMINISTIC_VALUE = 0.5;
56
-
57
43
  function deterministic() {
58
44
  return DETERMINISTIC_VALUE;
59
45
  }
60
-
61
46
  class LoaderCore {
62
47
  static calculateGradient(startColor, stopColor, position) {
63
48
  const calculateChannelValue = (a, b) => a + Math.round((b - a) * position);
64
-
65
49
  return {
66
50
  r: calculateChannelValue(startColor.r, stopColor.r),
67
51
  g: calculateChannelValue(startColor.g, stopColor.g),
68
52
  b: calculateChannelValue(startColor.b, stopColor.b)
69
53
  };
70
54
  }
71
-
72
55
  constructor(containerNode, props) {
73
56
  var _this$ctx;
74
-
75
57
  _defineProperty(this, "props", void 0);
76
-
77
58
  _defineProperty(this, "canvas", void 0);
78
-
79
59
  _defineProperty(this, "textNode", void 0);
80
-
81
60
  _defineProperty(this, "ctx", void 0);
82
-
83
61
  _defineProperty(this, "height", void 0);
84
-
85
62
  _defineProperty(this, "width", void 0);
86
-
87
63
  _defineProperty(this, "particles", void 0);
88
-
89
64
  _defineProperty(this, "baseSpeed", void 0);
90
-
91
65
  _defineProperty(this, "colorIndex", void 0);
92
-
93
66
  _defineProperty(this, "maxRadius", void 0);
94
-
95
67
  _defineProperty(this, "minRadius", void 0);
96
-
97
68
  _defineProperty(this, "colorChangeTick", void 0);
98
-
99
69
  _defineProperty(this, "x", void 0);
100
-
101
70
  _defineProperty(this, "y", void 0);
102
-
103
71
  _defineProperty(this, "radius", void 0);
104
-
105
72
  _defineProperty(this, "hSpeed", void 0);
106
-
107
73
  _defineProperty(this, "vSpeed", void 0);
108
-
109
74
  _defineProperty(this, "radiusSpeed", void 0);
110
-
111
75
  _defineProperty(this, "tick", void 0);
112
-
113
76
  _defineProperty(this, "isRunning", void 0);
114
-
115
77
  this.props = Object.assign({}, LoaderCore.defaultProps, props);
116
78
  this.canvas = document.createElement('canvas');
117
79
  this.canvas.dataset.test = 'ring-loader';
@@ -125,22 +87,22 @@ class LoaderCore {
125
87
  const pixelRatio = LoaderCore.getPixelRatio();
126
88
  const canvasSize = this.props.size * pixelRatio;
127
89
  this.canvas.width = canvasSize;
128
- this.canvas.height = canvasSize; //Fixate canvas physical size to avoid real size scaling
129
-
90
+ this.canvas.height = canvasSize;
91
+ //Fixate canvas physical size to avoid real size scaling
130
92
  this.canvas.style.width = `${this.props.size}px`;
131
93
  this.canvas.style.height = `${this.props.size}px`;
132
94
  this.ctx = this.canvas.getContext('2d');
133
95
  (_this$ctx = this.ctx) === null || _this$ctx === void 0 ? void 0 : _this$ctx.scale(pixelRatio, pixelRatio);
134
96
  this.height = this.props.size;
135
97
  this.width = this.props.size;
136
- this.particles = []; //Configuration
137
-
98
+ this.particles = [];
99
+ //Configuration
138
100
  this.baseSpeed = 1.0;
139
101
  this.colorIndex = 0;
140
102
  this.maxRadius = 10;
141
103
  this.minRadius = 6;
142
- this.colorChangeTick = 40; //State
143
-
104
+ this.colorChangeTick = 40;
105
+ //State
144
106
  this.x = 0;
145
107
  this.y = 0;
146
108
  this.radius = 8;
@@ -150,72 +112,58 @@ class LoaderCore {
150
112
  this.tick = 0;
151
113
  this.prepareInitialState(INITIAL_TICKS);
152
114
  this.isRunning = !this.props.stop;
153
-
154
115
  if (this.isRunning) {
155
116
  this.startAnimation();
156
117
  } else {
157
118
  this.draw();
158
119
  }
159
120
  }
160
-
161
121
  static getPixelRatio() {
162
122
  return getPixelRatio();
163
123
  }
164
-
165
124
  prepareInitialState(ticks) {
166
125
  for (let i = 0; i < ticks; i++) {
167
126
  this.step();
168
127
  }
169
128
  }
170
-
171
129
  handleLimits(coord, radius, speed, limit) {
172
130
  const randomFunc = this.props.deterministic ? deterministic : Math.random;
173
131
  const randomizedSpeedChange = randomFunc() - this.baseSpeed / 2;
174
-
175
132
  if (coord + radius * 2 + this.baseSpeed >= limit) {
176
133
  return -(this.baseSpeed + randomizedSpeedChange);
177
134
  } else if (coord <= this.baseSpeed) {
178
135
  return this.baseSpeed + randomizedSpeedChange;
179
136
  }
180
-
181
137
  return speed;
182
138
  }
183
-
184
139
  calculateNextCoordinates() {
185
140
  this.x += this.hSpeed;
186
141
  this.y += this.vSpeed;
187
142
  this.hSpeed = this.handleLimits(this.x, this.radius, this.hSpeed, this.width);
188
143
  this.vSpeed = this.handleLimits(this.y, this.radius, this.vSpeed, this.height);
189
144
  }
190
-
191
145
  calculateNextRadius() {
192
146
  this.radius += this.radiusSpeed;
193
-
194
147
  if (this.radius > this.maxRadius || this.radius < this.minRadius) {
195
148
  this.radiusSpeed = -this.radiusSpeed;
196
149
  }
197
150
  }
198
-
199
151
  getNextColor() {
200
152
  const colors = this.props.colors;
201
153
  const currentColor = colors[this.colorIndex];
202
154
  const nextColor = colors[this.colorIndex + 1] || colors[0];
203
155
  return LoaderCore.calculateGradient(currentColor, nextColor, this.tick / this.colorChangeTick);
204
156
  }
205
-
206
157
  nextTick() {
207
158
  this.tick++;
208
-
209
159
  if (this.tick > this.colorChangeTick) {
210
160
  this.tick = 0;
211
161
  this.colorIndex++;
212
-
213
162
  if (this.colorIndex > this.props.colors.length - 1) {
214
163
  this.colorIndex = 0;
215
164
  }
216
165
  }
217
166
  }
218
-
219
167
  step() {
220
168
  this.nextTick();
221
169
  this.calculateNextCoordinates();
@@ -228,53 +176,41 @@ class LoaderCore {
228
176
  color: this.getNextColor()
229
177
  }));
230
178
  }
231
-
232
179
  removeDeadParticles() {
233
180
  this.particles = this.particles.filter(it => it.isAlive());
234
181
  }
235
-
236
182
  draw() {
237
183
  const ctx = this.ctx;
238
-
239
184
  if (ctx == null) {
240
185
  return;
241
186
  }
242
-
243
187
  ctx.clearRect(0, 0, this.width, this.height);
244
188
  this.removeDeadParticles();
245
189
  this.particles.forEach(particle => particle.draw(ctx));
246
190
  }
247
-
248
191
  loop() {
249
192
  this.step();
250
193
  this.draw();
251
-
252
194
  if (this.isRunning) {
253
195
  window.requestAnimationFrame(() => this.loop());
254
196
  }
255
197
  }
256
-
257
198
  updateMessage(text) {
258
199
  this.textNode.textContent = text || '';
259
200
  }
260
-
261
201
  stopAnimation() {
262
202
  this.isRunning = false;
263
203
  this.canvas.classList.remove(modules_00b5ad26.animate);
264
204
  }
265
-
266
205
  startAnimation() {
267
206
  this.isRunning = true;
268
207
  this.canvas.classList.add(modules_00b5ad26.animate);
269
208
  this.loop();
270
209
  }
271
-
272
210
  destroy() {
273
211
  this.isRunning = false;
274
212
  }
275
-
276
213
  }
277
-
278
214
  _defineProperty(LoaderCore, "defaultProps", {
279
215
  size: 64,
280
216
  stop: false,
@@ -8,7 +8,6 @@ import { m as modules_e49a3529 } from '../_helpers/loader-inline.js';
8
8
  /**
9
9
  * @name Loader Inline
10
10
  */
11
-
12
11
  class LoaderInline extends PureComponent {
13
12
  render() {
14
13
  const {
@@ -26,9 +25,7 @@ class LoaderInline extends PureComponent {
26
25
  className: modules_e49a3529.children
27
26
  }, children)) : loader;
28
27
  }
29
-
30
28
  }
31
-
32
29
  _defineProperty(LoaderInline, "propTypes", {
33
30
  className: PropTypes.string,
34
31
  'data-test': PropTypes.string,
@@ -9,7 +9,6 @@ import '../global/dom.js';
9
9
  */
10
10
 
11
11
  const angularModule = angular.module('Ring.loader', []);
12
-
13
12
  class RgLoaderComponent extends RingAngularComponent {
14
13
  constructor() {
15
14
  super(...arguments);
@@ -20,23 +19,17 @@ class RgLoaderComponent extends RingAngularComponent {
20
19
  message: this.message
21
20
  });
22
21
  }
23
-
24
22
  $onDestroy() {
25
23
  this.loader.destroy();
26
24
  }
27
-
28
25
  $onChanges(changes) {
29
26
  this.loader.updateMessage(changes.message.currentValue);
30
27
  }
31
-
32
28
  }
33
-
34
29
  _defineProperty(RgLoaderComponent, "$inject", ['$element']);
35
-
36
30
  _defineProperty(RgLoaderComponent, "bindings", {
37
31
  message: '@'
38
32
  });
39
-
40
33
  angularModule.component('rgLoader', RgLoaderComponent);
41
34
  var loaderNg = angularModule.name;
42
35
 
@@ -11,7 +11,6 @@ import '../global/dom.js';
11
11
  /**
12
12
  * @name Loader Screen
13
13
  */
14
-
15
14
  class LoaderScreen extends PureComponent {
16
15
  render() {
17
16
  const {
@@ -31,9 +30,7 @@ class LoaderScreen extends PureComponent {
31
30
  className: loaderClasses
32
31
  })));
33
32
  }
34
-
35
33
  }
36
-
37
34
  _defineProperty(LoaderScreen, "propTypes", {
38
35
  className: PropTypes.string,
39
36
  containerClassName: PropTypes.string,
@@ -13,17 +13,14 @@ import '../global/dom.js';
13
13
  const angularModule = angular.module('Ring.loader-screen', [loaderNg]);
14
14
  angularModule.service('loaderScreen', ["$timeout", "$rootScope", function service($timeout, $rootScope) {
15
15
  var _this = this;
16
-
17
16
  // TODO in CSS Modules version put constant to global.css
18
17
  const ordinaryLoadingTTL = 100;
19
18
  let initialLoading = false;
20
19
  let loadingFailed = false;
21
20
  let showLoader;
22
21
  let showLoaderPromise;
23
-
24
22
  this.startLoading = function () {
25
23
  let ttl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ordinaryLoadingTTL;
26
-
27
24
  if (showLoaderPromise) {
28
25
  return; // already scheduled to show
29
26
  }
@@ -32,44 +29,34 @@ angularModule.service('loaderScreen', ["$timeout", "$rootScope", function servic
32
29
  _this.setVisible(true);
33
30
  }, ttl);
34
31
  };
35
-
36
32
  this.stopLoading = () => {
37
33
  if (showLoaderPromise) {
38
34
  $timeout.cancel(showLoaderPromise);
39
35
  showLoaderPromise = null;
40
36
  }
41
-
42
37
  this.setVisible(false);
43
38
  };
44
-
45
39
  this.startInitialLoading = () => {
46
40
  initialLoading = true;
47
41
  this.setVisible(true);
48
42
  };
49
-
50
43
  this.stopInitialLoading = () => {
51
44
  initialLoading = false;
52
45
  this.setVisible(false);
53
46
  };
54
-
55
47
  $rootScope.isInitialLoading = () => initialLoading;
56
-
57
48
  $rootScope.isLoaderVisible = () => showLoader;
58
-
59
49
  $rootScope.isLoadingFailed = () => loadingFailed;
60
-
61
50
  this.failInitialLoading = error => {
62
51
  this.stopInitialLoading();
63
52
  loadingFailed = true;
64
53
  $rootScope.error = error;
65
54
  };
66
-
67
55
  this.setVisible = visible => {
68
56
  showLoader = visible;
69
57
  };
70
- /* eslint-disable angular/on-watch */
71
-
72
58
 
59
+ /* eslint-disable angular/on-watch */
73
60
  $rootScope.$on('$routeChangeSuccess', () => {
74
61
  this.stopInitialLoading();
75
62
  });
@@ -80,6 +67,7 @@ angularModule.service('loaderScreen', ["$timeout", "$rootScope", function servic
80
67
  });
81
68
  /* eslint-enable angular/on-watch */
82
69
  }]);
70
+
83
71
  angularModule.directive('rgLoaderScreen', function rgLoaderScreenDirective() {
84
72
  return {
85
73
  restrict: 'A',