uikit 3.11.2-dev.31cd2ba38 → 3.11.2-dev.4274bc35b

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 (221) hide show
  1. package/.eslintrc.json +4 -49
  2. package/.prettierignore +14 -0
  3. package/.prettierrc.json +13 -0
  4. package/.webstorm.js +3 -3
  5. package/CHANGELOG.md +38 -28
  6. package/build/.eslintrc.json +1 -3
  7. package/build/build.js +26 -28
  8. package/build/icons.js +7 -11
  9. package/build/less.js +48 -36
  10. package/build/package.json +2 -2
  11. package/build/prefix.js +21 -18
  12. package/build/publishDev.js +6 -8
  13. package/build/release.js +20 -17
  14. package/build/scope.js +21 -11
  15. package/build/scss.js +72 -39
  16. package/build/util.js +71 -62
  17. package/build/wrapper/icons.js +0 -2
  18. package/dist/css/uikit-core-rtl.css +121 -202
  19. package/dist/css/uikit-core-rtl.min.css +1 -1
  20. package/dist/css/uikit-core.css +121 -202
  21. package/dist/css/uikit-core.min.css +1 -1
  22. package/dist/css/uikit-rtl.css +123 -208
  23. package/dist/css/uikit-rtl.min.css +1 -1
  24. package/dist/css/uikit.css +123 -208
  25. package/dist/css/uikit.min.css +1 -1
  26. package/dist/js/components/countdown.js +88 -133
  27. package/dist/js/components/countdown.min.js +1 -1
  28. package/dist/js/components/filter.js +408 -439
  29. package/dist/js/components/filter.min.js +1 -1
  30. package/dist/js/components/lightbox-panel.js +1098 -1316
  31. package/dist/js/components/lightbox-panel.min.js +1 -1
  32. package/dist/js/components/lightbox.js +1144 -1393
  33. package/dist/js/components/lightbox.min.js +1 -1
  34. package/dist/js/components/notification.js +94 -114
  35. package/dist/js/components/notification.min.js +1 -1
  36. package/dist/js/components/parallax.js +326 -358
  37. package/dist/js/components/parallax.min.js +1 -1
  38. package/dist/js/components/slider-parallax.js +324 -357
  39. package/dist/js/components/slider-parallax.min.js +1 -1
  40. package/dist/js/components/slider.js +768 -843
  41. package/dist/js/components/slider.min.js +1 -1
  42. package/dist/js/components/slideshow-parallax.js +324 -357
  43. package/dist/js/components/slideshow-parallax.min.js +1 -1
  44. package/dist/js/components/slideshow.js +645 -793
  45. package/dist/js/components/slideshow.min.js +1 -1
  46. package/dist/js/components/sortable.js +587 -620
  47. package/dist/js/components/sortable.min.js +1 -1
  48. package/dist/js/components/tooltip.js +324 -356
  49. package/dist/js/components/tooltip.min.js +1 -1
  50. package/dist/js/components/upload.js +155 -167
  51. package/dist/js/components/upload.min.js +1 -1
  52. package/dist/js/uikit-core.js +5405 -6716
  53. package/dist/js/uikit-core.min.js +1 -1
  54. package/dist/js/uikit-icons.js +7 -9
  55. package/dist/js/uikit-icons.min.js +1 -1
  56. package/dist/js/uikit.js +7997 -9703
  57. package/dist/js/uikit.min.js +1 -1
  58. package/jsconfig.json +1 -1
  59. package/package.json +64 -60
  60. package/src/js/api/boot.js +25 -32
  61. package/src/js/api/component.js +15 -28
  62. package/src/js/api/global.js +6 -12
  63. package/src/js/api/hooks.js +14 -33
  64. package/src/js/api/instance.js +7 -15
  65. package/src/js/api/state.js +79 -100
  66. package/src/js/components/countdown.js +24 -50
  67. package/src/js/components/filter.js +70 -66
  68. package/src/js/components/index.js +13 -13
  69. package/src/js/components/internal/lightbox-animations.js +14 -25
  70. package/src/js/components/internal/slider-preload.js +37 -0
  71. package/src/js/components/internal/slider-transitioner.js +66 -45
  72. package/src/js/components/internal/slideshow-animations.js +46 -64
  73. package/src/js/components/lightbox-panel.js +107 -105
  74. package/src/js/components/lightbox.js +17 -39
  75. package/src/js/components/notification.js +49 -43
  76. package/src/js/components/parallax.js +16 -30
  77. package/src/js/components/slider-parallax.js +13 -23
  78. package/src/js/components/slider.js +95 -64
  79. package/src/js/components/slideshow-parallax.js +1 -1
  80. package/src/js/components/slideshow.js +15 -13
  81. package/src/js/components/sortable.js +125 -106
  82. package/src/js/components/tooltip.js +41 -31
  83. package/src/js/components/upload.js +52 -63
  84. package/src/js/core/accordion.js +53 -48
  85. package/src/js/core/alert.js +9 -17
  86. package/src/js/core/core.js +74 -53
  87. package/src/js/core/cover.js +11 -15
  88. package/src/js/core/drop.js +106 -92
  89. package/src/js/core/form-custom.js +20 -25
  90. package/src/js/core/gif.js +3 -7
  91. package/src/js/core/grid.js +57 -58
  92. package/src/js/core/height-match.js +16 -29
  93. package/src/js/core/height-viewport.js +28 -35
  94. package/src/js/core/icon.js +38 -50
  95. package/src/js/core/img.js +127 -87
  96. package/src/js/core/index.js +39 -39
  97. package/src/js/core/leader.js +9 -18
  98. package/src/js/core/margin.js +21 -37
  99. package/src/js/core/modal.js +49 -36
  100. package/src/js/core/nav.js +2 -4
  101. package/src/js/core/navbar.js +112 -88
  102. package/src/js/core/offcanvas.js +49 -53
  103. package/src/js/core/overflow-auto.js +13 -17
  104. package/src/js/core/responsive.js +14 -12
  105. package/src/js/core/scroll.js +10 -20
  106. package/src/js/core/scrollspy-nav.js +34 -31
  107. package/src/js/core/scrollspy.js +37 -54
  108. package/src/js/core/sticky.js +130 -91
  109. package/src/js/core/svg.js +68 -83
  110. package/src/js/core/switcher.js +47 -46
  111. package/src/js/core/tab.js +7 -10
  112. package/src/js/core/toggle.js +66 -67
  113. package/src/js/core/video.js +11 -22
  114. package/src/js/mixin/animate.js +19 -20
  115. package/src/js/mixin/class.js +2 -4
  116. package/src/js/mixin/container.js +7 -11
  117. package/src/js/mixin/internal/animate-fade.js +73 -30
  118. package/src/js/mixin/internal/animate-slide.js +58 -41
  119. package/src/js/mixin/internal/slideshow-animations.js +7 -14
  120. package/src/js/mixin/internal/slideshow-transitioner.js +10 -17
  121. package/src/js/mixin/media.js +5 -10
  122. package/src/js/mixin/modal.js +89 -66
  123. package/src/js/mixin/parallax.js +130 -106
  124. package/src/js/mixin/position.js +26 -20
  125. package/src/js/mixin/slider-autoplay.js +12 -21
  126. package/src/js/mixin/slider-drag.js +64 -65
  127. package/src/js/mixin/slider-nav.js +26 -35
  128. package/src/js/mixin/slider-reactive.js +2 -8
  129. package/src/js/mixin/slider.js +48 -55
  130. package/src/js/mixin/slideshow.js +13 -19
  131. package/src/js/mixin/togglable.js +89 -63
  132. package/src/js/uikit-core.js +2 -4
  133. package/src/js/uikit.js +2 -4
  134. package/src/js/util/ajax.js +20 -39
  135. package/src/js/util/animation.js +77 -75
  136. package/src/js/util/attr.js +17 -21
  137. package/src/js/util/class.js +14 -52
  138. package/src/js/util/dimensions.js +56 -43
  139. package/src/js/util/dom.js +44 -80
  140. package/src/js/util/env.js +7 -12
  141. package/src/js/util/event.js +60 -59
  142. package/src/js/util/fastdom.js +1 -6
  143. package/src/js/util/filter.js +17 -34
  144. package/src/js/util/index.js +0 -1
  145. package/src/js/util/lang.js +82 -121
  146. package/src/js/util/mouse.js +19 -17
  147. package/src/js/util/options.js +33 -47
  148. package/src/js/util/player.js +41 -36
  149. package/src/js/util/position.js +54 -46
  150. package/src/js/util/selector.js +43 -58
  151. package/src/js/util/style.js +39 -49
  152. package/src/js/util/viewport.js +75 -64
  153. package/src/less/components/base.less +10 -33
  154. package/src/less/components/flex.less +0 -9
  155. package/src/less/components/form-range.less +52 -97
  156. package/src/less/components/form.less +0 -1
  157. package/src/less/components/leader.less +0 -1
  158. package/src/less/components/lightbox.less +0 -1
  159. package/src/less/components/modal.less +3 -7
  160. package/src/less/components/navbar.less +0 -7
  161. package/src/less/components/progress.less +14 -36
  162. package/src/less/components/slider.less +0 -3
  163. package/src/less/components/slideshow.less +0 -3
  164. package/src/less/components/text.less +16 -32
  165. package/src/less/components/utility.less +22 -0
  166. package/src/scss/components/base.scss +10 -33
  167. package/src/scss/components/flex.scss +0 -9
  168. package/src/scss/components/form-range.scss +52 -97
  169. package/src/scss/components/form.scss +3 -4
  170. package/src/scss/components/icon.scss +2 -2
  171. package/src/scss/components/leader.scss +0 -1
  172. package/src/scss/components/lightbox.scss +0 -1
  173. package/src/scss/components/modal.scss +3 -7
  174. package/src/scss/components/navbar.scss +0 -7
  175. package/src/scss/components/progress.scss +14 -36
  176. package/src/scss/components/search.scss +1 -1
  177. package/src/scss/components/slider.scss +0 -3
  178. package/src/scss/components/slideshow.scss +0 -3
  179. package/src/scss/components/text.scss +16 -32
  180. package/src/scss/components/utility.scss +22 -0
  181. package/src/scss/mixins-theme.scss +1 -1
  182. package/src/scss/mixins.scss +1 -1
  183. package/src/scss/variables-theme.scss +9 -9
  184. package/src/scss/variables.scss +9 -9
  185. package/tests/align.html +10 -10
  186. package/tests/animation.html +2 -2
  187. package/tests/article.html +2 -2
  188. package/tests/base.html +3 -3
  189. package/tests/card.html +10 -10
  190. package/tests/column.html +3 -3
  191. package/tests/comment.html +9 -9
  192. package/tests/dotnav.html +3 -3
  193. package/tests/image.html +296 -48
  194. package/tests/images/image-type.avif +0 -0
  195. package/tests/images/image-type.jpeg +0 -0
  196. package/tests/images/image-type.webp +0 -0
  197. package/tests/index.html +8 -8
  198. package/tests/js/index.js +114 -85
  199. package/tests/lightbox.html +10 -10
  200. package/tests/marker.html +2 -2
  201. package/tests/modal.html +8 -9
  202. package/tests/navbar.html +2 -2
  203. package/tests/overlay.html +7 -7
  204. package/tests/parallax.html +14 -5
  205. package/tests/position.html +12 -12
  206. package/tests/slidenav.html +12 -12
  207. package/tests/slider.html +20 -20
  208. package/tests/sortable.html +1 -1
  209. package/tests/sticky-parallax.html +47 -62
  210. package/tests/svg.html +6 -6
  211. package/tests/table.html +11 -11
  212. package/tests/thumbnav.html +12 -12
  213. package/tests/transition.html +30 -30
  214. package/tests/utility.html +33 -33
  215. package/tests/video.html +1 -1
  216. package/tests/width.html +1 -1
  217. package/src/js/mixin/flex-bug.js +0 -56
  218. package/src/js/util/promise.js +0 -191
  219. package/tests/images/animated.gif +0 -0
  220. package/tests/images/test.avif +0 -0
  221. package/tests/images/test.webp +0 -0
