@andreyshpigunov/x 0.3.72

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 (60) hide show
  1. package/.editorconfig +12 -0
  2. package/.github/workflows/publish.yml +28 -0
  3. package/README.md +37 -0
  4. package/assets/alpha.png +0 -0
  5. package/assets/apple-touch-icon.png +0 -0
  6. package/assets/github-mark-white.png +0 -0
  7. package/assets/github-mark.png +0 -0
  8. package/assets/logo-inverse.png +0 -0
  9. package/assets/logo.png +0 -0
  10. package/assets/logo.svg +9 -0
  11. package/babel.config.cjs +4 -0
  12. package/dist/app.css +167 -0
  13. package/dist/app.js +1 -0
  14. package/dist/x.css +167 -0
  15. package/dist/x.js +1 -0
  16. package/favicon.ico +0 -0
  17. package/favicon.svg +9 -0
  18. package/index.html +2214 -0
  19. package/index.js +1 -0
  20. package/jest.config.mjs +7 -0
  21. package/jsdoc.json +11 -0
  22. package/package.json +50 -0
  23. package/src/components/x/animate.js +296 -0
  24. package/src/components/x/appear.js +158 -0
  25. package/src/components/x/autocomplete.js +150 -0
  26. package/src/components/x/buttons.css +265 -0
  27. package/src/components/x/colors.css +64 -0
  28. package/src/components/x/debug.css +55 -0
  29. package/src/components/x/device.js +265 -0
  30. package/src/components/x/dropdown.css +164 -0
  31. package/src/components/x/dropdown.js +463 -0
  32. package/src/components/x/flex.css +163 -0
  33. package/src/components/x/flow.css +52 -0
  34. package/src/components/x/form.css +138 -0
  35. package/src/components/x/form.js +180 -0
  36. package/src/components/x/grid.css +109 -0
  37. package/src/components/x/helpers.css +928 -0
  38. package/src/components/x/hover.js +93 -0
  39. package/src/components/x/icons.css +58 -0
  40. package/src/components/x/lazyload.js +153 -0
  41. package/src/components/x/lib.js +679 -0
  42. package/src/components/x/links.css +114 -0
  43. package/src/components/x/loadmore.js +191 -0
  44. package/src/components/x/modal.css +286 -0
  45. package/src/components/x/modal.js +346 -0
  46. package/src/components/x/reset.css +213 -0
  47. package/src/components/x/scroll.css +100 -0
  48. package/src/components/x/scroll.js +301 -0
  49. package/src/components/x/sheets.css +15 -0
  50. package/src/components/x/sheets.js +147 -0
  51. package/src/components/x/slider.css +83 -0
  52. package/src/components/x/slider.js +330 -0
  53. package/src/components/x/space.css +56 -0
  54. package/src/components/x/sticky.css +28 -0
  55. package/src/components/x/sticky.js +156 -0
  56. package/src/components/x/typo.css +318 -0
  57. package/src/css/app.css +407 -0
  58. package/src/css/x.css +252 -0
  59. package/src/js/app.js +47 -0
  60. package/src/js/x.js +81 -0
