@zag-js/types 0.2.0 → 0.2.3

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 CHANGED
@@ -20,9 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
- createNormalizer: () => createNormalizer,
24
- defineControls: () => defineControls,
25
- normalizeProp: () => normalizeProp
23
+ createNormalizer: () => createNormalizer
26
24
  });
27
25
  module.exports = __toCommonJS(src_exports);
28
26
 
@@ -34,9 +32,7 @@ function createNormalizer(fn) {
34
32
  }
35
33
  });
36
34
  }
37
- var normalizeProp = createNormalizer((v) => v);
38
-
39
- // src/controls.ts
40
- function defineControls(config) {
41
- return config;
42
- }
35
+ // Annotate the CommonJS export names for ESM import in node:
36
+ 0 && (module.exports = {
37
+ createNormalizer
38
+ });
package/dist/index.mjs CHANGED
@@ -1,5 +1,3 @@
1
- "use strict";
2
-
3
1
  // src/prop-types.ts
4
2
  function createNormalizer(fn) {
5
3
  return new Proxy({}, {
@@ -8,14 +6,6 @@ function createNormalizer(fn) {
8
6
  }
9
7
  });
10
8
  }
11
- var normalizeProp = createNormalizer((v) => v);
12
-
13
- // src/controls.ts
14
- function defineControls(config) {
15
- return config;
16
- }
17
9
  export {
18
- createNormalizer,
19
- defineControls,
20
- normalizeProp
10
+ createNormalizer
21
11
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/types",
3
- "version": "0.2.0",
3
+ "version": "0.2.3",
4
4
  "keywords": [
5
5
  "js",
6
6
  "utils",
@@ -23,13 +23,17 @@
23
23
  "bugs": {
24
24
  "url": "https://github.com/chakra-ui/zag/issues"
25
25
  },
26
+ "dependencies": {
27
+ "csstype": "3.1.0"
28
+ },
26
29
  "scripts": {
27
- "build:fast": "zag build",
28
- "start": "zag build --watch",
29
- "build": "zag build --prod",
30
+ "build-fast": "tsup src/index.ts --format=esm,cjs",
31
+ "start": "pnpm build --watch",
32
+ "build": "tsup src/index.ts --format=esm,cjs --dts",
30
33
  "test": "jest --config ../../jest.config.js --rootDir . --passWithNoTests",
31
34
  "lint": "eslint src --ext .ts,.tsx",
32
- "test:ci": "yarn test --ci --runInBand",
33
- "test:watch": "yarn test --watch --updateSnapshot"
35
+ "test-ci": "pnpm test --ci --runInBand",
36
+ "test-watch": "pnpm test --watch -u",
37
+ "typecheck": "tsc --noEmit"
34
38
  }
35
39
  }
@@ -1,41 +0,0 @@
1
- export declare type ControlProp = {
2
- type: "boolean";
3
- label?: string;
4
- defaultValue: boolean;
5
- } | {
6
- type: "string";
7
- label?: string;
8
- defaultValue: string;
9
- placeholder?: string;
10
- } | {
11
- type: "select";
12
- options: readonly string[];
13
- defaultValue: string;
14
- label?: string;
15
- } | {
16
- type: "multiselect";
17
- options: readonly string[];
18
- defaultValue: string[];
19
- label?: string;
20
- } | {
21
- type: "number";
22
- label?: string;
23
- defaultValue: number;
24
- min?: number;
25
- max?: number;
26
- };
27
- export declare type ControlRecord = Record<string, ControlProp>;
28
- export declare type ControlValue<T extends ControlRecord> = {
29
- [K in keyof T]: T[K] extends {
30
- type: "boolean";
31
- } ? boolean : T[K] extends {
32
- type: "string";
33
- } ? string : T[K] extends {
34
- type: "select";
35
- } ? T[K]["options"][number] : T[K] extends {
36
- type: "multiselect";
37
- } ? T[K]["options"][number][] : T[K] extends {
38
- type: "number";
39
- } ? number : never;
40
- };
41
- export declare function defineControls<T extends ControlRecord>(config: T): T;
@@ -1,69 +0,0 @@
1
- import type * as React from "react";
2
- declare type Dict<T = any> = Record<string, T>;
3
- declare type Booleanish = boolean | "true" | "false";
4
- declare type Omit<T, K extends keyof T> = {
5
- [P in Exclude<keyof T, K>]?: T[P];
6
- };
7
- declare type WithStyle<T extends {
8
- style?: any;
9
- }> = Omit<T, "style"> & {
10
- style?: T["style"] & {
11
- [prop: string]: string | number | undefined;
12
- };
13
- };
14
- declare type DataAttr = {
15
- "data-uid"?: string;
16
- "data-name"?: string;
17
- "data-ownedby"?: string;
18
- "data-selected"?: Booleanish;
19
- "data-expanded"?: Booleanish;
20
- "data-highlighted"?: Booleanish;
21
- "data-readonly"?: Booleanish;
22
- "data-indeterminate"?: Booleanish;
23
- "data-invalid"?: Booleanish;
24
- "data-hover"?: Booleanish;
25
- "data-active"?: Booleanish;
26
- "data-focus"?: Booleanish;
27
- "data-disabled"?: Booleanish;
28
- "data-type"?: string;
29
- "data-value"?: string | number;
30
- "data-valuetext"?: string;
31
- "data-open"?: Booleanish;
32
- "data-placement"?: string;
33
- "data-orientation"?: "horizontal" | "vertical";
34
- "data-label"?: string;
35
- "data-checked"?: Booleanish;
36
- "data-pressed"?: Booleanish;
37
- "data-state"?: string | null;
38
- "data-half"?: Booleanish;
39
- "data-count"?: number;
40
- "data-controls"?: string;
41
- "data-part"?: string;
42
- "data-index"?: number;
43
- "data-complete"?: Booleanish;
44
- "data-empty"?: Booleanish;
45
- "data-placeholder-shown"?: Booleanish;
46
- };
47
- declare type JSXElementAttributes = DataAttr & React.HTMLAttributes<HTMLElement>;
48
- declare type JSXButtonAttributes = DataAttr & React.ButtonHTMLAttributes<HTMLButtonElement>;
49
- declare type JSXInputAttributes = DataAttr & React.InputHTMLAttributes<HTMLInputElement>;
50
- declare type JSXLabelAttributes = DataAttr & React.LabelHTMLAttributes<HTMLLabelElement>;
51
- declare type JSXOutputAttributes = DataAttr & React.OutputHTMLAttributes<HTMLOutputElement>;
52
- export declare type PropTypes = Record<"button" | "label" | "input" | "output" | "element", Dict>;
53
- export declare type ReactPropTypes = {
54
- button: JSXButtonAttributes;
55
- label: JSXLabelAttributes;
56
- input: JSXInputAttributes;
57
- output: JSXOutputAttributes;
58
- element: JSXElementAttributes;
59
- };
60
- export declare type NormalizeProps = {
61
- button<T extends PropTypes>(props: WithStyle<JSXButtonAttributes>): T["button"];
62
- label<T extends PropTypes>(props: WithStyle<JSXLabelAttributes>): T["label"];
63
- input<T extends PropTypes>(props: WithStyle<JSXInputAttributes>): T["input"];
64
- output<T extends PropTypes>(props: WithStyle<JSXOutputAttributes>): T["output"];
65
- element<T extends PropTypes>(props: WithStyle<JSXElementAttributes>): T["element"];
66
- };
67
- export declare function createNormalizer(fn: (props: Dict) => Dict): NormalizeProps;
68
- export declare const normalizeProp: NormalizeProps;
69
- export {};