package/jsconfig.json CHANGED
@@ -6,4 +6,4 @@
6
6
  }
7
7
  },
8
8
  "exclude": ["node_modules"]
9
- }
9
+ }
package/package.json CHANGED
@@ -1,62 +1,66 @@
1
1
  {
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.31cd2ba38",
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
- "@rollup/plugin-alias": "^3.1.9",
38
- "@rollup/plugin-buble": "^0.21.3",
39
- "@rollup/plugin-replace": "^3.0.1",
40
- "archiver": "^5.3.0",
41
- "camelcase": "^6.3.0",
42
- "clean-css": "^5.2.4",
43
- "dateformat": "^5.0.2",
44
- "esbuild": "^0.14.19",
45
- "eslint": "^8.8.0",
46
- "fs-extra": "^10.0.0",
47
- "glob": "^7.2.0",
48
- "inquirer": "^8.2.0",
49
- "less": "^4.1.2",
50
- "minimist": "^1.2.5",
51
- "number-precision": "^1.5.1",
52
- "p-limit": "^4.0.0",
53
- "rollup": "^2.67.1",
54
- "rollup-plugin-esbuild": "^4.8.2",
55
- "rollup-plugin-html": "^0.2.1",
56
- "rollup-plugin-modify": "^3.0.0",
57
- "rtlcss": "^3.5.0",
58
- "semver": "^7.3.2",
59
- "svgo": "^2.8.0",
60
- "watch-run": "^1.2.5"
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.4274bc35b",
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
  }
