@kws3/ui 2.0.2 → 2.0.4

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/CHANGELOG.mdx CHANGED
@@ -1,3 +1,9 @@
1
+ ## 2.0.4
2
+ - `ToggleButtons` - set the value if not disabled and not the same value is set
3
+
4
+ ## 2.0.3
5
+ - Sveltkit compatibility fix ('window' not defined)
6
+
1
7
  ## 2.0.2
2
8
  - Bugfixes with chart default colours
3
9
  - Set today's date on datepicker initialisation so that long running pages don't stick to the date of first load as today's date
@@ -141,10 +141,12 @@ This property can be bound to, to fetch the current value, Default: `null`
141
141
  export { klass as class };
142
142
 
143
143
  function setValue(v) {
144
- value = v;
145
- /**
146
- * Toggle button change event
147
- */
148
- fire("change");
144
+ if (!disabled && value !== v) {
145
+ value = v;
146
+ /**
147
+ * Toggle button change event
148
+ */
149
+ fire("change");
150
+ }
149
151
  }
150
152
  </script>
@@ -1,4 +1,4 @@
1
- export default (function (win, doc) {
1
+ function initialize(win, doc) {
2
2
  var CP,
3
3
  instance = "__instance__",
4
4
  first = "firstChild",
@@ -619,4 +619,8 @@ export default (function (win, doc) {
619
619
  return $;
620
620
  })
621
621
  );
622
- })(window, document);
622
+ }
623
+
624
+ export default typeof window !== "undefined"
625
+ ? initialize(window, document)
626
+ : function () {};
package/internal/index.js CHANGED
@@ -18,10 +18,12 @@ export function isEscKey(e) {
18
18
  }
19
19
 
20
20
  export const IS_MAC =
21
- "navigator" in window
22
- ? /mac/i.test(
23
- window.navigator.userAgentData
24
- ? window.navigator.userAgentData.platform
25
- : window.navigator.platform
26
- )
21
+ typeof window !== "undefined"
22
+ ? "navigator" in window
23
+ ? /mac/i.test(
24
+ window.navigator.userAgentData
25
+ ? window.navigator.userAgentData.platform
26
+ : window.navigator.platform
27
+ )
28
+ : false
27
29
  : false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kws3/ui",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "description": "UI components for use with Svelte v3 applications.",
5
5
  "main": "index.js",
6
6
  "svelte": "index.js",
@@ -32,5 +32,5 @@
32
32
  "text-mask-core": "^5.1.2",
33
33
  "tippy.js": "^6.3.1"
34
34
  },
35
- "gitHead": "f0fcfc46afc23ad17512ff1a783352372990c22d"
35
+ "gitHead": "499097fc9ed767630977388f4502c9a9e119f886"
36
36
  }
@@ -1,4 +1,7 @@
1
- export const hasResizeObserver = typeof window.ResizeObserver != "undefined";
1
+ export const hasResizeObserver =
2
+ typeof window !== "undefined"
3
+ ? typeof window.ResizeObserver !== "undefined"
4
+ : false;
2
5
 
3
6
  /**
4
7
  * Usage: `<div use:resizeObserver on:resize={resizeHandler}>`
package/utils/index.js CHANGED
@@ -32,18 +32,20 @@ export function cloneObject(obj) {
32
32
  * @param {function} [callback=function(){}] - callback function
33
33
  */
34
34
  export var rAF =
35
- window.requestAnimationFrame ||
36
- //@ts-ignore
37
- window.webkitRequestAnimationFrame ||
38
- //@ts-ignore
39
- window.mozRequestAnimationFrame ||
40
- //@ts-ignore
41
- window.oRequestAnimationFrame ||
42
- //@ts-ignore
43
- window.msRequestAnimationFrame ||
44
- function (callback) {
45
- window.setTimeout(callback, 1000 / 60);
46
- };
35
+ typeof window !== "undefined"
36
+ ? window.requestAnimationFrame ||
37
+ //@ts-ignore
38
+ window.webkitRequestAnimationFrame ||
39
+ //@ts-ignore
40
+ window.mozRequestAnimationFrame ||
41
+ //@ts-ignore
42
+ window.oRequestAnimationFrame ||
43
+ //@ts-ignore
44
+ window.msRequestAnimationFrame ||
45
+ function (callback) {
46
+ window.setTimeout(callback, 1000 / 60);
47
+ }
48
+ : () => {};
47
49
 
48
50
  /**
49
51
  * Returns a function, that, as long as it continues to be invoked, will not