@zag-js/color-picker 0.9.0 → 0.9.2
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/{chunk-HSUD4DN3.mjs → chunk-KYNJURCY.mjs} +10 -3
- package/dist/color-picker.connect.js +2 -2
- package/dist/color-picker.connect.mjs +1 -1
- package/dist/color-picker.dom.d.ts +7 -7
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/dist/utils/get-channel-display-color.d.ts +1 -2
- package/package.json +10 -10
|
@@ -23,7 +23,14 @@ import {
|
|
|
23
23
|
|
|
24
24
|
// src/color-picker.connect.ts
|
|
25
25
|
import { normalizeColor } from "@zag-js/color-utils";
|
|
26
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
getEventKey,
|
|
28
|
+
getEventPoint,
|
|
29
|
+
getEventStep,
|
|
30
|
+
getNativeEvent,
|
|
31
|
+
isLeftClick,
|
|
32
|
+
isModifiedEvent
|
|
33
|
+
} from "@zag-js/dom-event";
|
|
27
34
|
import { dataAttr } from "@zag-js/dom-query";
|
|
28
35
|
function connect(state, send, normalize) {
|
|
29
36
|
const valueAsColor = state.context.valueAsColor;
|
|
@@ -85,7 +92,7 @@ function connect(state, send, normalize) {
|
|
|
85
92
|
const evt = getNativeEvent(event);
|
|
86
93
|
if (!isLeftClick(evt) || isModifiedEvent(evt))
|
|
87
94
|
return;
|
|
88
|
-
const point =
|
|
95
|
+
const point = getEventPoint(evt);
|
|
89
96
|
const channel = { xChannel, yChannel };
|
|
90
97
|
send({ type: "AREA.POINTER_DOWN", point, channel, id: "area" });
|
|
91
98
|
},
|
|
@@ -180,7 +187,7 @@ function connect(state, send, normalize) {
|
|
|
180
187
|
const evt = getNativeEvent(event);
|
|
181
188
|
if (!isLeftClick(evt) || isModifiedEvent(evt))
|
|
182
189
|
return;
|
|
183
|
-
const point =
|
|
190
|
+
const point = getEventPoint(evt);
|
|
184
191
|
send({ type: "CHANNEL_SLIDER.POINTER_DOWN", channel, point, id: channel, orientation });
|
|
185
192
|
},
|
|
186
193
|
style: {
|
|
@@ -451,7 +451,7 @@ function connect(state, send, normalize) {
|
|
|
451
451
|
const evt = (0, import_dom_event2.getNativeEvent)(event);
|
|
452
452
|
if (!(0, import_dom_event2.isLeftClick)(evt) || (0, import_dom_event2.isModifiedEvent)(evt))
|
|
453
453
|
return;
|
|
454
|
-
const point =
|
|
454
|
+
const point = (0, import_dom_event2.getEventPoint)(evt);
|
|
455
455
|
const channel = { xChannel, yChannel };
|
|
456
456
|
send({ type: "AREA.POINTER_DOWN", point, channel, id: "area" });
|
|
457
457
|
},
|
|
@@ -546,7 +546,7 @@ function connect(state, send, normalize) {
|
|
|
546
546
|
const evt = (0, import_dom_event2.getNativeEvent)(event);
|
|
547
547
|
if (!(0, import_dom_event2.isLeftClick)(evt) || (0, import_dom_event2.isModifiedEvent)(evt))
|
|
548
548
|
return;
|
|
549
|
-
const point =
|
|
549
|
+
const point = (0, import_dom_event2.getEventPoint)(evt);
|
|
550
550
|
send({ type: "CHANNEL_SLIDER.POINTER_DOWN", channel, point, id: channel, orientation });
|
|
551
551
|
},
|
|
552
552
|
style: {
|
|
@@ -9,22 +9,22 @@ type Point = {
|
|
|
9
9
|
};
|
|
10
10
|
declare const dom: {
|
|
11
11
|
getRootNode: (ctx: {
|
|
12
|
-
getRootNode?: (() => Node |
|
|
13
|
-
}) =>
|
|
12
|
+
getRootNode?: (() => Node | ShadowRoot | Document) | undefined;
|
|
13
|
+
}) => ShadowRoot | Document;
|
|
14
14
|
getDoc: (ctx: {
|
|
15
|
-
getRootNode?: (() => Node |
|
|
15
|
+
getRootNode?: (() => Node | ShadowRoot | Document) | undefined;
|
|
16
16
|
}) => Document;
|
|
17
17
|
getWin: (ctx: {
|
|
18
|
-
getRootNode?: (() => Node |
|
|
18
|
+
getRootNode?: (() => Node | ShadowRoot | Document) | undefined;
|
|
19
19
|
}) => Window & typeof globalThis;
|
|
20
20
|
getActiveElement: (ctx: {
|
|
21
|
-
getRootNode?: (() => Node |
|
|
21
|
+
getRootNode?: (() => Node | ShadowRoot | Document) | undefined;
|
|
22
22
|
}) => HTMLElement | null;
|
|
23
23
|
getById: <T extends HTMLElement = HTMLElement>(ctx: {
|
|
24
|
-
getRootNode?: (() => Node |
|
|
24
|
+
getRootNode?: (() => Node | ShadowRoot | Document) | undefined;
|
|
25
25
|
}, id: string) => T | null;
|
|
26
26
|
queryById: <T_1 extends HTMLElement = HTMLElement>(ctx: {
|
|
27
|
-
getRootNode?: (() => Node |
|
|
27
|
+
getRootNode?: (() => Node | ShadowRoot | Document) | undefined;
|
|
28
28
|
}, id: string) => T_1;
|
|
29
29
|
} & {
|
|
30
30
|
getContentId: (ctx: MachineContext) => string;
|
package/dist/index.js
CHANGED
|
@@ -455,7 +455,7 @@ function connect(state, send, normalize) {
|
|
|
455
455
|
const evt = (0, import_dom_event2.getNativeEvent)(event);
|
|
456
456
|
if (!(0, import_dom_event2.isLeftClick)(evt) || (0, import_dom_event2.isModifiedEvent)(evt))
|
|
457
457
|
return;
|
|
458
|
-
const point =
|
|
458
|
+
const point = (0, import_dom_event2.getEventPoint)(evt);
|
|
459
459
|
const channel = { xChannel, yChannel };
|
|
460
460
|
send({ type: "AREA.POINTER_DOWN", point, channel, id: "area" });
|
|
461
461
|
},
|
|
@@ -550,7 +550,7 @@ function connect(state, send, normalize) {
|
|
|
550
550
|
const evt = (0, import_dom_event2.getNativeEvent)(event);
|
|
551
551
|
if (!(0, import_dom_event2.isLeftClick)(evt) || (0, import_dom_event2.isModifiedEvent)(evt))
|
|
552
552
|
return;
|
|
553
|
-
const point =
|
|
553
|
+
const point = (0, import_dom_event2.getEventPoint)(evt);
|
|
554
554
|
send({ type: "CHANNEL_SLIDER.POINTER_DOWN", channel, point, id: channel, orientation });
|
|
555
555
|
},
|
|
556
556
|
style: {
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import * as _zag_js_color_utils_src_types from '@zag-js/color-utils/src/types';
|
|
2
1
|
import { Color, ColorChannel } from '@zag-js/color-utils';
|
|
3
2
|
|
|
4
|
-
declare function getChannelDisplayColor(color: Color, channel: ColorChannel):
|
|
3
|
+
declare function getChannelDisplayColor(color: Color, channel: ColorChannel): Color;
|
|
5
4
|
|
|
6
5
|
export { getChannelDisplayColor };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/color-picker",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "Core logic for the color-picker widget implemented as a state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"js",
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
"url": "https://github.com/chakra-ui/zag/issues"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@zag-js/core": "0.
|
|
31
|
-
"@zag-js/anatomy": "0.9.
|
|
32
|
-
"@zag-js/dom-query": "0.
|
|
33
|
-
"@zag-js/dom-event": "0.
|
|
34
|
-
"@zag-js/utils": "0.
|
|
35
|
-
"@zag-js/color-utils": "0.
|
|
36
|
-
"@zag-js/numeric-range": "0.
|
|
37
|
-
"@zag-js/text-selection": "0.
|
|
38
|
-
"@zag-js/types": "0.
|
|
30
|
+
"@zag-js/core": "0.9.2",
|
|
31
|
+
"@zag-js/anatomy": "0.9.2",
|
|
32
|
+
"@zag-js/dom-query": "0.9.2",
|
|
33
|
+
"@zag-js/dom-event": "0.9.2",
|
|
34
|
+
"@zag-js/utils": "0.9.2",
|
|
35
|
+
"@zag-js/color-utils": "0.9.2",
|
|
36
|
+
"@zag-js/numeric-range": "0.9.2",
|
|
37
|
+
"@zag-js/text-selection": "0.9.2",
|
|
38
|
+
"@zag-js/types": "0.9.2"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"clean-package": "2.2.0"
|