@@ -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
- records.forEach(applyChildListMutation)
20
- ).observe(document, {
21
- childList: true,
22
- subtree: true
23
- });
24
-
25
- new MutationObserver(records =>
26
- records.forEach(applyAttributeMutation)
27
- ).observe(document, {
28
- attributes: true,
29
- subtree: true
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 (let i = 0; i < addedNodes.length; i++) {
37
- apply(addedNodes[i], connect);
35
+ function applyChildListMutation({ addedNodes, removedNodes }) {
36
+ for (const node of addedNodes) {
37
+ apply(node, connect);
38
38
  }
39
39
 
40
- for (let i = 0; i < removedNodes.length; i++) {
41
- apply(removedNodes[i], disconnect);
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
- const component = UIkit.getComponent(target, name);
59
-
60
- if (component) {
61
- component.$destroy();
62
- }
63
-
57
+ UIkit.getComponent(target, name)?.$destroy();
64
58
  }
65
-
66
59
  }
@@ -1,37 +1,33 @@
1
- import {$$, assign, camelize, fastdom, hyphenate, isPlainObject, memoize, startsWith} from 'uikit-util';
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
- : !element ? init(element) : $$(element).map(init)[0];
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) ? assign({}, options) : options.options;
45
+ const opt = isPlainObject(options) ? { ...options } : options.options;
52
46
 
53
47
  opt.name = name;
54
48
 
55
- if (opt.install) {
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 && element[DATA] || {};
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 (let i = 0; i < node.attributes.length; i++) {
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;
@@ -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().forEach(element => update(element[DATA], e));
48
- apply(element, element => update(element[DATA], e));
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
  }
@@ -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
- const updates = this.$options.update;
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
- const {$options: {computed}} = this;
127
- const values = assign({}, this._computeds);
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 (watch && (
133
- initial && immediate
134
- || hasOwn(values, key) && !isEqual(values[key], this[key])
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
  }
@@ -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 || !el[DATA]) {
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
  }