package/src/css/x.css ADDED
@@ -0,0 +1,252 @@
1
+ /*----------------------------------------
2
+ x.css / x
3
+ Small and simple CSS & JavaScript library with interesting features
4
+
5
+ Created by Andrey Shpigunov at 20.03.2025
6
+ All right reserved.
7
+ ----------------------------------------*/
8
+
9
+
10
+ @import "../components/x/reset.css";
11
+ @import "../components/x/typo.css";
12
+ @import "../components/x/space.css";
13
+ @import "../components/x/links.css";
14
+ @import "../components/x/helpers.css";
15
+ @import "../components/x/grid.css";
16
+ @import "../components/x/flex.css";
17
+ @import "../components/x/flow.css";
18
+ @import "../components/x/form.css";
19
+ @import "../components/x/buttons.css";
20
+ @import "../components/x/dropdown.css";
21
+ @import "../components/x/sheets.css";
22
+ @import "../components/x/slider.css";
23
+ @import "../components/x/sticky.css";
24
+ @import "../components/x/modal.css";
25
+ @import "../components/x/debug.css";
26
+ @import "../components/x/scroll.css";
27
+ @import "../components/x/icons.css";
28
+ @import "../components/x/colors.css";
29
+
30
+
31
+ /*
32
+
33
+ PostCSS custom media
34
+ ====================
35
+ @custom-media --small-max (max-width: 599px);
36
+ @custom-media --medium-min (min-width: 600px);
37
+ @custom-media --medium-max (max-width: 999px);
38
+ @custom-media --large-min (min-width: 1000px);
39
+ @custom-media --xlarge-min (min-width: 1400px);
40
+ @custom-media --small (min-width: 0px);
41
+ @custom-media --medium (min-width: 600px);
42
+ @custom-media --large (min-width: 1000px);
43
+ @custom-media --xlarge (min-width: 1400px);
44
+ @custom-media --dark (prefers-color-scheme: dark);
45
+
46
+ reset.css
47
+ =========
48
+ --line-height: 1.5;
49
+ --font-color: #000;
50
+ --font-size-base: 62.5%;
51
+ --font-scale: 1;
52
+ --font-size: 1.6rem;
53
+ --font-family: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif,
54
+ "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
55
+ --font-family-mono: SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
56
+ --background-color: #fff;
57
+
58
+ typo.css
59
+ ========
60
+ --headers-margin-top: 1em;
61
+ --headers-margin-bottom: .5em;
62
+ --headers-font-family: var(--font-family);
63
+ --headers-font-weight: 700;
64
+ --headers-font-color: var(--font-color);
65
+
66
+ --h1-font-size: 2.5em;
67
+ --h2-font-size: 2.0em;
68
+ --h3-font-size: 1.5em;
69
+ --h4-font-size: 1.25em;
70
+ --h5-font-size: 1.125em;
71
+ --h6-font-size: 1.0em;
72
+
73
+ --h1-line-height: 1.2;
74
+ --h2-line-height: 1.3;
75
+ --h3-line-height: 1.4;
76
+
77
+ --paragraph-margin: 1em;
78
+
79
+ --figure-margin: 2.5em auto 2em;
80
+ --figcaption-margin-top: .5em;
81
+ --figcaption-font-size: var(--font-size);
82
+ --figcaption-color: #999;
83
+
84
+ --blockquote-margin: 2em 0;
85
+ --blockquote-padding: 1em 2em;
86
+ --blockquote-border: solid .2em var(--font-color);
87
+
88
+ --table-padding: .5em .75em;
89
+ --table-border: 1px solid #e4e4e4;
90
+ --table-header-font-weight: 700;
91
+
92
+ space.css
93
+ =========
94
+ --space-0: 0;
95
+ --space-1: 0.4rem;
96
+ --space-2: 0.8rem;
97
+ --space-3: 1.2rem;
98
+ --space-4: 1.6rem;
99
+ --space-5: 2.4rem;
100
+ --space-6: 3.2rem;
101
+ --space-7: 4.8rem;
102
+ --space-8: 6.4rem;
103
+ --space-9: 9.6rem;
104
+ --space-10: 12.8rem;
105
+
106
+ links.css
107
+ =========
108
+ --link-color: #0060cc;
109
+ --link-decoration-line: underline;
110
+ --link-decoration-style: solid;
111
+
112
+ Additional variables and their default values:
113
+ --link-color-hover: var(--link-color);
114
+ --link-color-visited: var(--link-color);
115
+ --link-decoration-line-hover: var(--link-decoration-line-hover, var(--link-decoration-line));
116
+ --link-decoration-style-hover: var(--link-decoration-style-hover, var(--link-decoration-style));
117
+ --link-decoration-thickness: .06em;
118
+ --link-decoration-color: color-mix(in srgb, currentcolor, transparent 75%);
119
+ --link-decoration-color-hover: currentcolor;
120
+ --link-decoration-color-visited: currentcolor;
121
+ --link-underline-offset: .25em;
122
+ --link-transition: all .1s ease-out;
123
+
124
+ helpers.css
125
+ ===========
126
+ --container-max-width: 160rem;
127
+
128
+ --shadow-1: 0 2px 4px #00000018;
129
+ --shadow-2: 0 4px 8px #00000018;
130
+ --shadow-3: 0 6px 12px #00000018;
131
+ --shadow-4: 0 8px 16px #00000018;
132
+ --shadow-5: 0 10px 20px #00000018;
133
+ --shadow-6: 0 12px 24px #00000018;
134
+ --shadow-7: 0 14px 28px #00000018;
135
+ --shadow-8: 0 16px 32px #00000018;
136
+ --shadow-9: 0 18px 36px #00000018;
137
+ --shadow-10: 0 20px 40px #00000018;
138
+
139
+ flow.css
140
+ ========
141
+ .flow
142
+ .flow.s[0-10] (m,l,xl) - vertical space
143
+
144
+ form.css
145
+ ========
146
+ --form-width: 40rem;
147
+ --form-height-coeff: 2.5;
148
+ --form-side-padding: 1rem;
149
+
150
+ --form-font-size: var(--font-size);
151
+ --form-font-color: #000;
152
+ --form-font-color-readonly: #000;
153
+ --form-font-color-disabled: #666;
154
+ --form-font-color-placeholder: #ccc;
155
+
156
+ --form-border-width: 0.1rem;
157
+ --form-border-radius: 0.8rem;
158
+ --form-border-color: #d4d4d4;
159
+ --form-border-color-focused: #8cf;
160
+ --form-border-color-error: #f00;
161
+ --form-border-color-readonly: #ddd;
162
+ --form-border-color-disabled: #ddd;
163
+
164
+ --form-background-color: #fff;
165
+ --form-background-color-readonly: #fafafa;
166
+ --form-background-color-disabled: #f6f6f6;
167
+
168
+ Additional variables and their default values:
169
+ --form-height: 4rem;
170
+
171
+ buttons.css
172
+ ===========
173
+ --button-height-coeff: 2.5;
174
+ --button-side-padding-coeff: 1.25;
175
+ --button-color: var(--color-grey);
176
+ --button-font-color: #000;
177
+ --button-transition: all .1s ease-out;
178
+ --button-font-size: var(--font-size);
179
+ --button-transform: scale(1);
180
+ --button-transform-hover: none;
181
+ --button-transform-active: scale(.99);
182
+ --button-transform-origin: center bottom;
183
+ --button-box-shadow: none;
184
+ --button-box-shadow-hover: none;
185
+ --button-box-shadow-active: none;
186
+
187
+ Additional variables and their default values:
188
+ --button-height: 4rem;
189
+ --button-side-padding: 2rem;
190
+ --button-font-family: var(--font-family);
191
+ --button-font-weight: 400;
192
+ --button-disabled-opacity: .5;
193
+ --button-border-radius: calc(var(--button-font-size) * 0.6);
194
+ --button-color-hover: auto;
195
+ --button-color-active: auto;
196
+ --button-font-color-hover: auto;
197
+ --button-font-color-active: auto;
198
+
199
+ dropdown.css
200
+ ============
201
+ --dropdown-border-radius: 1.2rem;
202
+ --dropdown-backgroud-color: white;
203
+ --dropdown-box-shadow: var(--shadow-4);
204
+ --dropdown-padding: .8rem;
205
+ --dropdown-item-padding: .6rem 2.4rem .6rem 1.2rem;
206
+ --dropdown-item-font-color: black;
207
+ --dropdown-item-font-color-hover: black;
208
+ --dropdown-item-background-color: white;
209
+ --dropdown-item-background-color-hover: var(--color-grey);
210
+ --dropdown-divider-color: var(--color-grey);
211
+
212
+ slides.css
213
+ ==========
214
+ --slides-point-color: #ffffff66;
215
+ --slides-point-color-active: #fff;
216
+ --slides-point-size: .3rem;
217
+ --slides-point-gap: .3rem;
218
+ --slides-point-side-padding: 1.6rem;
219
+ --slides-point-bottom-padding: 1rem;
220
+
221
+ modal.css
222
+ =========
223
+ --modal-margin-x: 3vw;
224
+ --modal-margin-y: 3vw;
225
+ --modal-padding: clamp(4rem, 4vw, 5rem) clamp(2.5rem, 4vw, 5rem);
226
+ --modal-background: #fff;
227
+ --modal-box-shadow: 0 1rem 4rem #00000033;
228
+ --modal-border-radius: 1.6rem;
229
+ --modal-closer-margin: .6rem;
230
+ --modal-closer-area: 4rem;
231
+ --modal-closer-size: 2.6rem;
232
+ --modal-closer-width: .2rem;
233
+ --modal-closer-color: #ccc;
234
+ --modal-closer-color-hover: #f00;
235
+ --modal-overlay-background-color: #00000066;
236
+
237
+ scroll.css
238
+ ==========
239
+ --scroll-scrollbar-size: 6px;
240
+ --scroll-scrollbar-thumb-background: #00000011;
241
+ --scroll-scrollbar-thumb-background-hover: #00000022;
242
+
243
+ colors.css
244
+ ==========
245
+ --color-primary: #0088ee;
246
+ --color-success: #33c433;
247
+ --color-warning: #ff8800;
248
+ --color-danger: #ee3333;
249
+ --color-error: #ee3333;
250
+ --color-grey: #f4f5f6;
251
+
252
+ */
package/src/js/app.js ADDED
@@ -0,0 +1,47 @@
1
+ //
2
+ // app.js / x
3
+ // App
4
+ //
5
+ // Created by Andrey Shpigunov at 20.03.2025
6
+ // All right reserved.
7
+ //
8
+
9
+
10
+ import './x.js';
11
+ // import Alpine from 'alpinejs'
12
+
13
+
14
+ // window.Alpine = Alpine;
15
+ // Alpine.start();
16
+
17
+ x.init();
18
+
19
+ // Animation global functions
20
+ window.element1 = (params) => {
21
+ let rotate = params.progress * -360;
22
+ params.element.style.transform = 'rotate(' + rotate + 'deg)';
23
+ }
24
+ window.element2 = (params) => {
25
+ let rotate = params.progress * 180;
26
+ params.element.style.transform = 'rotate(' + rotate + 'deg)';
27
+ }
28
+ window.element3 = (params) => {
29
+ let rotate = params.progress * 120;
30
+ params.element.style.transform = 'rotate(' + rotate + 'deg)';
31
+ }
32
+ window.headerAnimation = (params) => {
33
+ // console.log(x.device.size.s);
34
+ let _height = x.device.size.s ? 100 : 120;
35
+ // console.log(_height);
36
+ let header = qs('.header');
37
+ let headerLogo = qs('.header-logo img');
38
+ let height = _height - params.progress * _height / 2;
39
+ let scale = 1 - params.progress * 0.5;
40
+ header.style.height = height + 'px';
41
+ headerLogo.style.transform = 'scale(' + scale + ')';
42
+ x.lib.switchClass(header, 'header_compact', params.progress == 1);
43
+ }
44
+
45
+ window.onload = () => {
46
+ x.lib.transitionsOn()
47
+ }
package/src/js/x.js ADDED
@@ -0,0 +1,81 @@
1
+ //
2
+ // x.js / x
3
+ // Small and simple CSS & JavaScript library with interesting features
4
+ //
5
+ // Created by Andrey Shpigunov at 20.03.2025
6
+ // All right reserved.
7
+ //
8
+
9
+
10
+ import { modal } from "../components/x/modal";
11
+ import { animate } from "../components/x/animate";
12
+ import { appear } from "../components/x/appear";
13
+ import { lazyload } from "../components/x/lazyload";
14
+ import { loadmore } from "../components/x/loadmore";
15
+ import { sheets } from "../components/x/sheets";
16
+ import { dropdown } from "../components/x/dropdown";
17
+ import { autocomplete } from "../components/x/autocomplete";
18
+ import { scroll } from "../components/x/scroll";
19
+ import { hover } from "../components/x/hover";
20
+ import { device } from "../components/x/device";
21
+ import { lib } from "../components/x/lib";
22
+ import { form } from "../components/x/form";
23
+ import { sticky } from "../components/x/sticky";
24
+ import { slider } from "../components/x/slider";
25
+
26
+
27
+ class X {
28
+ constructor() {
29
+ this.modal = modal;
30
+ this.animate = animate;
31
+ this.appear = appear;
32
+ this.lazyload = lazyload;
33
+ this.loadmore = loadmore;
34
+ this.sheets = sheets;
35
+ this.dropdown = dropdown;
36
+ this.autocomplete = autocomplete;
37
+ this.scroll = scroll;
38
+ this.hover = hover;
39
+ this.device = device;
40
+ this.lib = lib;
41
+ this.render = lib.render.bind(lib);
42
+ this.form = form;
43
+ this.sticky = sticky;
44
+ this.slider = slider;
45
+
46
+ this.initialized = false;
47
+ }
48
+
49
+ init() {
50
+ if (!this.initialized) {
51
+ this.device.init();
52
+ this.modal.init();
53
+ this.animate.init();
54
+ this.appear.init();
55
+ this.lazyload.init();
56
+ this.loadmore.init();
57
+ this.sheets.init();
58
+ this.dropdown.init();
59
+ this.scroll.init();
60
+ this.sticky.init();
61
+ this.slider.init();
62
+ hover();
63
+
64
+ this.initialized = true;
65
+ }
66
+ }
67
+ };
68
+
69
+ const x = new X();
70
+
71
+ // Make 'x' as global variable
72
+ window.x = x;
73
+
74
+ // Query selectors shorthands
75
+ window.qs = x.lib.qs;
76
+ window.qsa = x.lib.qsa;
77
+
78
+ // New shortcuts for selectors
79
+ window.x.id = x.lib.id;
80
+ window.x.qs = x.lib.qs;
81
+ window.x.qsa = x.lib.qsa;