@zag-js/types 0.19.1 → 0.21.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/index.d.mts CHANGED
@@ -1162,14 +1162,21 @@ type RequiredBy<T, K extends keyof T> = Partial<Omit<T, K>> & Required<Pick<T, K
1162
1162
  type Direction = "ltr" | "rtl";
1163
1163
  type Orientation = "horizontal" | "vertical";
1164
1164
  type MaybeElement<T extends HTMLElement = HTMLElement> = T | null;
1165
- type DirectionProperty = {
1165
+ interface OrientationProperty {
1166
+ /**
1167
+ * The orientation of the element.
1168
+ * @default "horizontal"
1169
+ */
1170
+ orientation?: Orientation;
1171
+ }
1172
+ interface DirectionProperty {
1166
1173
  /**
1167
1174
  * The document's text/writing direction.
1168
1175
  * @default "ltr"
1169
1176
  */
1170
1177
  dir?: "ltr" | "rtl";
1171
- };
1172
- type CommonProperties = {
1178
+ }
1179
+ interface CommonProperties {
1173
1180
  /**
1174
1181
  * The unique identifier of the machine.
1175
1182
  */
@@ -1178,8 +1185,8 @@ type CommonProperties = {
1178
1185
  * A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron.
1179
1186
  */
1180
1187
  getRootNode?: () => ShadowRoot | Document | Node;
1181
- };
1182
- type RootProperties = {
1188
+ }
1189
+ interface RootProperties {
1183
1190
  /**
1184
1191
  * The owner document of the machine.
1185
1192
  */
@@ -1193,8 +1200,8 @@ type RootProperties = {
1193
1200
  * Used as a polyfill for `e.relatedTarget`
1194
1201
  */
1195
1202
  pointerdownNode?: HTMLElement | null;
1196
- };
1203
+ }
1197
1204
  type Context<T> = T & RootProperties;
1198
1205
  type Style = JSX.CSSProperties;
1199
1206
 
1200
- export { CommonProperties, Context, Direction, DirectionProperty, JSX, MaybeElement, NormalizeProps, Orientation, PropTypes, RequiredBy, RootProperties, Style, createNormalizer };
1207
+ export { CommonProperties, Context, Direction, DirectionProperty, JSX, MaybeElement, NormalizeProps, Orientation, OrientationProperty, PropTypes, RequiredBy, RootProperties, Style, createNormalizer };
package/dist/index.d.ts CHANGED
@@ -1162,14 +1162,21 @@ type RequiredBy<T, K extends keyof T> = Partial<Omit<T, K>> & Required<Pick<T, K
1162
1162
  type Direction = "ltr" | "rtl";
1163
1163
  type Orientation = "horizontal" | "vertical";
1164
1164
  type MaybeElement<T extends HTMLElement = HTMLElement> = T | null;
1165
- type DirectionProperty = {
1165
+ interface OrientationProperty {
1166
+ /**
1167
+ * The orientation of the element.
1168
+ * @default "horizontal"
1169
+ */
1170
+ orientation?: Orientation;
1171
+ }
1172
+ interface DirectionProperty {
1166
1173
  /**
1167
1174
  * The document's text/writing direction.
1168
1175
  * @default "ltr"
1169
1176
  */
1170
1177
  dir?: "ltr" | "rtl";
1171
- };
1172
- type CommonProperties = {
1178
+ }
1179
+ interface CommonProperties {
1173
1180
  /**
1174
1181
  * The unique identifier of the machine.
1175
1182
  */
@@ -1178,8 +1185,8 @@ type CommonProperties = {
1178
1185
  * A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron.
1179
1186
  */
1180
1187
  getRootNode?: () => ShadowRoot | Document | Node;
1181
- };
1182
- type RootProperties = {
1188
+ }
1189
+ interface RootProperties {
1183
1190
  /**
1184
1191
  * The owner document of the machine.
1185
1192
  */
@@ -1193,8 +1200,8 @@ type RootProperties = {
1193
1200
  * Used as a polyfill for `e.relatedTarget`
1194
1201
  */
1195
1202
  pointerdownNode?: HTMLElement | null;
1196
- };
1203
+ }
1197
1204
  type Context<T> = T & RootProperties;
1198
1205
  type Style = JSX.CSSProperties;
1199
1206
 
1200
- export { CommonProperties, Context, Direction, DirectionProperty, JSX, MaybeElement, NormalizeProps, Orientation, PropTypes, RequiredBy, RootProperties, Style, createNormalizer };
1207
+ export { CommonProperties, Context, Direction, DirectionProperty, JSX, MaybeElement, NormalizeProps, Orientation, OrientationProperty, PropTypes, RequiredBy, RootProperties, Style, createNormalizer };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/prop-types.ts"],"sourcesContent":["import type { JSX } from \"./jsx\"\n\nexport type RequiredBy<T, K extends keyof T> = Partial<Omit<T, K>> & Required<Pick<T, K>>\n\nexport type Direction = \"ltr\" | \"rtl\"\n\nexport type Orientation = \"horizontal\" | \"vertical\"\n\nexport type MaybeElement<T extends HTMLElement = HTMLElement> = T | null\n\nexport type DirectionProperty = {\n /**\n * The document's text/writing direction.\n * @default \"ltr\"\n */\n dir?: \"ltr\" | \"rtl\"\n}\n\nexport type CommonProperties = {\n /**\n * The unique identifier of the machine.\n */\n id: string\n /**\n * A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron.\n */\n getRootNode?: () => ShadowRoot | Document | Node\n}\n\nexport type RootProperties = {\n /**\n * The owner document of the machine.\n */\n doc?: Document\n /**\n * The root node of the machine. Useful for shadow DOM.\n */\n rootNode?: ShadowRoot\n /**\n * The related target when the element is blurred.\n * Used as a polyfill for `e.relatedTarget`\n */\n pointerdownNode?: HTMLElement | null\n}\n\nexport type Context<T> = T & RootProperties\n\nexport type Style = JSX.CSSProperties\n\nexport * from \"./prop-types\"\nexport type { JSX }\n","import type { JSX } from \"./jsx\"\n\ntype Dict<T = any> = Record<string, T>\n\ntype Booleanish = boolean | \"true\" | \"false\"\n\ntype DataAttr = {\n \"data-selected\"?: Booleanish\n \"data-expanded\"?: Booleanish\n \"data-highlighted\"?: Booleanish\n \"data-readonly\"?: Booleanish\n \"data-indeterminate\"?: Booleanish\n \"data-invalid\"?: Booleanish\n \"data-hover\"?: Booleanish\n \"data-active\"?: Booleanish\n \"data-focus\"?: Booleanish\n \"data-disabled\"?: Booleanish\n \"data-open\"?: Booleanish\n \"data-checked\"?: Booleanish\n \"data-pressed\"?: Booleanish\n \"data-complete\"?: Booleanish\n \"data-empty\"?: Booleanish\n \"data-placeholder-shown\"?: Booleanish\n \"data-half\"?: Booleanish\n \"data-scope\"?: string\n\n \"data-uid\"?: string\n \"data-name\"?: string\n \"data-ownedby\"?: string\n \"data-type\"?: string\n \"data-valuetext\"?: string\n \"data-placement\"?: string\n \"data-controls\"?: string\n \"data-part\"?: string\n \"data-label\"?: string\n \"data-state\"?: string | null\n \"data-value\"?: string | number\n\n \"data-orientation\"?: \"horizontal\" | \"vertical\"\n\n \"data-count\"?: number\n \"data-index\"?: number\n} & {\n [key in `data-${string}`]?: string | number | Booleanish\n}\n\nexport type PropTypes<T = Dict> = Record<\n \"button\" | \"label\" | \"input\" | \"img\" | \"output\" | \"element\" | \"select\" | \"style\",\n T\n>\n\nexport type NormalizeProps<T extends PropTypes> = {\n [K in keyof T]: (props: K extends keyof JSX.IntrinsicElements ? DataAttr & JSX.IntrinsicElements[K] : never) => T[K]\n} & {\n element(props: DataAttr & JSX.HTMLAttributes<HTMLElement>): T[\"element\"]\n style: JSX.CSSProperties\n}\nexport function createNormalizer<T extends PropTypes>(fn: (props: Dict) => Dict): NormalizeProps<T> {\n return new Proxy({} as any, {\n get() {\n return fn\n },\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACyDO,SAAS,iBAAsC,IAA8C;AAClG,SAAO,IAAI,MAAM,CAAC,GAAU;AAAA,IAC1B,MAAM;AACJ,aAAO;AAAA,IACT;AAAA,EACF,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/prop-types.ts"],"sourcesContent":["import type { JSX } from \"./jsx\"\n\nexport type RequiredBy<T, K extends keyof T> = Partial<Omit<T, K>> & Required<Pick<T, K>>\n\nexport type Direction = \"ltr\" | \"rtl\"\n\nexport type Orientation = \"horizontal\" | \"vertical\"\n\nexport type MaybeElement<T extends HTMLElement = HTMLElement> = T | null\n\nexport interface OrientationProperty {\n /**\n * The orientation of the element.\n * @default \"horizontal\"\n */\n orientation?: Orientation\n}\n\nexport interface DirectionProperty {\n /**\n * The document's text/writing direction.\n * @default \"ltr\"\n */\n dir?: \"ltr\" | \"rtl\"\n}\n\nexport interface CommonProperties {\n /**\n * The unique identifier of the machine.\n */\n id: string\n /**\n * A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron.\n */\n getRootNode?: () => ShadowRoot | Document | Node\n}\n\nexport interface RootProperties {\n /**\n * The owner document of the machine.\n */\n doc?: Document\n /**\n * The root node of the machine. Useful for shadow DOM.\n */\n rootNode?: ShadowRoot\n /**\n * The related target when the element is blurred.\n * Used as a polyfill for `e.relatedTarget`\n */\n pointerdownNode?: HTMLElement | null\n}\n\nexport type Context<T> = T & RootProperties\n\nexport type Style = JSX.CSSProperties\n\nexport * from \"./prop-types\"\nexport type { JSX }\n","import type { JSX } from \"./jsx\"\n\ntype Dict<T = any> = Record<string, T>\n\ntype Booleanish = boolean | \"true\" | \"false\"\n\ntype DataAttr = {\n \"data-selected\"?: Booleanish\n \"data-expanded\"?: Booleanish\n \"data-highlighted\"?: Booleanish\n \"data-readonly\"?: Booleanish\n \"data-indeterminate\"?: Booleanish\n \"data-invalid\"?: Booleanish\n \"data-hover\"?: Booleanish\n \"data-active\"?: Booleanish\n \"data-focus\"?: Booleanish\n \"data-disabled\"?: Booleanish\n \"data-open\"?: Booleanish\n \"data-checked\"?: Booleanish\n \"data-pressed\"?: Booleanish\n \"data-complete\"?: Booleanish\n \"data-empty\"?: Booleanish\n \"data-placeholder-shown\"?: Booleanish\n \"data-half\"?: Booleanish\n \"data-scope\"?: string\n\n \"data-uid\"?: string\n \"data-name\"?: string\n \"data-ownedby\"?: string\n \"data-type\"?: string\n \"data-valuetext\"?: string\n \"data-placement\"?: string\n \"data-controls\"?: string\n \"data-part\"?: string\n \"data-label\"?: string\n \"data-state\"?: string | null\n \"data-value\"?: string | number\n\n \"data-orientation\"?: \"horizontal\" | \"vertical\"\n\n \"data-count\"?: number\n \"data-index\"?: number\n} & {\n [key in `data-${string}`]?: string | number | Booleanish\n}\n\nexport type PropTypes<T = Dict> = Record<\n \"button\" | \"label\" | \"input\" | \"img\" | \"output\" | \"element\" | \"select\" | \"style\",\n T\n>\n\nexport type NormalizeProps<T extends PropTypes> = {\n [K in keyof T]: (props: K extends keyof JSX.IntrinsicElements ? DataAttr & JSX.IntrinsicElements[K] : never) => T[K]\n} & {\n element(props: DataAttr & JSX.HTMLAttributes<HTMLElement>): T[\"element\"]\n style: JSX.CSSProperties\n}\nexport function createNormalizer<T extends PropTypes>(fn: (props: Dict) => Dict): NormalizeProps<T> {\n return new Proxy({} as any, {\n get() {\n return fn\n },\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACyDO,SAAS,iBAAsC,IAA8C;AAClG,SAAO,IAAI,MAAM,CAAC,GAAU;AAAA,IAC1B,MAAM;AACJ,aAAO;AAAA,IACT;AAAA,EACF,CAAC;AACH;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/types",
3
- "version": "0.19.1",
3
+ "version": "0.21.0",
4
4
  "keywords": [
5
5
  "js",
6
6
  "utils",
package/src/index.ts CHANGED
@@ -8,7 +8,15 @@ export type Orientation = "horizontal" | "vertical"
8
8
 
9
9
  export type MaybeElement<T extends HTMLElement = HTMLElement> = T | null
10
10
 
11
- export type DirectionProperty = {
11
+ export interface OrientationProperty {
12
+ /**
13
+ * The orientation of the element.
14
+ * @default "horizontal"
15
+ */
16
+ orientation?: Orientation
17
+ }
18
+
19
+ export interface DirectionProperty {
12
20
  /**
13
21
  * The document's text/writing direction.
14
22
  * @default "ltr"
@@ -16,7 +24,7 @@ export type DirectionProperty = {
16
24
  dir?: "ltr" | "rtl"
17
25
  }
18
26
 
19
- export type CommonProperties = {
27
+ export interface CommonProperties {
20
28
  /**
21
29
  * The unique identifier of the machine.
22
30
  */
@@ -27,7 +35,7 @@ export type CommonProperties = {
27
35
  getRootNode?: () => ShadowRoot | Document | Node
28
36
  }
29
37
 
30
- export type RootProperties = {
38
+ export interface RootProperties {
31
39
  /**
32
40
  * The owner document of the machine.
33
41
  */