vgapp 0.1.1 → 0.1.3

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 (52) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +1 -1
  3. package/app/modules/base-module.js +6 -1
  4. package/app/modules/module-fn.js +5 -7
  5. package/app/modules/vgdropdown/js/vgdropdown.js +16 -10
  6. package/app/modules/vgdropdown/scss/vgdropdown.css +47 -0
  7. package/app/modules/vgdropdown/scss/vgdropdown.css.map +1 -0
  8. package/app/modules/vgformsender/js/vgformsender.js +1 -1
  9. package/app/modules/vgformsender/scss/vgformsender.css +13 -0
  10. package/app/modules/vgformsender/scss/vgformsender.css.map +1 -0
  11. package/app/modules/vglawcookie/js/vglawcookie.js +182 -0
  12. package/app/modules/vglawcookie/scss/_variables.scss +14 -0
  13. package/app/modules/vglawcookie/scss/vglawcookie.css +87 -0
  14. package/app/modules/vglawcookie/scss/vglawcookie.css.map +1 -0
  15. package/app/modules/vglawcookie/scss/vglawcookie.scss +91 -0
  16. package/app/modules/vgmodal/js/vgmodal.js +24 -28
  17. package/app/modules/vgmodal/scss/vgmodal.css +3824 -0
  18. package/app/modules/vgmodal/scss/vgmodal.css.map +1 -0
  19. package/app/modules/vgnav/scss/vgnav.css +309 -0
  20. package/app/modules/vgnav/scss/vgnav.css.map +1 -0
  21. package/app/modules/vgnotify/scss/vgnotify.css +3 -0
  22. package/app/modules/vgnotify/scss/vgnotify.css.map +1 -0
  23. package/app/modules/vgrollup/js/vgrollup.js +10 -10
  24. package/app/modules/vgrollup/scss/vgrollup.css +41 -0
  25. package/app/modules/vgrollup/scss/vgrollup.css.map +1 -0
  26. package/app/modules/vgselect/js/vgselect.js +341 -0
  27. package/app/modules/vgselect/scss/_variables.scss +74 -0
  28. package/app/modules/vgselect/scss/vgselect.css +243 -0
  29. package/app/modules/vgselect/scss/vgselect.css.map +1 -0
  30. package/app/modules/vgselect/scss/vgselect.scss +216 -0
  31. package/app/modules/vgsidebar/js/vgsidebar.js +21 -9
  32. package/app/modules/vgsidebar/scss/vgsidebar.css +86 -0
  33. package/app/modules/vgsidebar/scss/vgsidebar.css.map +1 -0
  34. package/app/utils/js/components/alert.js +8 -0
  35. package/app/utils/js/components/animation.js +53 -0
  36. package/app/utils/js/components/backdrop.js +7 -5
  37. package/app/utils/js/dom/cookie.js +127 -0
  38. package/app/utils/js/dom/data.js +1 -1
  39. package/app/utils/js/dom/manipulator.js +9 -1
  40. package/app/utils/js/functions.js +20 -1
  41. package/app/utils/scss/default.css +275 -0
  42. package/app/utils/scss/default.css.map +1 -0
  43. package/app/utils/scss/variables.scss +5 -4
  44. package/build/vgapp.css +2 -0
  45. package/build/vgapp.css.map +1 -1
  46. package/build/vgapp.js +2 -1
  47. package/build/vgapp.js.LICENSE.txt +1 -0
  48. package/build/vgapp.js.map +1 -1
  49. package/index.js +9 -1
  50. package/package.json +1 -1
  51. package/app/modules/vgsidebar/js/!oldjs.txt +0 -143
  52. /package/app/modules/vgnotify/scss/{vgnotify.sass → vgnotify.scss} +0 -0
