@andreyshpigunov/x 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.html CHANGED
@@ -19,7 +19,7 @@
19
19
  "functionName": "headerAnimation"
20
20
  }'>
21
21
  <header class="header flex aic sticky t0 px5 m:px6 l:px8 unselectable">
22
- <div class="header-version nowrap">0.4.0</div>
22
+ <div class="header-version nowrap">0.4.1</div>
23
23
  <div class="header-logo mxa">
24
24
  <a role="button" x-scrollto="#top">
25
25
  <img src="assets/img/logo.png" alt="x" />
@@ -234,27 +234,27 @@
234
234
  });
235
235
 
236
236
  x.form.onUpdate('[name=exampleSelect]', (el) => {
237
- qs('[name=exampleSelectValue]').value = el.value;
238
- qs('#radio' + el.value).checked = true;
237
+ x.qs('[name=exampleSelectValue]').value = el.value;
238
+ x.qs('#radio' + el.value).checked = true;
239
239
  });
240
240
 
241
241
  x.form.onUpdate('[name=exampleSelectValue]', (el) => {
242
242
  var val = ['', '1', '2', '3'].includes(el.value) ? el.value : 1;
243
243
  el.value = val;
244
- qs('[name=exampleSelect]').value = val;
244
+ x.qs('[name=exampleSelect]').value = val;
245
245
  // Reset radio buttons
246
- let radio = qsa('[name=exampleSelectRadio]');
246
+ let radio = x.qsa('[name=exampleSelectRadio]');
247
247
  for (let rad of radio) rad.checked = false;
248
248
  // Select radio button
249
- if (el.value != '') qs('#radio' + el.value).checked = true;
249
+ if (el.value != '') x.qs('#radio' + el.value).checked = true;
250
250
  });
251
251
 
252
- let radio = qsa('[name=exampleSelectRadio]');
252
+ let radio = x.qsa('[name=exampleSelectRadio]');
253
253
  for (let rad of radio) {
254
254
  x.form.onUpdate(rad, (el) => {
255
- let val = qs('[name=exampleSelectRadio]:checked').value;
256
- qs('[name=exampleSelect]').value = el.value;
257
- qs('[name=exampleSelectValue]').value = el.value;
255
+ let val = x.qs('[name=exampleSelectRadio]:checked').value;
256
+ x.qs('[name=exampleSelect]').value = el.value;
257
+ x.qs('[name=exampleSelectValue]').value = el.value;
258
258
  });
259
259
  }
260
260
 
@@ -265,8 +265,8 @@
265
265
  x.form.onUpdate(fields, calc);
266
266
 
267
267
  function calc() {
268
- let val1 = qs('[name=exampleVal1]').value || 0;
269
- let val2 = qs('[name=exampleVal2]').value || 0;
268
+ let val1 = x.qs('[name=exampleVal1]').value || 0;
269
+ let val2 = x.qs('[name=exampleVal2]').value || 0;
270
270
  let sum = parseInt(val1) + parseInt(val2);
271
271
  x.form.setValue('[name=exampleSum]', sum);
272
272
  }
@@ -370,7 +370,7 @@
370
370
  }
371
371
 
372
372
  libExample();
373
- qs('.jsLibExampleUpdate').addEventListener('click', libExample);
373
+ x.qs('.jsLibExampleUpdate').addEventListener('click', libExample);
374
374
  })
375
375
  </script>
376
376
  </div>
@@ -830,7 +830,7 @@
830
830
  <h3>Project on GitHub</h3>
831
831
  <p><a href="https://github.com/andreyshpigunov/x">https://github.com/andreyshpigunov/x</a></p>
832
832
  <hr class="my7" />
833
-
833
+
834
834
  <p><a href="https://andreyshpigunov.github.io/x/cheatsheet.html">CSS cheatsheet</a></p>
835
835
  </div>
836
836
  </section>
@@ -2040,8 +2040,8 @@ a.link--wavy</pre>
2040
2040
  <h3>Шорткаты</h3>
