@zag-js/types 0.1.0 → 0.1.1
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.ts +12 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -8,17 +8,24 @@ export declare type DirectionProperty = {
|
|
|
8
8
|
*/
|
|
9
9
|
dir?: Direction;
|
|
10
10
|
};
|
|
11
|
-
export declare type
|
|
11
|
+
export declare type RootProperties = {
|
|
12
12
|
/**
|
|
13
13
|
* @internal
|
|
14
|
-
* The
|
|
14
|
+
* The owner document of the machine.
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
doc?: Document;
|
|
17
17
|
/**
|
|
18
18
|
* @internal
|
|
19
|
-
* The
|
|
19
|
+
* The root node of the machine. Useful for shadow DOM.
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
rootNode?: ShadowRoot;
|
|
22
|
+
};
|
|
23
|
+
export declare type Context<T> = T & RootProperties & {
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
* The unique identifier of the machine.
|
|
27
|
+
*/
|
|
28
|
+
uid: string;
|
|
22
29
|
/**
|
|
23
30
|
* @internal
|
|
24
31
|
* The related target when the element is blurred.
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAA;AAEnC,oBAAY,SAAS,GAAG,KAAK,GAAG,KAAK,CAAA;AAErC,oBAAY,WAAW,GAAG,YAAY,GAAG,UAAU,CAAA;AAEnD,oBAAY,YAAY,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,IAAI,CAAC,GAAG,IAAI,CAAA;AAExE,oBAAY,iBAAiB,GAAG;IAC9B;;OAEG;IACH,GAAG,CAAC,EAAE,SAAS,CAAA;CAChB,CAAA;AAED,oBAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAA;AAEnC,oBAAY,SAAS,GAAG,KAAK,GAAG,KAAK,CAAA;AAErC,oBAAY,WAAW,GAAG,YAAY,GAAG,UAAU,CAAA;AAEnD,oBAAY,YAAY,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,IAAI,CAAC,GAAG,IAAI,CAAA;AAExE,oBAAY,iBAAiB,GAAG;IAC9B;;OAEG;IACH,GAAG,CAAC,EAAE,SAAS,CAAA;CAChB,CAAA;AAED,oBAAY,cAAc,GAAG;IAC3B;;;OAGG;IACH,GAAG,CAAC,EAAE,QAAQ,CAAA;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,UAAU,CAAA;CACtB,CAAA;AAED,oBAAY,OAAO,CAAC,CAAC,IAAI,CAAC,GACxB,cAAc,GAAG;IACf;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;;;OAIG;IACH,eAAe,CAAC,EAAE,WAAW,GAAG,IAAI,CAAA;CACrC,CAAA;AAEH,oBAAY,KAAK,GAAG,KAAK,CAAC,aAAa,GAAG;IACxC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CAC5C,CAAA;AAED,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA"}
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts", "../src/prop-types.ts", "../src/controls.ts"],
|
|
4
|
-
"sourcesContent": ["import type * as React from \"react\"\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 */\n dir?: Direction\n}\n\nexport type
|
|
4
|
+
"sourcesContent": ["import type * as React from \"react\"\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 */\n dir?: Direction\n}\n\nexport type RootProperties = {\n /**\n * @internal\n * The owner document of the machine.\n */\n doc?: Document\n /**\n * @internal\n * The root node of the machine. Useful for shadow DOM.\n */\n rootNode?: ShadowRoot\n}\n\nexport type Context<T> = T &\n RootProperties & {\n /**\n * @internal\n * The unique identifier of the machine.\n */\n uid: string\n /**\n * @internal\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 Style = React.CSSProperties & {\n [prop: string]: string | number | undefined\n}\n\nexport * from \"./prop-types\"\nexport * from \"./controls\"\n", "import type * as React from \"react\"\n\ntype Dict<T = any> = Record<string, T>\n\ntype Booleanish = boolean | \"true\" | \"false\"\n\ntype Omit<T, K extends keyof T> = { [P in Exclude<keyof T, K>]?: T[P] }\n\ntype WithStyle<T extends { style?: any }> = Omit<T, \"style\"> & {\n style?: T[\"style\"] & {\n [prop: string]: string | number | undefined\n }\n}\n\ntype DataAttr = {\n \"data-uid\"?: string\n \"data-name\"?: string\n \"data-ownedby\"?: string\n \"data-selected\"?: Booleanish\n \"data-expanded\"?: Booleanish\n \"data-highlighted\"?: Booleanish\n \"data-readonly\"?: Booleanish\n \"data-invalid\"?: Booleanish\n \"data-hover\"?: Booleanish\n \"data-active\"?: Booleanish\n \"data-focus\"?: Booleanish\n \"data-disabled\"?: Booleanish\n \"data-type\"?: string\n \"data-value\"?: string | number\n \"data-valuetext\"?: string\n \"data-open\"?: Booleanish\n \"data-placement\"?: string\n \"data-orientation\"?: \"horizontal\" | \"vertical\"\n \"data-label\"?: string\n \"data-checked\"?: Booleanish\n \"data-pressed\"?: Booleanish\n \"data-state\"?: string | null\n \"data-half\"?: Booleanish\n \"data-count\"?: number\n \"data-controls\"?: string\n \"data-part\"?: string\n \"data-index\"?: number\n \"data-complete\"?: Booleanish\n \"data-empty\"?: Booleanish\n \"data-placeholder-shown\"?: Booleanish\n}\n\ntype JSXElementAttributes = DataAttr & React.HTMLAttributes<HTMLElement>\ntype JSXButtonAttributes = DataAttr & React.ButtonHTMLAttributes<HTMLButtonElement>\ntype JSXInputAttributes = DataAttr & React.InputHTMLAttributes<HTMLInputElement>\ntype JSXLabelAttributes = DataAttr & React.LabelHTMLAttributes<HTMLLabelElement>\ntype JSXOutputAttributes = DataAttr & React.OutputHTMLAttributes<HTMLOutputElement>\n\nexport type PropTypes = Record<\"button\" | \"label\" | \"input\" | \"output\" | \"element\", Dict>\n\nexport type ReactPropTypes = {\n button: JSXButtonAttributes\n label: JSXLabelAttributes\n input: JSXInputAttributes\n output: JSXOutputAttributes\n element: JSXElementAttributes\n}\n\nexport type NormalizeProps = {\n button<T extends PropTypes>(props: WithStyle<JSXButtonAttributes>): T[\"button\"]\n label<T extends PropTypes>(props: WithStyle<JSXLabelAttributes>): T[\"label\"]\n input<T extends PropTypes>(props: WithStyle<JSXInputAttributes>): T[\"input\"]\n output<T extends PropTypes>(props: WithStyle<JSXOutputAttributes>): T[\"output\"]\n element<T extends PropTypes>(props: WithStyle<JSXElementAttributes>): T[\"element\"]\n}\n\nexport function createNormalizer(fn: (props: Dict) => Dict): NormalizeProps {\n return { button: fn, label: fn, input: fn, output: fn, element: fn }\n}\n\nexport const normalizeProp = createNormalizer((v) => v)\n", "export type ControlProp =\n | { type: \"boolean\"; label?: string; defaultValue: boolean }\n | { type: \"string\"; label?: string; defaultValue: string; placeholder?: string }\n | { type: \"select\"; options: readonly string[]; defaultValue: string; label?: string }\n | { type: \"multiselect\"; options: readonly string[]; defaultValue: string[]; label?: string }\n | { type: \"number\"; label?: string; defaultValue: number; min?: number; max?: number }\n\nexport type ControlRecord = Record<string, ControlProp>\n\nexport type ControlValue<T extends ControlRecord> = {\n [K in keyof T]: T[K] extends { type: \"boolean\" }\n ? boolean\n : T[K] extends { type: \"string\" }\n ? string\n : T[K] extends { type: \"select\" }\n ? T[K][\"options\"][number]\n : T[K] extends { type: \"multiselect\" }\n ? T[K][\"options\"][number][]\n : T[K] extends { type: \"number\" }\n ? number\n : never\n}\n\nexport function defineControls<T extends ControlRecord>(config: T) {\n return config\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACuEO,0BAA0B,IAA2C;AAC1E,SAAO,EAAE,QAAQ,IAAI,OAAO,IAAI,OAAO,IAAI,QAAQ,IAAI,SAAS,GAAG;AACrE;AAEO,IAAM,gBAAgB,iBAAiB,CAAC,MAAM,CAAC;;;ACpD/C,wBAAiD,QAAW;AACjE,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|