@@ -0,0 +1,216 @@
1
+ /**
2
+ *--------------------------------------------------------------------------
3
+ * Модуль: VGSELECT
4
+ * Автор: Vegas DEV
5
+ * Лицензия: смотри LICENSE
6
+ *--------------------------------------------------------------------------
7
+ **/
8
+
9
+ @import "../../../utils/scss/functions";
10
+ @import "../../../utils/scss/mixin";
11
+ @import "../../../utils/scss/variables";
12
+ @import "variables";
13
+
14
+ select {
15
+ &.vg-select {
16
+ position: absolute;
17
+ left: 0;
18
+ top: 0;
19
+ opacity: 0;
20
+ z-index: -1000;
21
+ width: 100%;
22
+ height: 100%;
23
+ display: inline-block;
24
+ visibility: hidden;
25
+ }
26
+ }
27
+
28
+ .vg-select {
29
+ @include mix-vars('select-current', $select-current-map);
30
+ @include mix-vars('select-dropdown', $select-dropdown-map);
31
+ @include mix-vars('select-list', $select-list-map);
32
+ @include mix-vars('select-optgroup', $select-optgroup-map);
33
+ @include mix-vars('select-optgroup-hover', $select-optgroup-hover-map);
34
+ @include mix-vars('select-list-hover', $select-list-hover-map);
35
+ @include mix-vars('select-search', $select-search-map);
36
+ --vg-select-list-max-height: #{$select-list-max-height};
37
+ --vg-select-list-scrollbar-width: #{$select-list-scrollbar-width};
38
+ --vg-select-list-scrollbar-bg: #{$select-list-scrollbar-bg};
39
+ --vg-select-list-scrollbar-thumb: #{$select-list-scrollbar-thumb};
40
+ position: relative;
41
+
42
+ &-current {
43
+ @each $key, $value in $select-current-map {
44
+ #{$key}: var(--vg-select-current-#{$key})
45
+ }
46
+ box-sizing: border-box;
47
+ cursor: pointer;
48
+ outline: none;
49
+ position: relative;
50
+ z-index: var(--vg-select-current-z-index);
51
+ white-space: nowrap;
52
+ overflow: hidden;
53
+ text-overflow: ellipsis;
54
+
55
+ &:after {
56
+ content: '';
57
+ position: absolute;
58
+ right: 16px;
59
+ top: 50%;
60
+ transform: translateY(-50%);
61
+ transition: all .4s ease-in-out;
62
+ background-image: url("data:image/svg+xml, " + $select-current-svg);
63
+ background-repeat: no-repeat;
64
+ width: 16px;
65
+ height: 16px;
66
+ }
67
+ }
68
+
69
+ &-dropdown {
70
+ @each $key, $value in $select-dropdown-map {
71
+ #{$key}: var(--vg-select-dropdown-#{$key})
72
+ }
73
+ position: absolute;
74
+ box-sizing: border-box;
75
+ opacity: 0;
76
+ overflow: hidden;
77
+ padding: 0;
78
+ top: 100%;
79
+ left: 0;
80
+ width: 100%;
81
+ height: 0;
82
+ pointer-events: auto;
83
+ transform-origin: 50% 0;
84
+ transform: scale(0.75) translateY(-11px);
85
+ transition: all 0.2s cubic-bezier(0.5, 0, 0, 1.25), opacity 0.15s ease-out;
86
+ z-index: var(--vg-select-dropdown-z-index);
87
+ margin-top: .25rem;
88
+ }
89
+
90
+ &-list {
91
+ margin: 0;
92
+ padding: 0;
93
+ list-style: none;
94
+ display: flex;
95
+ flex-direction: column;
96
+ max-height: var(--vg-select-list-max-height);
97
+ overflow-y: auto;
98
+
99
+ &::-webkit-scrollbar-track {
100
+ -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
101
+ background-color: var(--vg-select-list-scrollbar-bg);
102
+ }
103
+
104
+ &::-webkit-scrollbar
105
+ {
106
+ width: var(--vg-select-list-scrollbar-width);
107
+ background-color: var(--vg-select-list-scrollbar-bg);
108
+ }
109
+
110
+ &::-webkit-scrollbar-thumb
111
+ {
112
+ background-color: var(--vg-select-list-scrollbar-thumb);
113
+ }
114
+
115
+ &--option {
116
+ @each $key, $value in $select-list-map {
117
+ #{$key}: var(--vg-select-list-#{$key})
118
+ }
119
+ display: block;
120
+ width: 100%;
121
+ cursor: pointer;
122
+ transition: all .4s ease-in-out;
123
+
124
+ &:last-child {
125
+ border: none;
126
+ }
127
+
128
+ &:hover, &.selected {
129
+ @each $key, $value in $select-list-hover-map {
130
+ #{$key}: var(--vg-select-list-hover-#{$key})
131
+ }
132
+ }
133
+
134
+ &.disabled {
135
+ opacity: .6;
136
+ cursor: not-allowed;
137
+ }
138
+
139
+ &.hidden {
140
+ display: none !important;
141
+ }
142
+ }
143
+
144
+ &--optgroup {
145
+ list-style: none;
146
+ padding: 0;
147
+
148
+ + .vg-select-list--optgroup {
149
+ border-top-width: var(--vg-select-optgroup-border-bottom-width);
150
+ border-top-style: var(--vg-select-optgroup-border-bottom-style);
151
+ border-top-color: var(--vg-select-optgroup-border-bottom-color);
152
+ }
153
+
154
+ > li {
155
+ --vg-select-list-padding-left: 16px;
156
+ }
157
+
158
+ &-title {
159
+ @each $key, $value in $select-optgroup-map {
160
+ #{$key}: var(--vg-select-optgroup-#{$key})
161
+ }
162
+ }
163
+ }
164
+ }
165
+
166
+ &-search {
167
+ input {
168
+ @each $key, $value in $select-search-map {
169
+ #{$key}: var(--vg-select-search-#{$key})
170
+ }
171
+ padding: 8px;
172
+ border: none;
173
+ outline: none;
174
+ width: 100%;
175
+ }
176
+ }
177
+
178
+ &.show {
179
+ .vg-select-current {
180
+ &:after {
181
+ transform: translateY(-50%) rotate(180deg);
182
+ }
183
+ }
184
+
185
+ .vg-select-dropdown {
186
+ transform: scale(1) translateY(0);
187
+ opacity: 1;
188
+ box-sizing: border-box;
189
+ height: auto;
190
+ }
191
+ }
192
+
193
+ &.is-invalid {
194
+ .vg-select-current {
195
+ background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
196
+ background-repeat: no-repeat;
197
+ background-position: right calc(1.975em + 0.1875rem) center;
198
+ background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
199
+ --vg-select-current-padding-right: 55px;
200
+ }
201
+ }
202
+
203
+ &.disabled {
204
+ &:before {
205
+ content: '';
206
+ position: absolute;
207
+ width: 100%;
208
+ height: 100%;
209
+ z-index: 500;
210
+ }
211
+
212
+ > .vg-select-current {
213
+ opacity: .75;
214
+ }
215
+ }
216
+ }
@@ -12,7 +12,7 @@ import Overflow from "../../../utils/js/components/overflow";
12
12
  const NAME = 'sidebar';