2041
2041
 
2042
2042
  <div class="codeBlock">
2043
- <code>qs: (s, o = document) => o.querySelector(s)</code>
2044
- <code>qsa: (s, o = document) => o.querySelectorAll(s)</code>
2043
+ <code>x.qs: (s, o = document) => o.querySelector(s)</code>
2044
+ <code>x.qsa: (s, o = document) => o.querySelectorAll(s)</code>
2045
2045
  </div>
2046
2046
 
2047
2047
  <p>Пример использования:</p>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andreyshpigunov/x",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "x-js": "dist/x.js",
5
5
  "app-js": "assets/js/app.js",
6
6
  "targets": {
@@ -233,10 +233,8 @@ All right reserved.
233
233
  /* Dropdown button */
234
234
 
235
235
  .button--dropdown {
236
- padding-right: calc(var(
237
- --button-side-padding,
238
- calc(var(--button-font-size) * var(--button-side-padding-coeff)
239
- )) * 1.8);
236
+ --var: calc(var(--button-font-size) * var(--button-side-padding-coeff));
237
+ padding-right: calc(var(--button-side-padding, --var) * 1.8);
240
238
 
241
239
  &::after {
242
240
  content: '';
package/src/css/app.css CHANGED
@@ -78,130 +78,130 @@ All right reserved.
78
78
 
79
79
 
80
80
  .header {
81
- z-index: 100;
82
- height: 100px;
83
- will-change: height;
84
-
85
- @media (min-width: 768px) {
86
- height: 120px;
87
- }
81
+ z-index: 100;
82
+ height: 100px;
83
+ will-change: height;
84
+
85
+ @media (min-width: 768px) {
86
+ height: 120px;
87
+ }
88
88
  }
89
89
  .header_compact {
90
90
 
91
91
  }
92
92
  .header-version {
93
- width: 40px;
94
- font-weight: 700;
93
+ width: 40px;
94
+ font-weight: 700;
95
95
  }
96
96
  .header-logo {
97
- transform-origin: top;
97
+ transform-origin: top;
98
+
99
+ & a {
100
+ display: block;
101
+ }
102
+ & img {
103
+ max-width: 100px;
104
+ will-change: transform;
98
105
 
99
- & a {
100
- display: block;
101
- }
102
- & img {
103
- max-width: 100px;
104
- will-change: transform;
105
-
106
- @media (min-width: 768px) {
107
- max-width: 120px;
108
- }
106
+ @media (min-width: 768px) {
107
+ max-width: 120px;
109
108
  }
109
+ }
110
110
  }
111
111
  .header-github {
112
- & a {
113
- display: block;
114
- width: 40px;
115
- height: 40px;
116
- background-position: center;
117
- background-size: cover;
118
- background-image: url(/assets/img/github-mark.png);
119
-
120
- @media (prefers-color-scheme: dark) {
121
- background-image: url(/assets/img/github-mark-white.png);
122
- }
112
+ & a {
113
+ display: block;
114
+ width: 40px;
115
+ height: 40px;
116
+ background-position: center;
117
+ background-size: cover;
118
+ background-image: url(../img/github-mark.png);
119
+
120
+ @media (prefers-color-scheme: dark) {
121
+ background-image: url(../img/github-mark-white.png);
123
122
  }
123
+ }
124
124
  }
125
125
 
126
126
  .modalNavigation {
127
- z-index: 10;
127
+ z-index: 10;
128
128
  }
129
129
  .modalNavigation-inner {
130
- display: flex;
131
- gap: 10px;
132
- padding: 10px 0;
130
+ display: flex;
131
+ gap: 10px;
132
+ padding: 10px 0;
133
133
  }
134
134
  .modalNavigation a {
135
- cursor: pointer;
136
- padding: 4px 14px;
137
- color: #000;
138
- background: #fff;
139
- border: solid 1px #000;
140
- border-radius: 100px;
135
+ cursor: pointer;
136
+ padding: 4px 14px;
137
+ color: #000;
138
+ background: #fff;
139
+ border: solid 1px #000;
140
+ border-radius: 100px;
141
+
142
+ &.active {
143
+ color: #fff;
144
+ background: #000;
145
+ }
146
+
147
+ @media (prefers-color-scheme: dark) {
148
+ color: #eee;
149
+ background: #222;
150
+ border: solid 1px #222;
141
151
 
142
152
  &.active {
143
- color: #fff;
144
- background: #000;
145
- }
146
-
147
- @media (prefers-color-scheme: dark) {
148
- color: #eee;
149
- background: #222;
150
- border: solid 1px #222;
151
-
152
- &.active {
153
- color: #000;
154
- background: #fff;
155
- }
153
+ color: #000;
154
+ background: #fff;
156
155
  }
156
+ }
157
157
  }
158
158
 
159
159
 
160
160
  code {
161
- padding: 2px;
162
- font-size: var(--code-font-size);
163
- color: var(--code-font-color);
164
- background: var(--code-background-color);
161
+ padding: 2px;
162
+ font-size: var(--code-font-size);
163
+ color: var(--code-font-color);
164
+ background: var(--code-background-color);
165
165
  }
166
166
  .codeBlock {
167
- position: relative;
168
- padding: 16px 20px 16px 10px;
169
- background: var(--code-background-color);
170
- counter-reset: row 0;
171
- border-radius: 8px;
167
+ position: relative;
168
+ padding: 16px 20px 16px 10px;
169
+ background: var(--code-background-color);
170
+ counter-reset: row 0;
171
+ border-radius: 8px;
172
+
173
+ &:before {
174
+ content: '</>';
175
+ position: absolute;
176
+ top: 16px;
177
+ right: 16px;
178
+ letter-spacing: 1px;
179
+ line-height: 1;
180
+ font-weight: 500;
181
+ font-size: 18px;
182
+ font-family: var(--font-family-mono);
183
+ color: #ccc;
184
+ }
185
+
186
+ & code {
187
+ display: flex;
188
+ counter-increment: row 1;
189
+ line-height: 1.4;
172
190
 
173
191
  &:before {
174
- content: '</>';
175
- position: absolute;
176
- top: 16px;
177
- right: 16px;
178
- letter-spacing: 1px;
179
- line-height: 1;
180
- font-weight: 500;
181
- font-size: 18px;
182
- font-family: var(--font-family-mono);
183
- color: #ccc;
184
- }
185
-
186
- & code {
187
- display: flex;
188
- counter-increment: row 1;
189
- line-height: 1.4;
190
-
191
- &:before {
192
- content: counter(row);
193
- user-select: none;
194
- width: 30px;
195
- margin-right: 20px;
196
- color: #ccc;
197
- text-align: right;
198
- }
192
+ content: counter(row);
193
+ user-select: none;
194
+ width: 30px;
195
+ margin-right: 20px;
196
+ color: #ccc;
197
+ text-align: right;
199
198
  }
199
+ }
200
200
  }
201
201
 
202
202
  .button code {
203
- color: inherit;
204
- background: inherit;
203
+ color: inherit;
204
+ background: inherit;
205
205
  }
206
206
 
207
207
 
package/src/js/app.js CHANGED
@@ -33,8 +33,8 @@ window.headerAnimation = (params) => {
33
33
  // console.log(x.device.size.s);
34
34
  let _height = 100;
35
35
  // console.log(_height);
36
- let header = qs('.header');
37
- let headerLogo = qs('.header-logo img');
36
+ let header = x.qs('.header');
37
+ let headerLogo = x.qs('.header-logo img');
38
38
  let height = _height - params.progress * _height / 2;
39
39
  let scale = 1 - params.progress * 0.5;
40
40
  header.style.height = height + 'px';
@@ -44,4 +44,4 @@ window.headerAnimation = (params) => {
44
44
 
45
45
  window.onload = () => {
46
46
  x.lib.transitionsOn()
47
- }
47
+ }