uikit 3.11.2-dev.9433cd5fd → 3.11.2-dev.a87448e52
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 +37 -28
- 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 +118 -201
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +118 -201
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +120 -207
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +120 -207
- 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 +408 -439
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +1098 -1316
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +1144 -1393
- 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 +345 -358
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +343 -357
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +768 -843
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +343 -357
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +645 -793
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +587 -620
- 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 +5412 -6733
- 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 +8008 -9705
- 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 +15 -28
- package/src/js/api/global.js +6 -12
- package/src/js/api/hooks.js +14 -33
- 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 +70 -66
- package/src/js/components/index.js +13 -13
- package/src/js/components/internal/lightbox-animations.js +14 -25
- package/src/js/components/internal/slider-preload.js +37 -0
- package/src/js/components/internal/slider-transitioner.js +66 -45
- package/src/js/components/internal/slideshow-animations.js +46 -64
- package/src/js/components/lightbox-panel.js +107 -105
- package/src/js/components/lightbox.js +17 -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 +95 -64
- package/src/js/components/slideshow-parallax.js +1 -1
- package/src/js/components/slideshow.js +15 -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 +9 -17
- package/src/js/core/core.js +74 -53
- package/src/js/core/cover.js +11 -15
- package/src/js/core/drop.js +106 -92
- 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 +47 -52
- package/src/js/core/img.js +96 -77
- 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 +49 -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 +68 -83
- package/src/js/core/switcher.js +47 -46
- package/src/js/core/tab.js +7 -10
- package/src/js/core/toggle.js +66 -67
- 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 +58 -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 +149 -106
- 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 +48 -55
- package/src/js/mixin/slideshow.js +13 -19
- package/src/js/mixin/togglable.js +89 -63
- package/src/js/uikit-core.js +2 -4
- package/src/js/uikit.js +2 -4
- package/src/js/util/ajax.js +20 -39
- package/src/js/util/animation.js +77 -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 +44 -80
- 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 +82 -121
- package/src/js/util/mouse.js +19 -17
- package/src/js/util/options.js +32 -46
- package/src/js/util/player.js +41 -36
- package/src/js/util/position.js +54 -46
- package/src/js/util/selector.js +43 -58
- package/src/js/util/style.js +39 -49
- package/src/js/util/viewport.js +75 -64
- package/src/less/components/base.less +10 -33
- package/src/less/components/flex.less +0 -9
- package/src/less/components/form-range.less +48 -95
- package/src/less/components/form.less +0 -1
- package/src/less/components/leader.less +0 -1
- package/src/less/components/lightbox.less +0 -1
- package/src/less/components/modal.less +3 -7
- package/src/less/components/navbar.less +0 -7
- package/src/less/components/progress.less +14 -36
- package/src/less/components/slider.less +0 -3
- package/src/less/components/slideshow.less +0 -3
- package/src/less/components/text.less +16 -32
- package/src/less/components/utility.less +22 -0
- package/src/scss/components/base.scss +10 -33
- package/src/scss/components/flex.scss +0 -9
- package/src/scss/components/form-range.scss +48 -95
- package/src/scss/components/form.scss +3 -4
- package/src/scss/components/icon.scss +2 -2
- package/src/scss/components/leader.scss +0 -1
- package/src/scss/components/lightbox.scss +0 -1
- package/src/scss/components/modal.scss +3 -7
- package/src/scss/components/navbar.scss +0 -7
- package/src/scss/components/progress.scss +14 -36
- package/src/scss/components/search.scss +1 -1
- package/src/scss/components/slider.scss +0 -3
- package/src/scss/components/slideshow.scss +0 -3
- package/src/scss/components/text.scss +16 -32
- package/src/scss/components/utility.scss +22 -0
- package/src/scss/mixins-theme.scss +1 -1
- package/src/scss/mixins.scss +1 -1
- package/src/scss/variables-theme.scss +9 -9
- package/src/scss/variables.scss +9 -9
- package/tests/align.html +10 -10
- package/tests/animation.html +2 -2
- package/tests/article.html +2 -2
- package/tests/base.html +3 -3
- package/tests/card.html +10 -10
- package/tests/column.html +3 -3
- package/tests/comment.html +9 -9
- package/tests/dotnav.html +3 -3
- package/tests/image.html +296 -48
- package/tests/images/image-type.avif +0 -0
- package/tests/images/image-type.jpeg +0 -0
- package/tests/images/image-type.webp +0 -0
- package/tests/index.html +8 -8
- package/tests/js/index.js +114 -85
- package/tests/lightbox.html +10 -10
- package/tests/marker.html +2 -2
- package/tests/modal.html +8 -9
- package/tests/navbar.html +2 -2
- package/tests/overlay.html +7 -7
- package/tests/parallax.html +14 -5
- package/tests/position.html +12 -12
- package/tests/slidenav.html +12 -12
- package/tests/slider.html +20 -20
- package/tests/sortable.html +1 -1
- package/tests/sticky-parallax.html +47 -62
- package/tests/svg.html +6 -6
- package/tests/table.html +11 -11
- package/tests/thumbnav.html +12 -12
- package/tests/transition.html +30 -30
- package/tests/utility.html +33 -33
- package/tests/video.html +1 -1
- package/tests/width.html +1 -1
- package/src/js/mixin/flex-bug.js +0 -56
- package/src/js/util/promise.js +0 -191
- package/tests/images/animated.gif +0 -0
- package/tests/images/test.avif +0 -0
- package/tests/images/test.webp +0 -0
package/jsconfig.json
CHANGED
package/package.json
CHANGED
|
@@ -1,62 +1,66 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
2
|
+
"name": "uikit",
|
|
3
|
+
"title": "UIkit",
|
|
4
|
+
"description": "UIkit is a lightweight and modular front-end framework for developing fast and powerful web interfaces.",
|
|
5
|
+
"version": "3.11.2-dev.a87448e52",
|
|
6
|
+
"main": "dist/js/uikit.js",
|
|
7
|
+
"style": "dist/css/uikit.css",
|
|
8
|
+
"sideEffects": [
|
|
9
|
+
"*.css",
|
|
10
|
+
"./src/js/*.js",
|
|
11
|
+
"./dist/**/*.js"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build-scss": "node build/scss",
|
|
15
|
+
"compile": "yarn compile-less && yarn compile-js",
|
|
16
|
+
"compile-js": "node build/build",
|
|
17
|
+
"compile-less": "yarn icons && node build/less",
|
|
18
|
+
"compile-rtl": "yarn compile-less rtl",
|
|
19
|
+
"icons": "node build/icons",
|
|
20
|
+
"prefix": "node build/prefix",
|
|
21
|
+
"scope": "node build/scope",
|
|
22
|
+
"release": "node build/release",
|
|
23
|
+
"watch": "watch-run -i -p '**/*.less' yarn compile-less",
|
|
24
|
+
"eslint": "eslint src/js",
|
|
25
|
+
"eslint-fix": "eslint --fix src/js"
|
|
26
|
+
},
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/uikit/uikit.git"
|
|
30
|
+
},
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/uikit/uikit/issues"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "https://getuikit.com",
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@babel/core": "^7.16.0",
|
|
38
|
+
"@babel/preset-env": "^7.16.4",
|
|
39
|
+
"@rollup/plugin-alias": "^3.1.9",
|
|
40
|
+
"@rollup/plugin-babel": "^5.3.0",
|
|
41
|
+
"@rollup/plugin-replace": "^3.0.1",
|
|
42
|
+
"archiver": "^5.3.0",
|
|
43
|
+
"camelcase": "^6.3.0",
|
|
44
|
+
"clean-css": "^5.2.4",
|
|
45
|
+
"dateformat": "^5.0.3",
|
|
46
|
+
"esbuild": "^0.14.23",
|
|
47
|
+
"eslint": "^8.9.0",
|
|
48
|
+
"eslint-config-prettier": "^8.3.0",
|
|
49
|
+
"fs-extra": "^10.0.0",
|
|
50
|
+
"glob": "^7.2.0",
|
|
51
|
+
"inquirer": "^8.2.0",
|
|
52
|
+
"less": "^4.1.2",
|
|
53
|
+
"minimist": "^1.2.5",
|
|
54
|
+
"number-precision": "^1.5.2",
|
|
55
|
+
"p-limit": "^4.0.0",
|
|
56
|
+
"prettier": "^2.5.1",
|
|
57
|
+
"rollup": "^2.68.0",
|
|
58
|
+
"rollup-plugin-esbuild": "^4.8.2",
|
|
59
|
+
"rollup-plugin-html": "^0.2.1",
|
|
60
|
+
"rollup-plugin-modify": "^3.0.0",
|
|
61
|
+
"rtlcss": "^3.5.0",
|
|
62
|
+
"semver": "^7.3.2",
|
|
63
|
+
"svgo": "^2.8.0",
|
|
64
|
+
"watch-run": "^1.2.5"
|
|
65
|
+
}
|
|
62
66
|
}
|
package/src/js/api/boot.js
CHANGED
|
@@ -1,49 +1,48 @@
|
|
|
1
|
-
import {getComponentName} from './component';
|
|
2
|
-
import {apply, fastdom, hasAttr, inBrowser} from 'uikit-util';
|
|
1
|
+
import { getComponentName } from './component';
|
|
2
|
+
import { apply, fastdom, hasAttr, inBrowser } from 'uikit-util';
|
|
3
3
|
|
|
4
4
|
export default function (UIkit) {
|
|
5
|
-
|
|
6
|
-
const {connect, disconnect} = UIkit;
|
|
5
|
+
const { connect, disconnect } = UIkit;
|
|
7
6
|
|
|
8
7
|
if (!inBrowser || !window.MutationObserver) {
|
|
9
8
|
return;
|
|
10
9
|
}
|
|
11
10
|
|
|
12
11
|
fastdom.read(function () {
|
|
13
|
-
|
|
14
12
|
if (document.body) {
|
|
15
13
|
apply(document.body, connect);
|
|
16
14
|
}
|
|
17
15
|
|
|
18
|
-
new MutationObserver(records =>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
16
|
+
new MutationObserver((records) => records.forEach(applyChildListMutation)).observe(
|
|
17
|
+
document,
|
|
18
|
+
{
|
|
19
|
+
childList: true,
|
|
20
|
+
subtree: true,
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
new MutationObserver((records) => records.forEach(applyAttributeMutation)).observe(
|
|
25
|
+
document,
|
|
26
|
+
{
|
|
27
|
+
attributes: true,
|
|
28
|
+
subtree: true,
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
31
|
|
|
32
32
|
UIkit._initialized = true;
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
function applyChildListMutation({addedNodes, removedNodes}) {
|
|
36
|
-
for (
|
|
37
|
-
apply(
|
|
35
|
+
function applyChildListMutation({ addedNodes, removedNodes }) {
|
|
36
|
+
for (const node of addedNodes) {
|
|
37
|
+
apply(node, connect);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
for (
|
|
41
|
-
apply(
|
|
40
|
+
for (const node of removedNodes) {
|
|
41
|
+
apply(node, disconnect);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
function applyAttributeMutation({target, attributeName}) {
|
|
46
|
-
|
|
45
|
+
function applyAttributeMutation({ target, attributeName }) {
|
|
47
46
|
const name = getComponentName(attributeName);
|
|
48
47
|
|
|
49
48
|
if (!name || !(name in UIkit)) {
|
|
@@ -55,12 +54,6 @@ export default function (UIkit) {
|
|
|
55
54
|
return;
|
|
56
55
|
}
|
|
57
56
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if (component) {
|
|
61
|
-
component.$destroy();
|
|
62
|
-
}
|
|
63
|
-
|
|
57
|
+
UIkit.getComponent(target, name)?.$destroy();
|
|
64
58
|
}
|
|
65
|
-
|
|
66
59
|
}
|
package/src/js/api/component.js
CHANGED
|
@@ -1,37 +1,33 @@
|
|
|
1
|
-
import {$$,
|
|
1
|
+
import { $$, camelize, fastdom, hyphenate, isPlainObject, memoize, startsWith } from 'uikit-util';
|
|
2
2
|
|
|
3
3
|
export default function (UIkit) {
|
|
4
|
-
|
|
5
4
|
const DATA = UIkit.data;
|
|
6
5
|
|
|
7
6
|
const components = {};
|
|
8
7
|
|
|
9
8
|
UIkit.component = function (name, options) {
|
|
10
|
-
|
|
11
9
|
const id = hyphenate(name);
|
|
12
10
|
|
|
13
11
|
name = camelize(id);
|
|
14
12
|
|
|
15
13
|
if (!options) {
|
|
16
|
-
|
|
17
14
|
if (isPlainObject(components[name])) {
|
|
18
15
|
components[name] = UIkit.extend(components[name]);
|
|
19
16
|
}
|
|
20
17
|
|
|
21
18
|
return components[name];
|
|
22
|
-
|
|
23
19
|
}
|
|
24
20
|
|
|
25
21
|
UIkit[name] = function (element, data) {
|
|
26
|
-
|
|
27
22
|
const component = UIkit.component(name);
|
|
28
23
|
|
|
29
24
|
return component.options.functional
|
|
30
|
-
? new component({data: isPlainObject(element) ? element : [...arguments]})
|
|
31
|
-
:
|
|
25
|
+
? new component({ data: isPlainObject(element) ? element : [...arguments] })
|
|
26
|
+
: element
|
|
27
|
+
? $$(element).map(init)[0]
|
|
28
|
+
: init();
|
|
32
29
|
|
|
33
30
|
function init(element) {
|
|
34
|
-
|
|
35
31
|
const instance = UIkit.getComponent(element, name);
|
|
36
32
|
|
|
37
33
|
if (instance) {
|
|
@@ -42,59 +38,50 @@ export default function (UIkit) {
|
|
|
42
38
|
}
|
|
43
39
|
}
|
|
44
40
|
|
|
45
|
-
return new component({el: element, data});
|
|
46
|
-
|
|
41
|
+
return new component({ el: element, data });
|
|
47
42
|
}
|
|
48
|
-
|
|
49
43
|
};
|
|
50
44
|
|
|
51
|
-
const opt = isPlainObject(options) ?
|
|
45
|
+
const opt = isPlainObject(options) ? { ...options } : options.options;
|
|
52
46
|
|
|
53
47
|
opt.name = name;
|
|
54
48
|
|
|
55
|
-
|
|
56
|
-
opt.install(UIkit, opt, name);
|
|
57
|
-
}
|
|
49
|
+
opt.install?.(UIkit, opt, name);
|
|
58
50
|
|
|
59
51
|
if (UIkit._initialized && !opt.functional) {
|
|
60
52
|
fastdom.read(() => UIkit[name](`[uk-${id}],[data-uk-${id}]`));
|
|
61
53
|
}
|
|
62
54
|
|
|
63
|
-
return components[name] = isPlainObject(options) ? opt : options;
|
|
55
|
+
return (components[name] = isPlainObject(options) ? opt : options);
|
|
64
56
|
};
|
|
65
57
|
|
|
66
|
-
UIkit.getComponents = element => element
|
|
58
|
+
UIkit.getComponents = (element) => element?.[DATA] || {};
|
|
67
59
|
UIkit.getComponent = (element, name) => UIkit.getComponents(element)[name];
|
|
68
60
|
|
|
69
|
-
UIkit.connect = node => {
|
|
70
|
-
|
|
61
|
+
UIkit.connect = (node) => {
|
|
71
62
|
if (node[DATA]) {
|
|
72
63
|
for (const name in node[DATA]) {
|
|
73
64
|
node[DATA][name]._callConnected();
|
|
74
65
|
}
|
|
75
66
|
}
|
|
76
67
|
|
|
77
|
-
for (
|
|
78
|
-
|
|
79
|
-
const name = getComponentName(node.attributes[i].name);
|
|
68
|
+
for (const attribute of node.attributes) {
|
|
69
|
+
const name = getComponentName(attribute.name);
|
|
80
70
|
|
|
81
71
|
if (name && name in components) {
|
|
82
72
|
UIkit[name](node);
|
|
83
73
|
}
|
|
84
|
-
|
|
85
74
|
}
|
|
86
|
-
|
|
87
75
|
};
|
|
88
76
|
|
|
89
|
-
UIkit.disconnect = node => {
|
|
77
|
+
UIkit.disconnect = (node) => {
|
|
90
78
|
for (const name in node[DATA]) {
|
|
91
79
|
node[DATA][name]._callDisconnected();
|
|
92
80
|
}
|
|
93
81
|
};
|
|
94
|
-
|
|
95
82
|
}
|
|
96
83
|
|
|
97
|
-
export const getComponentName = memoize(attribute => {
|
|
84
|
+
export const getComponentName = memoize((attribute) => {
|
|
98
85
|
return startsWith(attribute, 'uk-') || startsWith(attribute, 'data-uk-')
|
|
99
86
|
? camelize(attribute.replace('data-uk-', '').replace('uk-', ''))
|
|
100
87
|
: false;
|
package/src/js/api/global.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {$, apply, isString, mergeOptions, parents, toNode} from 'uikit-util';
|
|
1
|
+
import { $, apply, isString, mergeOptions, parents, toNode } from 'uikit-util';
|
|
2
2
|
|
|
3
3
|
export default function (UIkit) {
|
|
4
|
-
|
|
5
4
|
const DATA = UIkit.data;
|
|
6
5
|
|
|
7
6
|
UIkit.use = function (plugin) {
|
|
8
|
-
|
|
9
7
|
if (plugin.installed) {
|
|
10
8
|
return;
|
|
11
9
|
}
|
|
@@ -22,7 +20,6 @@ export default function (UIkit) {
|
|
|
22
20
|
};
|
|
23
21
|
|
|
24
22
|
UIkit.extend = function (options) {
|
|
25
|
-
|
|
26
23
|
options = options || {};
|
|
27
24
|
|
|
28
25
|
const Super = this;
|
|
@@ -41,29 +38,27 @@ export default function (UIkit) {
|
|
|
41
38
|
};
|
|
42
39
|
|
|
43
40
|
UIkit.update = function (element, e) {
|
|
44
|
-
|
|
45
41
|
element = element ? toNode(element) : document.body;
|
|
46
42
|
|
|
47
|
-
parents(element).reverse()
|
|
48
|
-
|
|
43
|
+
for (const parentEl of parents(element).reverse()) {
|
|
44
|
+
update(parentEl[DATA], e);
|
|
45
|
+
}
|
|
49
46
|
|
|
47
|
+
apply(element, (element) => update(element[DATA], e));
|
|
50
48
|
};
|
|
51
49
|
|
|
52
50
|
let container;
|
|
53
51
|
Object.defineProperty(UIkit, 'container', {
|
|
54
|
-
|
|
55
52
|
get() {
|
|
56
53
|
return container || document.body;
|
|
57
54
|
},
|
|
58
55
|
|
|
59
56
|
set(element) {
|
|
60
57
|
container = $(element);
|
|
61
|
-
}
|
|
62
|
-
|
|
58
|
+
},
|
|
63
59
|
});
|
|
64
60
|
|
|
65
61
|
function update(data, e) {
|
|
66
|
-
|
|
67
62
|
if (!data) {
|
|
68
63
|
return;
|
|
69
64
|
}
|
|
@@ -73,6 +68,5 @@ export default function (UIkit) {
|
|
|
73
68
|
data[name]._callUpdate(e);
|
|
74
69
|
}
|
|
75
70
|
}
|
|
76
|
-
|
|
77
71
|
}
|
|
78
72
|
}
|
package/src/js/api/hooks.js
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
import {assign, fastdom, hasOwn, isEqual, isPlainObject} from 'uikit-util';
|
|
1
|
+
import { assign, fastdom, hasOwn, isEqual, isPlainObject } from 'uikit-util';
|
|
2
2
|
|
|
3
3
|
export default function (UIkit) {
|
|
4
|
-
|
|
5
4
|
UIkit.prototype._callHook = function (hook) {
|
|
6
|
-
|
|
7
|
-
const handlers = this.$options[hook];
|
|
8
|
-
|
|
9
|
-
if (handlers) {
|
|
10
|
-
handlers.forEach(handler => handler.call(this));
|
|
11
|
-
}
|
|
5
|
+
this.$options[hook]?.forEach((handler) => handler.call(this));
|
|
12
6
|
};
|
|
13
7
|
|
|
14
8
|
UIkit.prototype._callConnected = function () {
|
|
15
|
-
|
|
16
9
|
if (this._connected) {
|
|
17
10
|
return;
|
|
18
11
|
}
|
|
@@ -33,7 +26,6 @@ export default function (UIkit) {
|
|
|
33
26
|
};
|
|
34
27
|
|
|
35
28
|
UIkit.prototype._callDisconnected = function () {
|
|
36
|
-
|
|
37
29
|
if (!this._connected) {
|
|
38
30
|
return;
|
|
39
31
|
}
|
|
@@ -45,11 +37,9 @@ export default function (UIkit) {
|
|
|
45
37
|
|
|
46
38
|
this._connected = false;
|
|
47
39
|
delete this._watch;
|
|
48
|
-
|
|
49
40
|
};
|
|
50
41
|
|
|
51
42
|
UIkit.prototype._callUpdate = function (e = 'update') {
|
|
52
|
-
|
|
53
43
|
if (!this._connected) {
|
|
54
44
|
return;
|
|
55
45
|
}
|
|
@@ -76,7 +66,6 @@ export default function (UIkit) {
|
|
|
76
66
|
};
|
|
77
67
|
|
|
78
68
|
UIkit.prototype._callWatches = function () {
|
|
79
|
-
|
|
80
69
|
if (this._watch) {
|
|
81
70
|
return;
|
|
82
71
|
}
|
|
@@ -88,25 +77,17 @@ export default function (UIkit) {
|
|
|
88
77
|
runWatches.call(this, initial);
|
|
89
78
|
}
|
|
90
79
|
this._watch = null;
|
|
91
|
-
|
|
92
80
|
});
|
|
93
|
-
|
|
94
81
|
};
|
|
95
82
|
|
|
96
83
|
function runUpdates(types) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
for (let i = 0; i < updates.length; i++) {
|
|
101
|
-
const {read, write, events} = updates[i];
|
|
102
|
-
|
|
103
|
-
if (!types.has('update') && (!events || !events.some(type => types.has(type)))) {
|
|
84
|
+
for (const { read, write, events } of this.$options.update) {
|
|
85
|
+
if (!types.has('update') && (!events || !events.some((type) => types.has(type)))) {
|
|
104
86
|
continue;
|
|
105
87
|
}
|
|
106
88
|
|
|
107
89
|
let result;
|
|
108
90
|
if (read) {
|
|
109
|
-
|
|
110
91
|
result = read.call(this, this._data, types);
|
|
111
92
|
|
|
112
93
|
if (result && isPlainObject(result)) {
|
|
@@ -117,25 +98,25 @@ export default function (UIkit) {
|
|
|
117
98
|
if (write && result !== false) {
|
|
118
99
|
fastdom.write(() => write.call(this, this._data, types));
|
|
119
100
|
}
|
|
120
|
-
|
|
121
101
|
}
|
|
122
102
|
}
|
|
123
103
|
|
|
124
104
|
function runWatches(initial) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
105
|
+
const {
|
|
106
|
+
$options: { computed },
|
|
107
|
+
} = this;
|
|
108
|
+
const values = { ...this._computeds };
|
|
128
109
|
this._computeds = {};
|
|
129
110
|
|
|
130
111
|
for (const key in computed) {
|
|
131
|
-
const {watch, immediate} = computed[key];
|
|
132
|
-
if (
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
112
|
+
const { watch, immediate } = computed[key];
|
|
113
|
+
if (
|
|
114
|
+
watch &&
|
|
115
|
+
((initial && immediate) ||
|
|
116
|
+
(hasOwn(values, key) && !isEqual(values[key], this[key])))
|
|
117
|
+
) {
|
|
136
118
|
watch.call(this, this[key], values[key]);
|
|
137
119
|
}
|
|
138
120
|
}
|
|
139
|
-
|
|
140
121
|
}
|
|
141
122
|
}
|
package/src/js/api/instance.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {hyphenate, isEmpty, memoize, remove, within} from 'uikit-util';
|
|
1
|
+
import { hyphenate, isEmpty, memoize, remove, within } from 'uikit-util';
|
|
2
2
|
|
|
3
3
|
export default function (UIkit) {
|
|
4
|
-
|
|
5
4
|
const DATA = UIkit.data;
|
|
6
5
|
|
|
7
6
|
UIkit.prototype.$create = function (component, element, data) {
|
|
@@ -9,8 +8,7 @@ export default function (UIkit) {
|
|
|
9
8
|
};
|
|
10
9
|
|
|
11
10
|
UIkit.prototype.$mount = function (el) {
|
|
12
|
-
|
|
13
|
-
const {name} = this.$options;
|
|
11
|
+
const { name } = this.$options;
|
|
14
12
|
|
|
15
13
|
if (!el[DATA]) {
|
|
16
14
|
el[DATA] = {};
|
|
@@ -35,8 +33,7 @@ export default function (UIkit) {
|
|
|
35
33
|
};
|
|
36
34
|
|
|
37
35
|
UIkit.prototype.$destroy = function (removeEl = false) {
|
|
38
|
-
|
|
39
|
-
const {el, name} = this.$options;
|
|
36
|
+
const { el, name } = this.$options;
|
|
40
37
|
|
|
41
38
|
if (el) {
|
|
42
39
|
this._callDisconnected();
|
|
@@ -44,7 +41,7 @@ export default function (UIkit) {
|
|
|
44
41
|
|
|
45
42
|
this._callHook('destroy');
|
|
46
43
|
|
|
47
|
-
if (!el
|
|
44
|
+
if (!el?.[DATA]) {
|
|
48
45
|
return;
|
|
49
46
|
}
|
|
50
47
|
|
|
@@ -69,19 +66,14 @@ export default function (UIkit) {
|
|
|
69
66
|
|
|
70
67
|
UIkit.prototype.$getComponent = UIkit.getComponent;
|
|
71
68
|
|
|
72
|
-
const componentName = memoize(name => UIkit.prefix + hyphenate(name));
|
|
69
|
+
const componentName = memoize((name) => UIkit.prefix + hyphenate(name));
|
|
73
70
|
Object.defineProperties(UIkit.prototype, {
|
|
74
|
-
|
|
75
71
|
$container: Object.getOwnPropertyDescriptor(UIkit, 'container'),
|
|
76
72
|
|
|
77
73
|
$name: {
|
|
78
|
-
|
|
79
74
|
get() {
|
|
80
75
|
return componentName(this.$options.name);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
|
|
76
|
+
},
|
|
77
|
+
},
|
|
85
78
|
});
|
|
86
|
-
|
|
87
79
|
}
|