13
13
  const NAME_KEY = 'vg.sidebar';
14
14
  const CLASS_NAME_SHOW = 'show';
15
- const SELECTOR_DATA_TOGGLE= '[data-vg-toggle="sidebar"]'
15
+ const SELECTOR_DATA_TOGGLE= '[data-vg-toggle="sidebar"]';
16
16
 
17
17
  const EVENT_KEY_HIDE = `${NAME_KEY}.hide`;
18
18
  const EVENT_KEY_HIDDEN = `${NAME_KEY}.hidden`;
@@ -31,6 +31,12 @@ class VGSidebar extends BaseModule {
31
31
  backdrop: true,
32
32
  overflow: true,
33
33
  keyboard: true,
34
+ animation: {
35
+ enable: false,
36
+ in: 'animate__rollIn',
37
+ out: 'animate__rollOut',
38
+ delay: 800,
39
+ },
34
40
  ajax: {
35
41
  route: '',
36
42
  target: '',
@@ -40,6 +46,9 @@ class VGSidebar extends BaseModule {
40
46
 
41
47
  this._addEventListeners();
42
48
  this._dismissElement();
49
+
50
+ this._params.animation.delay = !this._params.animation.enable ? 0 : this._params.animation.delay;
51
+ this._animation(this._element, VGSidebar.NAME_KEY, this._params.animation);
43
52
  }
44
53
 
45
54
  static get NAME() {
@@ -58,9 +67,10 @@ class VGSidebar extends BaseModule {
58
67
  const _this = this;
59
68
  if (isDisabled(_this._element)) return;
60
69
 
61
- this._route();
70
+ _this._params = _this._getParams(relatedTarget, _this._params);
71
+ _this._route();
62
72
 
63
- const showEvent = EventHandler.trigger(this._element, EVENT_KEY_SHOW, { relatedTarget })
73
+ const showEvent = EventHandler.trigger(_this._element, EVENT_KEY_SHOW, { relatedTarget })
64
74
  if (showEvent.defaultPrevented) return;
65
75
 
66
76
  if (_this._params.backdrop) {
@@ -78,9 +88,9 @@ class VGSidebar extends BaseModule {
78
88
  _this.hide();
79
89
  });
80
90
 
81
- EventHandler.trigger(this._element, EVENT_KEY_SHOWN, { relatedTarget });
91
+ EventHandler.trigger(_this._element, EVENT_KEY_SHOWN, { relatedTarget });
82
92
  }
83
- this._queueCallback(completeCallBack, this._element, true, 50)
93
+ _this._queueCallback(completeCallBack, _this._element, true, 50)
84
94
  }
85
95
 
86
96
  hide() {
@@ -102,11 +112,13 @@ class VGSidebar extends BaseModule {
102
112
  Overflow.destroy();
103
113
  }
104
114
 
105
- _this._element.setAttribute('aria-expanded', false);
106
- _this._element.classList.remove(CLASS_NAME_SHOW);
115
+ setTimeout(() => {
116
+ _this._element.setAttribute('aria-expanded', false);
117
+ _this._element.classList.remove(CLASS_NAME_SHOW);
107
118
 
108
- const completeCallback = () => EventHandler.trigger(this._element, EVENT_KEY_HIDDEN);
109
- this._queueCallback(completeCallback, this._element, true);
119
+ const completeCallback = () => EventHandler.trigger(this._element, EVENT_KEY_HIDDEN);
120
+ this._queueCallback(completeCallback, this._element, true);
121
+ }, this._params.animation.delay);
110
122
  }
111
123
 
112
124
  dispose() {
@@ -0,0 +1,86 @@
1
+ @charset "UTF-8";
2
+ /**
3
+ *--------------------------------------------------------------------------
4
+ * Модуль: VGSidebar
5
+ * Автор: Vegas DEV
6
+ * Лицензия: смотри LICENSE
7
+ *--------------------------------------------------------------------------
8
+ **/
9
+ .vg-sidebar {
10
+ --vg-sidebar-horizontal-width: 400px ;
11
+ --vg-sidebar-horizontal-height: 100vh ;
12
+ --vg-sidebar-vertical-width: 100vw ;
13
+ --vg-sidebar-vertical-height: 30vh ;
14
+ --vg-sidebar-bg-color: #fff ;
15
+ --vg-sidebar-color: #000000 ;
16
+ --vg-sidebar-box-shadow: 0 8px 14px 5px rgba(0, 0, 0, 0.2) ;
17
+ --vg-sidebar-header-height: 60px ;
18
+ --vg-sidebar-footer-height: 70px ;
19
+ --vg-sidebar-padding: 1rem ;
20
+ --vg-sidebar-border: 1px solid rgba(0, 0, 0, 0.2) ;
21
+ --vg-sidebar-z-index: 1040 ;
22
+ --vg-sidebar-transition: all 0.5s ease-in-out ;
23
+ position: fixed;
24
+ width: auto;
25
+ height: auto;
26
+ transition: var(--vg-sidebar-transition);
27
+ z-index: var(--vg-sidebar-z-index);
28
+ background: var(--vg-sidebar-bg-color);
29
+ color: var(--vg-sidebar-color);
30
+ box-shadow: var(--vg-sidebar-box-shadow);
31
+ }
32
+ .vg-sidebar.left, .vg-sidebar.right {
33
+ width: var(--vg-sidebar-horizontal-width);
34
+ height: var(--vg-sidebar-horizontal-height);
35
+ top: 0;
36
+ }
37
+ .vg-sidebar.left {
38
+ left: -105%;
39
+ }
40
+ .vg-sidebar.left.show {
41
+ left: 0;
42
+ }
43
+ .vg-sidebar.right {
44
+ right: -105%;
45
+ }
46
+ .vg-sidebar.right.show {
47
+ right: 0;
48
+ }
49
+ .vg-sidebar.top, .vg-sidebar.bottom {
50
+ height: var(--vg-sidebar-vertical-height);
51
+ width: var(--vg-sidebar-vertical-width);
52
+ left: 0;
53
+ }
54
+ .vg-sidebar.top {
55
+ top: -105%;
56
+ }
57
+ .vg-sidebar.top.show {
58
+ top: 0;
59
+ }
60
+ .vg-sidebar.bottom {
61
+ bottom: -105%;
62
+ }
63
+ .vg-sidebar.bottom.show {
64
+ bottom: 0;
65
+ }
66
+ .vg-sidebar-header {
67
+ height: var(--vg-sidebar-header-height);
68
+ z-index: 10;
69
+ position: relative;
70
+ display: flex;
71
+ align-items: center;
72
+ padding: var(--vg-sidebar-padding);
73
+ border-bottom: var(--vg-sidebar-border);
74
+ }
75
+ .vg-sidebar-body {
76
+ height: calc(100% - var(--vg-sidebar-header-height) - var(--vg-sidebar-footer-height));
77
+ overflow-y: auto;
78
+ padding: var(--vg-sidebar-padding);
79
+ }
80
+ .vg-sidebar-footer {
81
+ height: var(--vg-sidebar-footer-height);
82
+ padding: var(--vg-sidebar-padding);
83
+ border-top: var(--vg-sidebar-border);
84
+ }
85
+
86
+ /*# sourceMappingURL=vgsidebar.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sourceRoot":"","sources":["vgsidebar.scss","../../../utils/scss/mixin.scss"],"names":[],"mappings":";AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaA;ECTI;EAAA;EAAA;EAAA;EAGD;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EDQF;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACC;EACA;EACA;;AAGD;EACC;;AAEA;EACC;;AAIF;EACC;;AAEA;EACC;;AAIF;EACC;EACA;EACA;;AAGD;EACC;;AAEA;EACC;;AAIF;EACC;;AAEA;EACC;;AAIF;EACC;EACA;EACA;EACA;EACA;EACA;EACA;;AAGD;EACC;EACA;EACA;;AAGD;EACC;EACA;EACA","file":"vgsidebar.css"}
@@ -0,0 +1,8 @@
1
+ const NAME = 'alert';
2
+ const CLASS_NAME = `vg-${NAME}`;
3
+
4
+ class Alert {
5
+
6
+ }
7
+
8
+ export default Alert;
@@ -0,0 +1,53 @@
1
+ import {isElement, mergeDeepObject} from "../functions";
2
+ import EventHandler from "../dom/event";
3
+
4
+ /**
5
+ * Классы для анимаций смотрим здесь
6
+ * https://animate.style/
7
+ *
8
+ * Работает с модулями у которых есть события show, hide, hidden
9
+ */
10
+ class Animation {
11
+ constructor(element, key, params = {}) {
12
+ this._params = mergeDeepObject({
13
+ enable: false,
14
+ in: 'animate__backInUp',
15
+ out: 'animate__backOutUp',
16
+ delay: 0,
17
+ }, params);
18
+
19
+ this.classes = {
20
+ animated: 'animate__animated'
21
+ }
22
+
23
+ if (!this._params.enable) return;
24
+ if (!isElement(element)) return;
25
+
26
+ this._element = element;
27
+ this._name_key = key;
28
+
29
+ if (!this._element.classList.contains(this.classes.animated)) {
30
+ this._element.classList.add(this.classes.animated);
31
+ }
32
+
33
+ this._triggers();
34
+ }
35
+
36
+ _triggers() {
37
+ EventHandler.on(this._element, this._name_key + '.show', () => {
38
+ this._element.classList.remove(this._params.out);
39
+ this._element.classList.add(this._params.in);
40
+ });
41
+
42
+ EventHandler.on(this._element, this._name_key + '.hide', () => {
43
+ this._element.classList.remove(this._params.in);
44
+ this._element.classList.add(this._params.out);
45
+ });
46
+
47
+ EventHandler.on(this._element, this._name_key + '.hidden', () => {
48
+ this._element.classList.remove(this._params.out);
49
+ });
50
+ }
51
+ }
52
+
53
+ export default Animation;
@@ -3,10 +3,12 @@ import Selectors from "../dom/selectors";
3
3
  import EventHandler from "../dom/event";
4
4
  import Overflow from "./overflow";
5
5
 
6
- const NAME = 'backdrop'
7
- const CLASS_NAME = 'vg-backdrop'
8
- const CLASS_NAME_FADE = 'fade'
9
- const EVENT_MOUSEDOWN = `mousedown.vg.${NAME}`
6
+ const NAME = 'backdrop';
7
+ const CLASS_NAME = 'vg-backdrop';
8
+ const CLASS_NAME_FADE = 'fade';
9
+ const EVENT_MOUSEDOWN = `mousedown.vg.${NAME}`;
10
+
11
+ let backdrop_delay = 500;
10
12
 
11
13
  class Backdrop {
12
14
  static show(callback) {
@@ -47,7 +49,7 @@ class Backdrop {
47
49
 
48
50
  setTimeout(() => {
49
51
  element.remove();
50
- }, 100);
52
+ }, backdrop_delay);
51
53
  }
52
54
  }
53
55
 
@@ -0,0 +1,127 @@
1
+ /*! js-cookie v3.0.1 | MIT */
2
+
3
+ function assign (target) {
4
+ for (let i = 1; i < arguments.length; i++) {
5
+ let source = arguments[i];
6
+ for (let key in source) {
7
+ target[key] = source[key];
8
+ }
9
+ }
10
+ return target
11
+ }
12
+
13
+ let defaultConverter = {
14
+ read: function (value) {
15
+ if (value[0] === '"') {
16
+ value = value.slice(1, -1);
17
+ }
18
+ return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent)
19
+ },
20
+ write: function (value) {
21
+ return encodeURIComponent(value).replace(
22
+ /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
23
+ decodeURIComponent
24
+ )
25
+ }
26
+ };
27
+
28
+ function init (converter, defaultAttributes) {
29
+ function set (key, value, attributes) {
30
+ if (typeof document === 'undefined') {
31
+ return
32
+ }
33
+
34
+ attributes = assign({}, defaultAttributes, attributes);
35
+
36
+ if (typeof attributes.expires === 'number') {
37
+ attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
38
+ }
39
+ if (attributes.expires) {
40
+ attributes.expires = attributes.expires.toUTCString();
41
+ }
42
+
43
+ key = encodeURIComponent(key)
44
+ .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)
45
+ .replace(/[()]/g, escape);
46
+
47
+ let stringifiedAttributes = '';
48
+ for (let attributeName in attributes) {
49
+ if (!attributes[attributeName]) {
50
+ continue
51
+ }
52
+
53
+ stringifiedAttributes += '; ' + attributeName;
54
+
55
+ if (attributes[attributeName] === true) {
56
+ continue
57
+ }
58
+
59
+ // Considers RFC 6265 section 5.2:
60
+ // ...
61
+ // 3. If the remaining unparsed-attributes contains a %x3B (";")
62
+ // character:
63
+ // Consume the characters of the unparsed-attributes up to,
64
+ // not including, the first %x3B (";") character.
65
+ // ...
66
+ stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
67
+ }
68
+
69
+ return (document.cookie =
70
+ key + '=' + converter.write(value, key) + stringifiedAttributes)
71
+ }
72
+
73
+ function get (key) {
74
+ if (typeof document === 'undefined' || (arguments.length && !key)) {
75
+ return
76
+ }
77
+
78
+ // To prevent the for loop in the first place assign an empty array
79
+ // in case there are no cookies at all.
80
+ let cookies = document.cookie ? document.cookie.split('; ') : [];
81
+ let jar = {};
82
+ for (let i = 0; i < cookies.length; i++) {
83
+ let parts = cookies[i].split('=');
84
+ let value = parts.slice(1).join('=');
85
+
86
+ try {
87
+ let foundKey = decodeURIComponent(parts[0]);
88
+ jar[foundKey] = converter.read(value, foundKey);
89
+
90
+ if (key === foundKey) {
91
+ break
92
+ }
93
+ } catch (e) {}
94
+ }
95
+
96
+ return key ? jar[key] : jar
97
+ }
98
+
99
+ return Object.create({
100
+ set: set,
101
+ get: get,
102
+ remove: function (key, attributes) {
103
+ set(
104
+ key,
105
+ '',
106
+ assign({}, attributes, {
107
+ expires: -1
108
+ })
109
+ );
110
+ },
111
+ withAttributes: function (attributes) {
112
+ return init(this.converter, assign({}, this.attributes, attributes))
113
+ },
114
+ withConverter: function (converter) {
115
+ return init(assign({}, this.converter, converter), this.attributes)
116
+ }
117
+ },
118
+ {
119
+ attributes: { value: Object.freeze(defaultAttributes) },
120
+ converter: { value: Object.freeze(converter) }
121
+ }
122
+ )
123
+ }
124
+
125
+ let api = init(defaultConverter, { path: '/' });
126
+
127
+ export default api;
@@ -24,7 +24,7 @@ export default {
24
24
  return
25
25
  }
