@zag-js/types 0.9.1 → 0.10.0
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/prop-types.d.ts +1 -1
- package/package.json +3 -2
- package/src/index.ts +51 -0
- package/src/jsx.ts +1355 -0
- package/src/prop-types.ts +64 -0
package/dist/prop-types.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ type DataAttr = {
|
|
|
39
39
|
} & {
|
|
40
40
|
[key in `data-${string}`]?: string | number | Booleanish;
|
|
41
41
|
};
|
|
42
|
-
type PropTypes<T = Dict> = Record<"button" | "label" | "input" | "output" | "element" | "select" | "style", T>;
|
|
42
|
+
type PropTypes<T = Dict> = Record<"button" | "label" | "input" | "img" | "output" | "element" | "select" | "style", T>;
|
|
43
43
|
type NormalizeProps<T extends PropTypes> = {
|
|
44
44
|
[K in keyof T]: (props: K extends keyof JSX.IntrinsicElements ? DataAttr & JSX.IntrinsicElements[K] : never) => T[K];
|
|
45
45
|
} & {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"js",
|
|
6
6
|
"utils",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"repository": "https://github.com/chakra-ui/zag/tree/main/packages/utilities/types",
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"files": [
|
|
15
|
-
"dist
|
|
15
|
+
"dist",
|
|
16
|
+
"src"
|
|
16
17
|
],
|
|
17
18
|
"publishConfig": {
|
|
18
19
|
"access": "public"
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { JSX } from "./jsx"
|
|
2
|
+
|
|
3
|
+
export type RequiredBy<T, K extends keyof T> = Partial<Omit<T, K>> & Required<Pick<T, K>>
|
|
4
|
+
|
|
5
|
+
export type Direction = "ltr" | "rtl"
|
|
6
|
+
|
|
7
|
+
export type Orientation = "horizontal" | "vertical"
|
|
8
|
+
|
|
9
|
+
export type MaybeElement<T extends HTMLElement = HTMLElement> = T | null
|
|
10
|
+
|
|
11
|
+
export type DirectionProperty = {
|
|
12
|
+
/**
|
|
13
|
+
* The document's text/writing direction.
|
|
14
|
+
* @default "ltr"
|
|
15
|
+
*/
|
|
16
|
+
dir?: "ltr" | "rtl"
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type CommonProperties = {
|
|
20
|
+
/**
|
|
21
|
+
* The unique identifier of the machine.
|
|
22
|
+
*/
|
|
23
|
+
id: string
|
|
24
|
+
/**
|
|
25
|
+
* A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron.
|
|
26
|
+
*/
|
|
27
|
+
getRootNode?: () => ShadowRoot | Document | Node
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export type RootProperties = {
|
|
31
|
+
/**
|
|
32
|
+
* The owner document of the machine.
|
|
33
|
+
*/
|
|
34
|
+
doc?: Document
|
|
35
|
+
/**
|
|
36
|
+
* The root node of the machine. Useful for shadow DOM.
|
|
37
|
+
*/
|
|
38
|
+
rootNode?: ShadowRoot
|
|
39
|
+
/**
|
|
40
|
+
* The related target when the element is blurred.
|
|
41
|
+
* Used as a polyfill for `e.relatedTarget`
|
|
42
|
+
*/
|
|
43
|
+
pointerdownNode?: HTMLElement | null
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export type Context<T> = T & RootProperties
|
|
47
|
+
|
|
48
|
+
export type Style = JSX.CSSProperties
|
|
49
|
+
|
|
50
|
+
export * from "./prop-types"
|
|
51
|
+
export type { JSX }
|