@zag-js/slider 0.0.0-dev-20220704111810 → 0.0.0-dev-20220706194607
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/dist/index.js +31 -34
- package/dist/index.mjs +31 -34
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -48,6 +48,29 @@ var __pow = Math.pow;
|
|
|
48
48
|
var dataAttr = (guard) => {
|
|
49
49
|
return guard ? "" : void 0;
|
|
50
50
|
};
|
|
51
|
+
var runIfFn = (v, ...a) => {
|
|
52
|
+
const res = typeof v === "function" ? v(...a) : v;
|
|
53
|
+
return res != null ? res : void 0;
|
|
54
|
+
};
|
|
55
|
+
var callAll = (...fns) => (...a) => {
|
|
56
|
+
fns.forEach(function(fn) {
|
|
57
|
+
fn == null ? void 0 : fn(...a);
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
var isArray = (v) => Array.isArray(v);
|
|
61
|
+
var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
|
|
62
|
+
var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
|
|
63
|
+
var isDom = () => typeof window !== "undefined";
|
|
64
|
+
function getPlatform() {
|
|
65
|
+
var _a;
|
|
66
|
+
const agent = navigator.userAgentData;
|
|
67
|
+
return (_a = agent == null ? void 0 : agent.platform) != null ? _a : navigator.platform;
|
|
68
|
+
}
|
|
69
|
+
var pt = (v) => isDom() && v.test(getPlatform());
|
|
70
|
+
var isTouchDevice = () => isDom() && !!navigator.maxTouchPoints;
|
|
71
|
+
var isMac = () => pt(/^Mac/) && !isTouchDevice;
|
|
72
|
+
var isApple = () => pt(/mac|iphone|ipad|ipod/i);
|
|
73
|
+
var isIos = () => isApple() && !isMac();
|
|
51
74
|
function getWindow(el) {
|
|
52
75
|
var _a;
|
|
53
76
|
return (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
|
|
@@ -56,6 +79,13 @@ function getNativeEvent(e) {
|
|
|
56
79
|
var _a;
|
|
57
80
|
return (_a = e.nativeEvent) != null ? _a : e;
|
|
58
81
|
}
|
|
82
|
+
var supportsPointerEvent = () => isDom() && window.onpointerdown === null;
|
|
83
|
+
var supportsTouchEvent = () => isDom() && window.ontouchstart === null;
|
|
84
|
+
var supportsMouseEvent = () => isDom() && window.onmousedown === null;
|
|
85
|
+
var isMouseEvent = (v) => isObject(v) && hasProp(v, "button");
|
|
86
|
+
var isTouchEvent = (v) => isObject(v) && hasProp(v, "touches");
|
|
87
|
+
var isLeftClick = (v) => v.button === 0;
|
|
88
|
+
var isModifiedEvent = (v) => v.ctrlKey || v.altKey || v.metaKey;
|
|
59
89
|
function observeAttributes(node, attributes, fn) {
|
|
60
90
|
if (!node)
|
|
61
91
|
return;
|
|
@@ -118,35 +148,6 @@ function getElementOffset(element) {
|
|
|
118
148
|
left
|
|
119
149
|
};
|
|
120
150
|
}
|
|
121
|
-
var isDom = () => typeof window !== "undefined";
|
|
122
|
-
var isArray = (v) => Array.isArray(v);
|
|
123
|
-
var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
|
|
124
|
-
var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
|
|
125
|
-
function getPlatform() {
|
|
126
|
-
var _a;
|
|
127
|
-
const agent = navigator.userAgentData;
|
|
128
|
-
return (_a = agent == null ? void 0 : agent.platform) != null ? _a : navigator.platform;
|
|
129
|
-
}
|
|
130
|
-
var pt = (v) => isDom() && v.test(getPlatform());
|
|
131
|
-
var isTouchDevice = () => isDom() && !!navigator.maxTouchPoints;
|
|
132
|
-
var isMac = () => pt(/^Mac/) && !isTouchDevice;
|
|
133
|
-
var isApple = () => pt(/mac|iphone|ipad|ipod/i);
|
|
134
|
-
var isIos = () => isApple() && !isMac();
|
|
135
|
-
var supportsPointerEvent = () => isDom() && window.onpointerdown === null;
|
|
136
|
-
var supportsTouchEvent = () => isDom() && window.ontouchstart === null;
|
|
137
|
-
var supportsMouseEvent = () => isDom() && window.onmousedown === null;
|
|
138
|
-
var isMouseEvent = (v) => isObject(v) && hasProp(v, "button");
|
|
139
|
-
var isTouchEvent = (v) => isObject(v) && hasProp(v, "touches");
|
|
140
|
-
var isLeftClick = (v) => v.button === 0;
|
|
141
|
-
var runIfFn = (v, ...a) => {
|
|
142
|
-
const res = typeof v === "function" ? v(...a) : v;
|
|
143
|
-
return res != null ? res : void 0;
|
|
144
|
-
};
|
|
145
|
-
var callAll = (...fns) => (...a) => {
|
|
146
|
-
fns.forEach(function(fn) {
|
|
147
|
-
fn == null ? void 0 : fn(...a);
|
|
148
|
-
});
|
|
149
|
-
};
|
|
150
151
|
var fallback = {
|
|
151
152
|
pageX: 0,
|
|
152
153
|
pageY: 0,
|
|
@@ -619,10 +620,6 @@ var dom = __spreadProps(__spreadValues({}, styles), {
|
|
|
619
620
|
}
|
|
620
621
|
});
|
|
621
622
|
|
|
622
|
-
// ../../utilities/core/dist/index.mjs
|
|
623
|
-
var isLeftClick2 = (v) => v.button === 0;
|
|
624
|
-
var isModifiedEvent = (v) => v.ctrlKey || v.altKey || v.metaKey;
|
|
625
|
-
|
|
626
623
|
// src/slider.connect.ts
|
|
627
624
|
function connect(state2, send, normalize) {
|
|
628
625
|
var _a, _b;
|
|
@@ -801,7 +798,7 @@ function connect(state2, send, normalize) {
|
|
|
801
798
|
if (!isInteractive)
|
|
802
799
|
return;
|
|
803
800
|
const evt = getNativeEvent(event);
|
|
804
|
-
if (!
|
|
801
|
+
if (!isLeftClick(evt) || isModifiedEvent(evt))
|
|
805
802
|
return;
|
|
806
803
|
const point = getEventPoint(evt);
|
|
807
804
|
send({ type: "POINTER_DOWN", point });
|
package/dist/index.mjs
CHANGED
|
@@ -23,6 +23,29 @@ var __pow = Math.pow;
|
|
|
23
23
|
var dataAttr = (guard) => {
|
|
24
24
|
return guard ? "" : void 0;
|
|
25
25
|
};
|
|
26
|
+
var runIfFn = (v, ...a) => {
|
|
27
|
+
const res = typeof v === "function" ? v(...a) : v;
|
|
28
|
+
return res != null ? res : void 0;
|
|
29
|
+
};
|
|
30
|
+
var callAll = (...fns) => (...a) => {
|
|
31
|
+
fns.forEach(function(fn) {
|
|
32
|
+
fn == null ? void 0 : fn(...a);
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
var isArray = (v) => Array.isArray(v);
|
|
36
|
+
var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
|
|
37
|
+
var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
|
|
38
|
+
var isDom = () => typeof window !== "undefined";
|
|
39
|
+
function getPlatform() {
|
|
40
|
+
var _a;
|
|
41
|
+
const agent = navigator.userAgentData;
|
|
42
|
+
return (_a = agent == null ? void 0 : agent.platform) != null ? _a : navigator.platform;
|
|
43
|
+
}
|
|
44
|
+
var pt = (v) => isDom() && v.test(getPlatform());
|
|
45
|
+
var isTouchDevice = () => isDom() && !!navigator.maxTouchPoints;
|
|
46
|
+
var isMac = () => pt(/^Mac/) && !isTouchDevice;
|
|
47
|
+
var isApple = () => pt(/mac|iphone|ipad|ipod/i);
|
|
48
|
+
var isIos = () => isApple() && !isMac();
|
|
26
49
|
function getWindow(el) {
|
|
27
50
|
var _a;
|
|
28
51
|
return (_a = el == null ? void 0 : el.ownerDocument.defaultView) != null ? _a : window;
|
|
@@ -31,6 +54,13 @@ function getNativeEvent(e) {
|
|
|
31
54
|
var _a;
|
|
32
55
|
return (_a = e.nativeEvent) != null ? _a : e;
|
|
33
56
|
}
|
|
57
|
+
var supportsPointerEvent = () => isDom() && window.onpointerdown === null;
|
|
58
|
+
var supportsTouchEvent = () => isDom() && window.ontouchstart === null;
|
|
59
|
+
var supportsMouseEvent = () => isDom() && window.onmousedown === null;
|
|
60
|
+
var isMouseEvent = (v) => isObject(v) && hasProp(v, "button");
|
|
61
|
+
var isTouchEvent = (v) => isObject(v) && hasProp(v, "touches");
|
|
62
|
+
var isLeftClick = (v) => v.button === 0;
|
|
63
|
+
var isModifiedEvent = (v) => v.ctrlKey || v.altKey || v.metaKey;
|
|
34
64
|
function observeAttributes(node, attributes, fn) {
|
|
35
65
|
if (!node)
|
|
36
66
|
return;
|
|
@@ -93,35 +123,6 @@ function getElementOffset(element) {
|
|
|
93
123
|
left
|
|
94
124
|
};
|
|
95
125
|
}
|
|
96
|
-
var isDom = () => typeof window !== "undefined";
|
|
97
|
-
var isArray = (v) => Array.isArray(v);
|
|
98
|
-
var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
|
|
99
|
-
var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
|
|
100
|
-
function getPlatform() {
|
|
101
|
-
var _a;
|
|
102
|
-
const agent = navigator.userAgentData;
|
|
103
|
-
return (_a = agent == null ? void 0 : agent.platform) != null ? _a : navigator.platform;
|
|
104
|
-
}
|
|
105
|
-
var pt = (v) => isDom() && v.test(getPlatform());
|
|
106
|
-
var isTouchDevice = () => isDom() && !!navigator.maxTouchPoints;
|
|
107
|
-
var isMac = () => pt(/^Mac/) && !isTouchDevice;
|
|
108
|
-
var isApple = () => pt(/mac|iphone|ipad|ipod/i);
|
|
109
|
-
var isIos = () => isApple() && !isMac();
|
|
110
|
-
var supportsPointerEvent = () => isDom() && window.onpointerdown === null;
|
|
111
|
-
var supportsTouchEvent = () => isDom() && window.ontouchstart === null;
|
|
112
|
-
var supportsMouseEvent = () => isDom() && window.onmousedown === null;
|
|
113
|
-
var isMouseEvent = (v) => isObject(v) && hasProp(v, "button");
|
|
114
|
-
var isTouchEvent = (v) => isObject(v) && hasProp(v, "touches");
|
|
115
|
-
var isLeftClick = (v) => v.button === 0;
|
|
116
|
-
var runIfFn = (v, ...a) => {
|
|
117
|
-
const res = typeof v === "function" ? v(...a) : v;
|
|
118
|
-
return res != null ? res : void 0;
|
|
119
|
-
};
|
|
120
|
-
var callAll = (...fns) => (...a) => {
|
|
121
|
-
fns.forEach(function(fn) {
|
|
122
|
-
fn == null ? void 0 : fn(...a);
|
|
123
|
-
});
|
|
124
|
-
};
|
|
125
126
|
var fallback = {
|
|
126
127
|
pageX: 0,
|
|
127
128
|
pageY: 0,
|
|
@@ -594,10 +595,6 @@ var dom = __spreadProps(__spreadValues({}, styles), {
|
|
|
594
595
|
}
|
|
595
596
|
});
|
|
596
597
|
|
|
597
|
-
// ../../utilities/core/dist/index.mjs
|
|
598
|
-
var isLeftClick2 = (v) => v.button === 0;
|
|
599
|
-
var isModifiedEvent = (v) => v.ctrlKey || v.altKey || v.metaKey;
|
|
600
|
-
|
|
601
598
|
// src/slider.connect.ts
|
|
602
599
|
function connect(state2, send, normalize) {
|
|
603
600
|
var _a, _b;
|
|
@@ -776,7 +773,7 @@ function connect(state2, send, normalize) {
|
|
|
776
773
|
if (!isInteractive)
|
|
777
774
|
return;
|
|
778
775
|
const evt = getNativeEvent(event);
|
|
779
|
-
if (!
|
|
776
|
+
if (!isLeftClick(evt) || isModifiedEvent(evt))
|
|
780
777
|
return;
|
|
781
778
|
const point = getEventPoint(evt);
|
|
782
779
|
send({ type: "POINTER_DOWN", point });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/slider",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20220706194607",
|
|
4
4
|
"description": "Core logic for the slider widget implemented as a state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"url": "https://github.com/chakra-ui/zag/issues"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@zag-js/core": "0.0.0-dev-
|
|
33
|
-
"@zag-js/dom-utils": "0.0.0-dev-
|
|
32
|
+
"@zag-js/core": "0.0.0-dev-20220706194607",
|
|
33
|
+
"@zag-js/dom-utils": "0.0.0-dev-20220706194607",
|
|
34
34
|
"@zag-js/number-utils": "0.1.2",
|
|
35
|
-
"@zag-js/types": "0.0.0-dev-
|
|
35
|
+
"@zag-js/types": "0.0.0-dev-20220706194607",
|
|
36
36
|
"@zag-js/utils": "0.1.2"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|