26
26
 
27
- instanceMap.set(key, instance)
27
+ instanceMap.set(key, instance);
28
28
  },
29
29
 
30
30
  get(element, key) {
@@ -56,7 +56,15 @@ const Manipulator = {
56
56
  if (isElement(element) && nameAttribute) {
57
57
  element.removeAttribute(nameAttribute);
58
58
  }
59
- }
59
+ },
60
+
61
+ hide(el) {
62
+ el.style.display = 'none';
63
+ },
64
+
65
+ show(el, state = 'block') {
66
+ el.style.display = state;
67
+ },
60
68
  }
61
69
 
62
70
  export {Manipulator}
@@ -269,9 +269,28 @@ function makeRandomString(length = 7) {
269
269
  return result;
270
270
  }
271
271
 
272
+ /**
273
+ * Транслитерация символов с латиницы на кириллицу и обратно
274
+ * @param text
275
+ * @param enToRu
276
+ * @returns {*}
277
+ */
278
+ function transliterate(text, enToRu) {
279
+ let ru = "й ц у к е н г ш щ з х ъ ф ы в а п р о л д ж э я ч с м и т ь б ю".split(/ +/g);
280
+ let en = "q w e r t y u i o p [ ] a s d f g h j k l ; ' z x c v b n m , .".split(/ +/g);
281
+ let x;
282
+
283
+ for (x = 0; x < ru.length; x++) {
284
+ text = text.split(enToRu ? en[x] : ru[x]).join(enToRu ? ru[x] : en[x]);
285
+ text = text.split(enToRu ? en[x].toUpperCase() : ru[x].toUpperCase()).join(enToRu ? ru[x].toUpperCase() : en[x].toUpperCase());
286
+ }
287
+
288
+ return text;
289
+ }
290
+
272
291
  /**
273
292
  *
274
293
  */
275
294
  const isRTL = () => document.documentElement.dir === 'rtl'
276
295
 
277
- export {isElement, isVisible, isDisabled, isObject, isEmptyObj, mergeDeepObject, removeElementArray, normalizeData, execute, executeAfterTransition, reflow, noop, makeRandomString, isRTL}
296
+ export {isElement, isVisible, isDisabled, isObject, isEmptyObj, mergeDeepObject, removeElementArray, normalizeData, execute, executeAfterTransition, reflow, noop, makeRandomString, isRTL, transliterate}