uikit 3.11.2-dev.bbaa4362f → 3.11.2-dev.c7ed3c19b
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/.eslintrc.json +4 -49
- package/.prettierignore +14 -0
- package/.prettierrc.json +13 -0
- package/.webstorm.js +3 -3
- package/CHANGELOG.md +8 -0
- package/build/.eslintrc.json +1 -3
- package/build/build.js +26 -28
- package/build/icons.js +7 -11
- package/build/less.js +48 -36
- package/build/package.json +2 -2
- package/build/prefix.js +21 -18
- package/build/publishDev.js +6 -8
- package/build/release.js +20 -17
- package/build/scope.js +21 -11
- package/build/scss.js +72 -39
- package/build/util.js +71 -62
- package/build/wrapper/icons.js +0 -2
- package/dist/css/uikit-core-rtl.css +42 -17
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +42 -17
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +42 -17
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +42 -17
- package/dist/css/uikit.min.css +1 -1
- package/dist/js/components/countdown.js +88 -133
- package/dist/js/components/countdown.min.js +1 -1
- package/dist/js/components/filter.js +409 -438
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +1116 -1305
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +1164 -1383
- package/dist/js/components/lightbox.min.js +1 -1
- package/dist/js/components/notification.js +94 -114
- package/dist/js/components/notification.min.js +1 -1
- package/dist/js/components/parallax.js +294 -345
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +292 -344
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +727 -850
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +292 -344
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +615 -799
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +588 -619
- package/dist/js/components/sortable.min.js +1 -1
- package/dist/js/components/tooltip.js +324 -356
- package/dist/js/components/tooltip.min.js +1 -1
- package/dist/js/components/upload.js +155 -167
- package/dist/js/components/upload.min.js +1 -1
- package/dist/js/uikit-core.js +5356 -6709
- package/dist/js/uikit-core.min.js +1 -1
- package/dist/js/uikit-icons.js +7 -9
- package/dist/js/uikit-icons.min.js +1 -1
- package/dist/js/uikit.js +8116 -9913
- package/dist/js/uikit.min.js +1 -1
- package/jsconfig.json +1 -1
- package/package.json +64 -60
- package/src/js/api/boot.js +25 -32
- package/src/js/api/component.js +23 -27
- package/src/js/api/global.js +6 -12
- package/src/js/api/hooks.js +13 -32
- package/src/js/api/instance.js +7 -15
- package/src/js/api/state.js +79 -100
- package/src/js/components/countdown.js +24 -50
- package/src/js/components/filter.js +71 -66
- package/src/js/components/index.js +13 -13
- package/src/js/components/internal/lightbox-animations.js +11 -23
- package/src/js/components/internal/slider-transitioner.js +66 -45
- package/src/js/components/internal/slideshow-animations.js +42 -61
- package/src/js/components/lightbox-panel.js +135 -109
- package/src/js/components/lightbox.js +18 -39
- package/src/js/components/notification.js +49 -43
- package/src/js/components/parallax.js +16 -30
- package/src/js/components/slider-parallax.js +13 -23
- package/src/js/components/slider.js +75 -64
- package/src/js/components/slideshow-parallax.js +1 -1
- package/src/js/components/slideshow.js +8 -13
- package/src/js/components/sortable.js +125 -106
- package/src/js/components/tooltip.js +41 -31
- package/src/js/components/upload.js +52 -63
- package/src/js/core/accordion.js +53 -48
- package/src/js/core/alert.js +10 -17
- package/src/js/core/core.js +74 -53
- package/src/js/core/cover.js +11 -15
- package/src/js/core/drop.js +107 -93
- package/src/js/core/form-custom.js +20 -25
- package/src/js/core/gif.js +3 -7
- package/src/js/core/grid.js +57 -58
- package/src/js/core/height-match.js +16 -29
- package/src/js/core/height-viewport.js +28 -35
- package/src/js/core/icon.js +38 -50
- package/src/js/core/img.js +59 -58
- package/src/js/core/index.js +39 -39
- package/src/js/core/leader.js +9 -18
- package/src/js/core/margin.js +21 -37
- package/src/js/core/modal.js +50 -36
- package/src/js/core/nav.js +2 -4
- package/src/js/core/navbar.js +112 -88
- package/src/js/core/offcanvas.js +49 -53
- package/src/js/core/overflow-auto.js +13 -17
- package/src/js/core/responsive.js +14 -12
- package/src/js/core/scroll.js +10 -20
- package/src/js/core/scrollspy-nav.js +34 -31
- package/src/js/core/scrollspy.js +37 -54
- package/src/js/core/sticky.js +130 -91
- package/src/js/core/svg.js +60 -79
- package/src/js/core/switcher.js +47 -46
- package/src/js/core/tab.js +7 -10
- package/src/js/core/toggle.js +64 -66
- package/src/js/core/video.js +11 -22
- package/src/js/mixin/animate.js +19 -20
- package/src/js/mixin/class.js +2 -4
- package/src/js/mixin/container.js +7 -11
- package/src/js/mixin/internal/animate-fade.js +73 -30
- package/src/js/mixin/internal/animate-slide.js +61 -41
- package/src/js/mixin/internal/slideshow-animations.js +7 -14
- package/src/js/mixin/internal/slideshow-transitioner.js +10 -17
- package/src/js/mixin/media.js +5 -10
- package/src/js/mixin/modal.js +89 -66
- package/src/js/mixin/parallax.js +53 -48
- package/src/js/mixin/position.js +26 -20
- package/src/js/mixin/slider-autoplay.js +12 -21
- package/src/js/mixin/slider-drag.js +64 -65
- package/src/js/mixin/slider-nav.js +26 -35
- package/src/js/mixin/slider-reactive.js +2 -8
- package/src/js/mixin/slider.js +51 -50
- package/src/js/mixin/slideshow.js +13 -19
- package/src/js/mixin/togglable.js +90 -63
- package/src/js/uikit-core.js +2 -4
- package/src/js/uikit.js +2 -4
- package/src/js/util/ajax.js +27 -43
- package/src/js/util/animation.js +82 -75
- package/src/js/util/attr.js +17 -21
- package/src/js/util/class.js +14 -52
- package/src/js/util/dimensions.js +56 -43
- package/src/js/util/dom.js +40 -73
- package/src/js/util/env.js +7 -12
- package/src/js/util/event.js +60 -59
- package/src/js/util/fastdom.js +1 -6
- package/src/js/util/filter.js +17 -34
- package/src/js/util/index.js +0 -1
- package/src/js/util/lang.js +79 -119
- package/src/js/util/mouse.js +19 -17
- package/src/js/util/options.js +44 -49
- package/src/js/util/player.js +40 -36
- package/src/js/util/position.js +54 -46
- package/src/js/util/selector.js +34 -49
- package/src/js/util/style.js +36 -46
- package/src/js/util/viewport.js +75 -64
- package/src/less/components/flex.less +0 -9
- package/src/less/components/navbar.less +0 -7
- package/src/less/components/utility.less +22 -0
- package/src/scss/components/flex.scss +0 -9
- package/src/scss/components/form.scss +3 -3
- package/src/scss/components/icon.scss +2 -2
- package/src/scss/components/navbar.scss +0 -7
- package/src/scss/components/search.scss +1 -1
- package/src/scss/components/utility.scss +22 -0
- package/src/scss/variables-theme.scss +6 -6
- package/src/scss/variables.scss +6 -6
- package/tests/js/index.js +114 -85
- package/src/js/mixin/flex-bug.js +0 -56
- package/src/js/util/promise.js +0 -191
package/build/scope.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {args, glob, minify, read, renderLess, replaceInFile, validClassName} from './util.js';
|
|
1
|
+
import { args, glob, minify, read, renderLess, replaceInFile, validClassName } from './util.js';
|
|
2
2
|
|
|
3
3
|
if (args.h || args.help) {
|
|
4
4
|
console.log(`
|
|
@@ -33,7 +33,6 @@ if (args.cleanup && prevScope) {
|
|
|
33
33
|
|
|
34
34
|
await cleanup(files, prevScope);
|
|
35
35
|
await scope(files, newScope);
|
|
36
|
-
|
|
37
36
|
} else {
|
|
38
37
|
await scope(files, getNewScope());
|
|
39
38
|
}
|
|
@@ -41,7 +40,7 @@ if (args.cleanup && prevScope) {
|
|
|
41
40
|
async function getScope(files) {
|
|
42
41
|
for (const file of files) {
|
|
43
42
|
const data = await read(file);
|
|
44
|
-
const [, scope] =
|
|
43
|
+
const [, scope] = data.match(currentScopeRe) || data.match(currentScopeLegacyRe) || [];
|
|
45
44
|
if (scope) {
|
|
46
45
|
return scope;
|
|
47
46
|
}
|
|
@@ -50,7 +49,6 @@ async function getScope(files) {
|
|
|
50
49
|
}
|
|
51
50
|
|
|
52
51
|
function getNewScope() {
|
|
53
|
-
|
|
54
52
|
const scopeFromInput = args.scope || args.s || 'uk-scope';
|
|
55
53
|
|
|
56
54
|
if (validClassName.test(scopeFromInput)) {
|
|
@@ -62,10 +60,16 @@ function getNewScope() {
|
|
|
62
60
|
|
|
63
61
|
async function scope(files, scope) {
|
|
64
62
|
for (const file of files) {
|
|
65
|
-
await replaceInFile(file, async data => {
|
|
63
|
+
await replaceInFile(file, async (data) => {
|
|
66
64
|
const output = await renderLess(`.${scope} {\n${stripComments(data)}\n}`);
|
|
67
65
|
return `/* scoped: ${scope} */\n${
|
|
68
|
-
output.replace(
|
|
66
|
+
output.replace(
|
|
67
|
+
new RegExp(
|
|
68
|
+
`.${scope}\\s((\\.(uk-(drag|modal-page|offcanvas-page|offcanvas-flip)))|html|:root)`,
|
|
69
|
+
'g'
|
|
70
|
+
),
|
|
71
|
+
'$1'
|
|
72
|
+
) // unescape
|
|
69
73
|
}`;
|
|
70
74
|
});
|
|
71
75
|
await minify(file);
|
|
@@ -73,11 +77,17 @@ async function scope(files, scope) {
|
|
|
73
77
|
}
|
|
74
78
|
|
|
75
79
|
async function cleanup(files, scope) {
|
|
76
|
-
const string = scope
|
|
80
|
+
const string = scope
|
|
81
|
+
.split(' ')
|
|
82
|
+
.map((scope) => `.${scope}`)
|
|
83
|
+
.join(' ');
|
|
77
84
|
for (const file of files) {
|
|
78
|
-
await replaceInFile(
|
|
79
|
-
|
|
80
|
-
|
|
85
|
+
await replaceInFile(
|
|
86
|
+
file,
|
|
87
|
+
(data) =>
|
|
88
|
+
data
|
|
89
|
+
.replace(currentScopeRe, '') // remove scope comment
|
|
90
|
+
.replace(new RegExp(` *${string} ({[\\s\\S]*?})?`, 'g'), '') // replace classes
|
|
81
91
|
);
|
|
82
92
|
}
|
|
83
93
|
}
|
|
@@ -86,6 +96,6 @@ function stripComments(input) {
|
|
|
86
96
|
return input
|
|
87
97
|
.replace(/\/\*(.|\n)*?\*\//gm, '')
|
|
88
98
|
.split('\n')
|
|
89
|
-
.filter(line => line.trim().substr(0, 2) !== '//')
|
|
99
|
+
.filter((line) => line.trim().substr(0, 2) !== '//')
|
|
90
100
|
.join('\n');
|
|
91
101
|
}
|
package/build/scss.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import NP from 'number-precision';
|
|
2
|
-
import {glob, read, write} from './util.js';
|
|
2
|
+
import { glob, read, write } from './util.js';
|
|
3
3
|
|
|
4
4
|
NP.enableBoundaryChecking(false);
|
|
5
5
|
|
|
@@ -74,14 +74,17 @@ const inverseTemplate = ` @include hook-inverse-component-base();
|
|
|
74
74
|
|
|
75
75
|
/* First Step: Go through all files */
|
|
76
76
|
for (const file of await glob('src/less/**/*.less')) {
|
|
77
|
-
|
|
78
77
|
const data = await read(file);
|
|
79
78
|
|
|
80
79
|
/* replace all Less stuff with SCSS */
|
|
81
|
-
let scssData = data
|
|
80
|
+
let scssData = data
|
|
81
|
+
.replace(/\/less\//g, '/scss/') // change less/ dir to scss/ on imports
|
|
82
82
|
.replace(/\.less/g, '.scss') // change .less extensions to .scss on imports
|
|
83
83
|
.replace(/@/g, '$') // convert variables
|
|
84
|
-
.replace(
|
|
84
|
+
.replace(
|
|
85
|
+
/(:[^'"]*?\([^'"]+?)\s*\/\s*([0-9.-]+)\)/g,
|
|
86
|
+
(exp, m1, m2) => `${m1} * ${NP.round(1 / parseFloat(m2), 5)})`
|
|
87
|
+
)
|
|
85
88
|
.replace(/--uk-[^\s]+: (\$[^\s]+);/g, (exp, name) => exp.replace(name, `#{${name}}`))
|
|
86
89
|
.replace(/\\\$/g, '\\@') // revert classes using the @ symbol
|
|
87
90
|
.replace(/ e\(/g, ' unquote(') // convert escape function
|
|
@@ -89,14 +92,30 @@ for (const file of await glob('src/less/**/*.less')) {
|
|
|
89
92
|
.replace(/(\$[\w-]*)\s*:(.*);/g, '$1: $2 !default;') // make variables optional
|
|
90
93
|
.replace(/@mixin ([\w-]*)\s*\((.*)\)\s*{\s*}/g, '// @mixin $1($2){}') // comment empty mixins
|
|
91
94
|
.replace(/\.(hook[a-zA-Z\-\d]+)(\(\))?;/g, '@if(mixin-exists($1)) {@include $1();}') // hook calls surrounded by a mixin-exists
|
|
92
|
-
.replace(
|
|
95
|
+
.replace(
|
|
96
|
+
/\$(import|supports|media|font-face|page|-ms-viewport|keyframes|-webkit-keyframes|-moz-document)/g,
|
|
97
|
+
'@$1'
|
|
98
|
+
) // replace valid '@' statements
|
|
93
99
|
.replace(/tint\((\$[\w-]+),\s([^)]*)\)/g, 'mix(white, $1, $2)') // replace Less function tint with mix
|
|
94
|
-
.replace(/fade\((\$[\w-]*), ([0-9]+)%\)/g, (match, p1, p2) => {
|
|
95
|
-
|
|
100
|
+
.replace(/fade\((\$[\w-]*), ([0-9]+)%\)/g, (match, p1, p2) => {
|
|
101
|
+
return `rgba(${p1}, ${p2 / 100})`;
|
|
102
|
+
}) // replace Less function fade with rgba
|
|
103
|
+
.replace(/fade(in|out)\((\$[\w-]*), ([0-9]+)%\)/g, (match, p1, p2, p3) => {
|
|
104
|
+
return `fade-${p1}(${p2}, ${p3 / 100})`;
|
|
105
|
+
}) // replace Less function fadeout with fade-out
|
|
96
106
|
.replace(/\.svg-fill/g, '@include svg-fill') // include svg-fill mixin
|
|
97
|
-
.replace(
|
|
98
|
-
|
|
99
|
-
|
|
107
|
+
.replace(
|
|
108
|
+
/(.*):extend\((\.[\w-\\@]*) all\) when \((\$[\w-]*) = ([\w]+)\) {}/g,
|
|
109
|
+
'@if ( $3 == $4 ) { $1 { @extend $2 !optional;} }'
|
|
110
|
+
) // update conditional extend and add !optional to ignore warnings
|
|
111
|
+
.replace(
|
|
112
|
+
/(\.[\w-\\@]+)\s*when\s*\((\$[\w-]*)\s*=\s*(\w+)\)\s*{\s*@if\(mixin-exists\(([\w-]*)\)\) {@include\s([\w-]*)\(\);\s*}\s*}/g,
|
|
113
|
+
'@if ($2 == $3) { $1 { @if (mixin-exists($4)) {@include $4();}}}'
|
|
114
|
+
) // update conditional hook
|
|
115
|
+
.replace(
|
|
116
|
+
/(\.[\w-\\@]+)\s*when\s*\((\$[\w-]*)\s*=\s*(\w+)\)\s*({\s*.*?\s*})/gs,
|
|
117
|
+
'@if ($2 == $3) {\n$1 $4\n}'
|
|
118
|
+
) // replace conditionals
|
|
100
119
|
.replace(/\${/g, '#{$') // string literals: from: /~"(.*)"/g, to: '#{"$1"}'
|
|
101
120
|
.replace(/[^(](-\$[\w-]*)/g, ' ($1)') // surround negative variables with brackets
|
|
102
121
|
.replace(/(--[\w-]+:\s*)~'([^']+)'/g, '$1$2') // string literals in custom properties
|
|
@@ -124,7 +143,10 @@ for (const file of await glob('src/less/**/*.less')) {
|
|
|
124
143
|
/* remove the theme import first place */
|
|
125
144
|
scssData = scssData.replace(/\/\/\n\/\/ Theme\n\/\/\n\n@import "theme\/_import.scss";/, '');
|
|
126
145
|
/* add uikit-mixins and uikit-variables include to the uikit.scss file and change order, to load theme files first */
|
|
127
|
-
scssData = scssData.replace(
|
|
146
|
+
scssData = scssData.replace(
|
|
147
|
+
/\/\/ Core\n\/\//g,
|
|
148
|
+
'// Theme\n//\n\n@import "theme/_import.scss";'
|
|
149
|
+
);
|
|
128
150
|
}
|
|
129
151
|
|
|
130
152
|
/* mixin.less needs to be fully replaced by the new mixin file*/
|
|
@@ -133,27 +155,34 @@ for (const file of await glob('src/less/**/*.less')) {
|
|
|
133
155
|
}
|
|
134
156
|
|
|
135
157
|
await write(file.replace(/less/g, 'scss').replace('.theme.', '-theme.'), scssData);
|
|
136
|
-
|
|
137
158
|
}
|
|
138
159
|
|
|
139
160
|
/* Second Step write all new needed files for SASS */
|
|
140
161
|
|
|
141
162
|
/* write mixins into new file */
|
|
142
|
-
const mixins_theme = Object.keys(themeMixins).map(function (key) {
|
|
163
|
+
const mixins_theme = Object.keys(themeMixins).map(function (key) {
|
|
164
|
+
return themeMixins[key];
|
|
165
|
+
});
|
|
143
166
|
await write('src/scss/mixins-theme.scss', mixins_theme.join('\n'));
|
|
144
167
|
|
|
145
|
-
const mixins_core = Object.keys(coreMixins).map(function (key) {
|
|
168
|
+
const mixins_core = Object.keys(coreMixins).map(function (key) {
|
|
169
|
+
return coreMixins[key];
|
|
170
|
+
});
|
|
146
171
|
await write('src/scss/mixins.scss', mixins_core.join('\n'));
|
|
147
172
|
|
|
148
173
|
/* write core variables */
|
|
149
174
|
const compactCoreVar = new Set();
|
|
150
|
-
Object.keys(coreVar).map(
|
|
175
|
+
Object.keys(coreVar).map((key) =>
|
|
176
|
+
getAllDependencies(coreVar, key).forEach((dependency) => compactCoreVar.add(dependency))
|
|
177
|
+
);
|
|
151
178
|
|
|
152
179
|
await write('src/scss/variables.scss', Array.from(compactCoreVar).join('\n'));
|
|
153
180
|
|
|
154
181
|
/* write theme variables */
|
|
155
182
|
const compactThemeVar = new Set();
|
|
156
|
-
Object.keys(themeVar).map(
|
|
183
|
+
Object.keys(themeVar).map((key) =>
|
|
184
|
+
getAllDependencies(themeVar, key).forEach((dependency) => compactThemeVar.add(dependency))
|
|
185
|
+
);
|
|
157
186
|
|
|
158
187
|
await write('src/scss/variables-theme.scss', Array.from(compactThemeVar).join('\n'));
|
|
159
188
|
|
|
@@ -162,15 +191,14 @@ await write('src/scss/variables-theme.scss', Array.from(compactThemeVar).join('\
|
|
|
162
191
|
* @return Set with all the dependencies.
|
|
163
192
|
*/
|
|
164
193
|
function getAllDependencies(allVariables, currentKey, dependencies = new Set()) {
|
|
165
|
-
|
|
166
194
|
if (!allVariables[currentKey].dependencies.length) {
|
|
167
|
-
|
|
168
195
|
dependencies.add(`${currentKey}: ${allVariables[currentKey].value}`);
|
|
169
196
|
return Array.from(dependencies);
|
|
170
197
|
} else {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
198
|
+
allVariables[currentKey].dependencies.forEach((dependecy) => {
|
|
199
|
+
getAllDependencies(allVariables, dependecy, dependencies).forEach((newDependency) =>
|
|
200
|
+
dependencies.add(newDependency)
|
|
201
|
+
);
|
|
174
202
|
});
|
|
175
203
|
|
|
176
204
|
dependencies.add(`${currentKey}: ${allVariables[currentKey].value}`);
|
|
@@ -183,14 +211,17 @@ function getAllDependencies(allVariables, currentKey, dependencies = new Set())
|
|
|
183
211
|
* @return an updated data where the mixins have been removed.
|
|
184
212
|
*/
|
|
185
213
|
function getMixinsFromFile(file, data) {
|
|
186
|
-
|
|
187
214
|
/* Step 1: get all includes and insert them, so that at least empty mixins exist. */
|
|
188
215
|
let regex = /@include ([a-z0-9-]+)/g;
|
|
189
216
|
let match = regex.exec(data);
|
|
190
217
|
|
|
191
218
|
while (match) {
|
|
192
|
-
if (!(match[1] in themeMixins)) {
|
|
193
|
-
|
|
219
|
+
if (!(match[1] in themeMixins)) {
|
|
220
|
+
themeMixins[match[1]] = `@mixin ${match[1]}(){}`;
|
|
221
|
+
}
|
|
222
|
+
if (!(match[1] in coreMixins)) {
|
|
223
|
+
coreMixins[match[1]] = `@mixin ${match[1]}(){}`;
|
|
224
|
+
}
|
|
194
225
|
|
|
195
226
|
match = regex.exec(data);
|
|
196
227
|
}
|
|
@@ -201,7 +232,7 @@ function getMixinsFromFile(file, data) {
|
|
|
201
232
|
|
|
202
233
|
while (match) {
|
|
203
234
|
[themeMixins[match[1]]] = match;
|
|
204
|
-
if (file.
|
|
235
|
+
if (!file.includes('theme/')) {
|
|
205
236
|
[coreMixins[match[1]]] = match;
|
|
206
237
|
}
|
|
207
238
|
match = regex.exec(data);
|
|
@@ -213,7 +244,7 @@ function getMixinsFromFile(file, data) {
|
|
|
213
244
|
|
|
214
245
|
while (match) {
|
|
215
246
|
[themeMixins[match[1]]] = match;
|
|
216
|
-
if (file.
|
|
247
|
+
if (!file.includes('theme/')) {
|
|
217
248
|
[coreMixins[match[1]]] = match;
|
|
218
249
|
}
|
|
219
250
|
|
|
@@ -235,15 +266,15 @@ async function getVariablesFromFile(file, data) {
|
|
|
235
266
|
let match = regex.exec(data);
|
|
236
267
|
|
|
237
268
|
while (match) {
|
|
238
|
-
|
|
239
269
|
/* check if variable is a background icon, if so replace it directly by the SVG */
|
|
240
|
-
if (match[0].
|
|
241
|
-
|
|
242
|
-
|
|
270
|
+
if (match[0].includes('../../images/backgrounds')) {
|
|
271
|
+
const iconregex =
|
|
272
|
+
/(\$[\w-]+)\s*:\s*"\.\.\/\.\.\/images\/backgrounds\/([\w./-]+)" !default;/g;
|
|
243
273
|
const iconmatch = iconregex.exec(match[0]);
|
|
244
274
|
let svg = (await read(`src/images/backgrounds/${iconmatch[2]}`)).toString();
|
|
245
|
-
svg = `"${svg
|
|
246
|
-
.replace(/
|
|
275
|
+
svg = `"${svg
|
|
276
|
+
.replace(/\r?\n|\r/g, '%0A')
|
|
277
|
+
.replace(/"/g, "'")
|
|
247
278
|
.replace(/\s/g, '%20')
|
|
248
279
|
.replace(/</g, '%3C')
|
|
249
280
|
.replace(/=/g, '%3D')
|
|
@@ -254,11 +285,11 @@ async function getVariablesFromFile(file, data) {
|
|
|
254
285
|
.replace(/%3Csvg/, 'data:image/svg+xml;charset=UTF-8,%3Csvg')}"`;
|
|
255
286
|
|
|
256
287
|
/* add SVG to the coreVar and themeVar only if it is a theme file and make it optional */
|
|
257
|
-
if (file.
|
|
258
|
-
coreVar[iconmatch[1]] = {value: `${svg} !default;`, dependencies: []};
|
|
288
|
+
if (!file.includes('theme/')) {
|
|
289
|
+
coreVar[iconmatch[1]] = { value: `${svg} !default;`, dependencies: [] };
|
|
259
290
|
}
|
|
260
291
|
|
|
261
|
-
themeVar[iconmatch[1]] = {value: `${svg} !default;`, dependencies: []};
|
|
292
|
+
themeVar[iconmatch[1]] = { value: `${svg} !default;`, dependencies: [] };
|
|
262
293
|
|
|
263
294
|
/* add SVG to the variable within the file itself as well */
|
|
264
295
|
const inlineSVG = `${iconmatch[1]}: ${svg} !default;`;
|
|
@@ -266,7 +297,6 @@ async function getVariablesFromFile(file, data) {
|
|
|
266
297
|
|
|
267
298
|
/* when it is not an SVG add the variable and search for its dependencies */
|
|
268
299
|
} else {
|
|
269
|
-
|
|
270
300
|
const variablesRegex = /(\$[\w-]+)/g;
|
|
271
301
|
let variablesMatch = variablesRegex.exec(match[2]);
|
|
272
302
|
const dependencies = [];
|
|
@@ -277,11 +307,14 @@ async function getVariablesFromFile(file, data) {
|
|
|
277
307
|
}
|
|
278
308
|
|
|
279
309
|
/* add variables only to the core Variables if it is not a theme file */
|
|
280
|
-
if (file.
|
|
281
|
-
coreVar[match[1]] = {
|
|
310
|
+
if (!file.includes('theme/')) {
|
|
311
|
+
coreVar[match[1]] = {
|
|
312
|
+
value: `${match[2]};`,
|
|
313
|
+
dependencies: Array.from(dependencies),
|
|
314
|
+
};
|
|
282
315
|
}
|
|
283
316
|
|
|
284
|
-
themeVar[match[1]] = {value: `${match[2]};`, dependencies: Array.from(dependencies)};
|
|
317
|
+
themeVar[match[1]] = { value: `${match[2]};`, dependencies: Array.from(dependencies) };
|
|
285
318
|
}
|
|
286
319
|
|
|
287
320
|
match = regex.exec(data);
|
package/build/util.js
CHANGED
|
@@ -2,32 +2,32 @@ import less from 'less';
|
|
|
2
2
|
import fs from 'fs-extra';
|
|
3
3
|
import pLimit from 'p-limit';
|
|
4
4
|
import globImport from 'glob';
|
|
5
|
-
import {optimize} from 'svgo';
|
|
6
|
-
import {promisify} from 'util';
|
|
5
|
+
import { optimize } from 'svgo';
|
|
6
|
+
import { promisify } from 'util';
|
|
7
7
|
import minimist from 'minimist';
|
|
8
8
|
import CleanCSS from 'clean-css';
|
|
9
9
|
import html from 'rollup-plugin-html';
|
|
10
|
-
import buble from '@rollup/plugin-buble';
|
|
11
10
|
import alias from '@rollup/plugin-alias';
|
|
12
11
|
import modify from 'rollup-plugin-modify';
|
|
12
|
+
import { babel } from '@rollup/plugin-babel';
|
|
13
13
|
import replace from '@rollup/plugin-replace';
|
|
14
|
-
import {basename, dirname, join} from 'path';
|
|
15
|
-
import {exec as execImport} from 'child_process';
|
|
16
|
-
import {rollup, watch as rollupWatch} from 'rollup';
|
|
17
|
-
import {minify as rollupMinify} from 'rollup-plugin-esbuild';
|
|
14
|
+
import { basename, dirname, join } from 'path';
|
|
15
|
+
import { exec as execImport } from 'child_process';
|
|
16
|
+
import { rollup, watch as rollupWatch } from 'rollup';
|
|
17
|
+
import { minify as rollupMinify } from 'rollup-plugin-esbuild';
|
|
18
18
|
|
|
19
19
|
const limit = pLimit(Number(process.env.cpus || 2));
|
|
20
20
|
|
|
21
21
|
export const exec = promisify(execImport);
|
|
22
22
|
export const glob = promisify(globImport);
|
|
23
|
-
export const {pathExists, readJson} = fs;
|
|
23
|
+
export const { pathExists, readJson } = fs;
|
|
24
24
|
|
|
25
25
|
export const banner = `/*! UIkit ${await getVersion()} | https://www.getuikit.com | (c) 2014 - ${new Date().getFullYear()} YOOtheme | MIT License */\n`;
|
|
26
26
|
export const validClassName = /[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/;
|
|
27
27
|
|
|
28
28
|
const argv = minimist(process.argv.slice(2));
|
|
29
29
|
|
|
30
|
-
argv._.forEach(arg => {
|
|
30
|
+
argv._.forEach((arg) => {
|
|
31
31
|
const tokens = arg.split('=');
|
|
32
32
|
argv[tokens[0]] = tokens[1] || true;
|
|
33
33
|
});
|
|
@@ -39,7 +39,6 @@ export function read(file) {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export async function write(dest, data) {
|
|
42
|
-
|
|
43
42
|
const err = await fs.writeFile(dest, data);
|
|
44
43
|
|
|
45
44
|
if (err) {
|
|
@@ -50,7 +49,6 @@ export async function write(dest, data) {
|
|
|
50
49
|
await logFile(dest);
|
|
51
50
|
|
|
52
51
|
return dest;
|
|
53
|
-
|
|
54
52
|
}
|
|
55
53
|
|
|
56
54
|
export async function logFile(file) {
|
|
@@ -59,26 +57,25 @@ export async function logFile(file) {
|
|
|
59
57
|
}
|
|
60
58
|
|
|
61
59
|
export async function minify(file) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
60
|
+
const { styles } = await limit(() =>
|
|
61
|
+
new CleanCSS({
|
|
62
|
+
advanced: false,
|
|
63
|
+
keepSpecialComments: 0,
|
|
64
|
+
rebase: false,
|
|
65
|
+
returnPromise: true,
|
|
66
|
+
}).minify([file])
|
|
67
|
+
);
|
|
69
68
|
|
|
70
69
|
await write(`${join(dirname(file), basename(file, '.css'))}.min.css`, styles);
|
|
71
70
|
|
|
72
71
|
return styles;
|
|
73
|
-
|
|
74
72
|
}
|
|
75
73
|
|
|
76
74
|
export function renderLess(data, options) {
|
|
77
75
|
return limit(async () => (await less.render(data, options)).css);
|
|
78
76
|
}
|
|
79
77
|
|
|
80
|
-
export async function compile(file, dest, {external, globals, name, aliases, replaces} = {}) {
|
|
81
|
-
|
|
78
|
+
export async function compile(file, dest, { external, globals, name, aliases, replaces } = {}) {
|
|
82
79
|
const minify = !args.nominify;
|
|
83
80
|
const debug = args.d || args.debug;
|
|
84
81
|
const watch = args.w || args.watch;
|
|
@@ -93,48 +90,65 @@ export async function compile(file, dest, {external, globals, name, aliases, rep
|
|
|
93
90
|
preventAssignment: true,
|
|
94
91
|
values: {
|
|
95
92
|
VERSION: `'${await getVersion()}'`,
|
|
96
|
-
...replaces
|
|
97
|
-
}
|
|
93
|
+
...replaces,
|
|
94
|
+
},
|
|
98
95
|
}),
|
|
99
96
|
alias({
|
|
100
97
|
entries: {
|
|
101
98
|
'uikit-util': './src/js/util/index.js',
|
|
102
|
-
...aliases
|
|
103
|
-
}
|
|
99
|
+
...aliases,
|
|
100
|
+
},
|
|
104
101
|
}),
|
|
105
102
|
html({
|
|
106
103
|
include: '**/*.svg',
|
|
107
104
|
htmlMinifierOptions: {
|
|
108
|
-
collapseWhitespace: true
|
|
109
|
-
}
|
|
105
|
+
collapseWhitespace: true,
|
|
106
|
+
},
|
|
107
|
+
}),
|
|
108
|
+
babel({
|
|
109
|
+
presets: [
|
|
110
|
+
[
|
|
111
|
+
'@babel/preset-env',
|
|
112
|
+
{
|
|
113
|
+
loose: true,
|
|
114
|
+
targets: {
|
|
115
|
+
safari: '12',
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
],
|
|
120
|
+
extensions: ['.js'],
|
|
121
|
+
babelHelpers: 'bundled',
|
|
122
|
+
retainLines: true,
|
|
110
123
|
}),
|
|
111
|
-
buble({namedFunctionExpressions: false}),
|
|
112
124
|
modify({
|
|
113
125
|
find: /(>)\\n\s+|\\n\s+(<)/,
|
|
114
|
-
replace: (m, m1, m2) => `${m1 || ''} ${m2 || ''}
|
|
115
|
-
})
|
|
116
|
-
]
|
|
126
|
+
replace: (m, m1, m2) => `${m1 || ''} ${m2 || ''}`,
|
|
127
|
+
}),
|
|
128
|
+
],
|
|
117
129
|
};
|
|
118
130
|
|
|
119
131
|
const outputOptions = {
|
|
120
132
|
globals,
|
|
121
133
|
banner,
|
|
122
134
|
format: 'umd',
|
|
123
|
-
amd: {id: `UIkit${name}`.toLowerCase()},
|
|
135
|
+
amd: { id: `UIkit${name}`.toLowerCase() },
|
|
124
136
|
name: `UIkit${ucfirst(name)}`,
|
|
125
|
-
sourcemap: debug ? 'inline' : false
|
|
137
|
+
sourcemap: debug ? 'inline' : false,
|
|
126
138
|
};
|
|
127
139
|
|
|
128
|
-
const output = [
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
140
|
+
const output = [
|
|
141
|
+
{
|
|
142
|
+
...outputOptions,
|
|
143
|
+
file: `${dest}.js`,
|
|
144
|
+
},
|
|
145
|
+
];
|
|
132
146
|
|
|
133
147
|
if (minify) {
|
|
134
148
|
output.push({
|
|
135
149
|
...outputOptions,
|
|
136
150
|
file: `${dest}.min.js`,
|
|
137
|
-
plugins: [minify ? rollupMinify() : undefined]
|
|
151
|
+
plugins: [minify ? rollupMinify() : undefined],
|
|
138
152
|
});
|
|
139
153
|
}
|
|
140
154
|
|
|
@@ -148,18 +162,16 @@ export async function compile(file, dest, {external, globals, name, aliases, rep
|
|
|
148
162
|
|
|
149
163
|
await bundle.close();
|
|
150
164
|
} else {
|
|
151
|
-
|
|
152
165
|
console.log('UIkit is watching the files...');
|
|
153
166
|
|
|
154
167
|
const watcher = rollupWatch({
|
|
155
168
|
...inputOptions,
|
|
156
|
-
output
|
|
169
|
+
output,
|
|
157
170
|
});
|
|
158
171
|
|
|
159
|
-
watcher.on('event', ({code, result, output, error}) => {
|
|
172
|
+
watcher.on('event', ({ code, result, output, error }) => {
|
|
160
173
|
if (result) {
|
|
161
174
|
result.close();
|
|
162
|
-
|
|
163
175
|
}
|
|
164
176
|
if (code === 'BUNDLE_END' && output) {
|
|
165
177
|
output.map(logFile);
|
|
@@ -171,11 +183,9 @@ export async function compile(file, dest, {external, globals, name, aliases, rep
|
|
|
171
183
|
|
|
172
184
|
watcher.close();
|
|
173
185
|
}
|
|
174
|
-
|
|
175
186
|
}
|
|
176
187
|
|
|
177
188
|
export async function icons(src) {
|
|
178
|
-
|
|
179
189
|
const options = {
|
|
180
190
|
plugins: [
|
|
181
191
|
{
|
|
@@ -184,7 +194,7 @@ export async function icons(src) {
|
|
|
184
194
|
overrides: {
|
|
185
195
|
removeViewBox: false,
|
|
186
196
|
cleanupNumericValues: {
|
|
187
|
-
floatPrecision: 3
|
|
197
|
+
floatPrecision: 3,
|
|
188
198
|
},
|
|
189
199
|
convertPathData: false,
|
|
190
200
|
convertShapeToPath: false,
|
|
@@ -193,31 +203,30 @@ export async function icons(src) {
|
|
|
193
203
|
removeStyleElement: false,
|
|
194
204
|
removeScriptElement: false,
|
|
195
205
|
removeUnknownsAndDefaults: false,
|
|
196
|
-
removeUselessStrokeAndFill: false
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
]
|
|
206
|
+
removeUselessStrokeAndFill: false,
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
],
|
|
201
211
|
};
|
|
202
212
|
|
|
203
|
-
const files = await glob(src, {nosort: true});
|
|
213
|
+
const files = await glob(src, { nosort: true });
|
|
204
214
|
const icons = await Promise.all(
|
|
205
|
-
files.map(file =>
|
|
206
|
-
limit(async () =>
|
|
207
|
-
(await optimize(await read(file), options)).data
|
|
208
|
-
)
|
|
209
|
-
)
|
|
215
|
+
files.map((file) => limit(async () => (await optimize(await read(file), options)).data))
|
|
210
216
|
);
|
|
211
217
|
|
|
212
|
-
return JSON.stringify(
|
|
213
|
-
result
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
218
|
+
return JSON.stringify(
|
|
219
|
+
files.reduce((result, file, i) => {
|
|
220
|
+
result[basename(file, '.svg')] = icons[i];
|
|
221
|
+
return result;
|
|
222
|
+
}, {}),
|
|
223
|
+
null,
|
|
224
|
+
' '
|
|
225
|
+
);
|
|
217
226
|
}
|
|
218
227
|
|
|
219
228
|
export async function run(cmd, options) {
|
|
220
|
-
const {stdout, stderr} = await limit(() => exec(cmd, options));
|
|
229
|
+
const { stdout, stderr } = await limit(() => exec(cmd, options));
|
|
221
230
|
|
|
222
231
|
stdout && console.log(stdout.trim());
|
|
223
232
|
stderr && console.log(stderr.trim());
|
package/build/wrapper/icons.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! UIkit 3.11.2-dev.
|
|
1
|
+
/*! UIkit 3.11.2-dev.c7ed3c19b | https://www.getuikit.com | (c) 2014 - 2022 YOOtheme | MIT License */
|
|
2
2
|
/* ========================================================================
|
|
3
3
|
Component: Base
|
|
4
4
|
========================================================================== */
|
|
@@ -4899,13 +4899,6 @@ ul.uk-nav-sub {
|
|
|
4899
4899
|
.uk-navbar-container:not(.uk-navbar-transparent) {
|
|
4900
4900
|
background: #f8f8f8;
|
|
4901
4901
|
}
|
|
4902
|
-
/*
|
|
4903
|
-
* Remove pseudo elements created by micro clearfix as precaution (if Container component is used)
|
|
4904
|
-
*/
|
|
4905
|
-
.uk-navbar-container > ::before,
|
|
4906
|
-
.uk-navbar-container > ::after {
|
|
4907
|
-
display: none !important;
|
|
4908
|
-
}
|
|
4909
4902
|
/* Groups
|
|
4910
4903
|
========================================================================== */
|
|
4911
4904
|
/*
|
|
@@ -7628,6 +7621,47 @@ iframe[data-uk-cover] {
|
|
|
7628
7621
|
[data-uk-responsive] {
|
|
7629
7622
|
max-width: 100%;
|
|
7630
7623
|
}
|
|
7624
|
+
/* Object
|
|
7625
|
+
========================================================================== */
|
|
7626
|
+
.uk-object-fit-none {
|
|
7627
|
+
object-fit: none;
|
|
7628
|
+
}
|
|
7629
|
+
.uk-object-fit-cover {
|
|
7630
|
+
object-fit: cover;
|
|
7631
|
+
}
|
|
7632
|
+
.uk-object-fit-contain {
|
|
7633
|
+
object-fit: contain;
|
|
7634
|
+
}
|
|
7635
|
+
/*
|
|
7636
|
+
* Position
|
|
7637
|
+
*/
|
|
7638
|
+
.uk-object-top-right {
|
|
7639
|
+
object-position: 100% 0;
|
|
7640
|
+
}
|
|
7641
|
+
.uk-object-top-center {
|
|
7642
|
+
object-position: 50% 0;
|
|
7643
|
+
}
|
|
7644
|
+
.uk-object-top-left {
|
|
7645
|
+
object-position: 0% 0;
|
|
7646
|
+
}
|
|
7647
|
+
.uk-object-center-right {
|
|
7648
|
+
object-position: 100% 50%;
|
|
7649
|
+
}
|
|
7650
|
+
.uk-object-center-center {
|
|
7651
|
+
object-position: 50% 50%;
|
|
7652
|
+
}
|
|
7653
|
+
.uk-object-center-left {
|
|
7654
|
+
object-position: 0% 50%;
|
|
7655
|
+
}
|
|
7656
|
+
.uk-object-bottom-right {
|
|
7657
|
+
object-position: 100% 100%;
|
|
7658
|
+
}
|
|
7659
|
+
.uk-object-bottom-center {
|
|
7660
|
+
object-position: 50% 100%;
|
|
7661
|
+
}
|
|
7662
|
+
.uk-object-bottom-left {
|
|
7663
|
+
object-position: 0% 100%;
|
|
7664
|
+
}
|
|
7631
7665
|
/* Border
|
|
7632
7666
|
========================================================================== */
|
|
7633
7667
|
.uk-border-circle {
|
|
@@ -7878,15 +7912,6 @@ iframe[data-uk-cover] {
|
|
|
7878
7912
|
.uk-flex-inline {
|
|
7879
7913
|
display: inline-flex;
|
|
7880
7914
|
}
|
|
7881
|
-
/*
|
|
7882
|
-
* Remove pseudo elements created by micro clearfix as precaution
|
|
7883
|
-
*/
|
|
7884
|
-
.uk-flex::before,
|
|
7885
|
-
.uk-flex::after,
|
|
7886
|
-
.uk-flex-inline::before,
|
|
7887
|
-
.uk-flex-inline::after {
|
|
7888
|
-
display: none;
|
|
7889
|
-
}
|
|
7890
7915
|
/* Alignment
|
|
7891
7916
|
========================================================================== */
|
|
7892
7917
|
/*
|