@zag-js/types 0.10.5 → 0.11.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.js CHANGED
@@ -1,9 +1,39 @@
1
- 'use strict';
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
2
19
 
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ createNormalizer: () => createNormalizer
24
+ });
25
+ module.exports = __toCommonJS(src_exports);
4
26
 
5
- const propTypes = require('./prop-types.js');
6
-
7
-
8
-
9
- exports.createNormalizer = propTypes.createNormalizer;
27
+ // src/prop-types.ts
28
+ function createNormalizer(fn) {
29
+ return new Proxy({}, {
30
+ get() {
31
+ return fn;
32
+ }
33
+ });
34
+ }
35
+ // Annotate the CommonJS export names for ESM import in node:
36
+ 0 && (module.exports = {
37
+ createNormalizer
38
+ });
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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":[]}
package/dist/index.mjs CHANGED
@@ -1 +1,12 @@
1
- export { createNormalizer } from './prop-types.mjs';
1
+ // src/prop-types.ts
2
+ function createNormalizer(fn) {
3
+ return new Proxy({}, {
4
+ get() {
5
+ return fn;
6
+ }
7
+ });
8
+ }
9
+ export {
10
+ createNormalizer
11
+ };
12
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/prop-types.ts"],"sourcesContent":["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":";AAyDO,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.10.5",
3
+ "version": "0.11.0",
4
4
  "keywords": [
5
5
  "js",
6
6
  "utils",
@@ -40,7 +40,7 @@
40
40
  "./package.json": "./package.json"
41
41
  },
42
42
  "scripts": {
43
- "build": "vite build -c ../../vite.config.ts",
43
+ "build": "tsup",
44
44
  "test": "jest --config ../../jest.config.js --rootDir . --passWithNoTests",
45
45
  "lint": "eslint src --ext .ts,.tsx",
46
46
  "typecheck": "tsc --noEmit"
@@ -1,48 +0,0 @@
1
- import type { JSX } from "./jsx";
2
- type Dict<T = any> = Record<string, T>;
3
- type Booleanish = boolean | "true" | "false";
4
- type DataAttr = {
5
- "data-selected"?: Booleanish;
6
- "data-expanded"?: Booleanish;
7
- "data-highlighted"?: Booleanish;
8
- "data-readonly"?: Booleanish;
9
- "data-indeterminate"?: Booleanish;
10
- "data-invalid"?: Booleanish;
11
- "data-hover"?: Booleanish;
12
- "data-active"?: Booleanish;
13
- "data-focus"?: Booleanish;
14
- "data-disabled"?: Booleanish;
15
- "data-open"?: Booleanish;
16
- "data-checked"?: Booleanish;
17
- "data-pressed"?: Booleanish;
18
- "data-complete"?: Booleanish;
19
- "data-empty"?: Booleanish;
20
- "data-placeholder-shown"?: Booleanish;
21
- "data-half"?: Booleanish;
22
- "data-scope"?: string;
23
- "data-uid"?: string;
24
- "data-name"?: string;
25
- "data-ownedby"?: string;
26
- "data-type"?: string;
27
- "data-valuetext"?: string;
28
- "data-placement"?: string;
29
- "data-controls"?: string;
30
- "data-part"?: string;
31
- "data-label"?: string;
32
- "data-state"?: string | null;
33
- "data-value"?: string | number;
34
- "data-orientation"?: "horizontal" | "vertical";
35
- "data-count"?: number;
36
- "data-index"?: number;
37
- } & {
38
- [key in `data-${string}`]?: string | number | Booleanish;
39
- };
40
- export type PropTypes<T = Dict> = Record<"button" | "label" | "input" | "img" | "output" | "element" | "select" | "style", T>;
41
- export type NormalizeProps<T extends PropTypes> = {
42
- [K in keyof T]: (props: K extends keyof JSX.IntrinsicElements ? DataAttr & JSX.IntrinsicElements[K] : never) => T[K];
43
- } & {
44
- element(props: DataAttr & JSX.HTMLAttributes<HTMLElement>): T["element"];
45
- style: JSX.CSSProperties;
46
- };
47
- export declare function createNormalizer<T extends PropTypes>(fn: (props: Dict) => Dict): NormalizeProps<T>;
48
- export {};
@@ -1,13 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- function createNormalizer(fn) {
6
- return new Proxy({}, {
7
- get() {
8
- return fn;
9
- }
10
- });
11
- }
12
-
13
- exports.createNormalizer = createNormalizer;
@@ -1,9 +0,0 @@
1
- function createNormalizer(fn) {
2
- return new Proxy({}, {
3
- get() {
4
- return fn;
5
- }
6
- });
7
- }
8
-
9
- export { createNormalizer };