@zag-js/avatar 1.46.0 → 1.48.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.
@@ -1,66 +1,63 @@
1
- import { Machine, Service } from '@zag-js/core';
2
- import { CommonProperties, DirectionProperty, PropTypes } from '@zag-js/types';
3
-
4
- type LoadStatus = "error" | "loaded";
5
- interface StatusChangeDetails {
6
- status: LoadStatus;
1
+ import { CommonProperties, DirectionProperty, PropTypes } from "@zag-js/types";
2
+ import { Machine, Service } from "@zag-js/core";
3
+ export type LoadStatus = "error" | "loaded";
4
+ export interface StatusChangeDetails {
5
+ status: LoadStatus;
7
6
  }
8
- interface ElementIds {
9
- root?: string | undefined;
10
- image?: string | undefined;
11
- fallback?: string | undefined;
7
+ export interface ElementIds {
8
+ root?: string | undefined;
9
+ image?: string | undefined;
10
+ fallback?: string | undefined;
12
11
  }
13
- interface AvatarProps extends CommonProperties, DirectionProperty {
14
- /**
15
- * Functional called when the image loading status changes.
16
- */
17
- onStatusChange?: ((details: StatusChangeDetails) => void) | undefined;
18
- /**
19
- * The ids of the elements in the avatar. Useful for composition.
20
- */
21
- ids?: ElementIds | undefined;
12
+ export interface AvatarProps extends CommonProperties, DirectionProperty {
13
+ /**
14
+ * Functional called when the image loading status changes.
15
+ */
16
+ onStatusChange?: ((details: StatusChangeDetails) => void) | undefined;
17
+ /**
18
+ * The ids of the elements in the avatar. Useful for composition.
19
+ */
20
+ ids?: ElementIds | undefined;
22
21
  }
23
- interface AvatarSchema {
24
- props: AvatarProps;
25
- context: any;
26
- initial: "loading";
27
- effect: "trackImageRemoval" | "trackSrcChange";
28
- action: "invokeOnLoad" | "invokeOnError" | "checkImageStatus";
29
- event: {
30
- type: "img.loaded";
31
- src?: string | undefined;
32
- } | {
33
- type: "img.error";
34
- src?: string | undefined;
35
- } | {
36
- type: "img.unmount";
37
- } | {
38
- type: "src.change";
39
- };
40
- state: "loading" | "error" | "loaded";
22
+ export interface AvatarSchema {
23
+ props: AvatarProps;
24
+ context: any;
25
+ initial: "loading";
26
+ effect: "trackImageRemoval" | "trackSrcChange";
27
+ action: "invokeOnLoad" | "invokeOnError" | "checkImageStatus";
28
+ event: {
29
+ type: "img.loaded";
30
+ src?: string | undefined;
31
+ } | {
32
+ type: "img.error";
33
+ src?: string | undefined;
34
+ } | {
35
+ type: "img.unmount";
36
+ } | {
37
+ type: "src.change";
38
+ };
39
+ state: "loading" | "error" | "loaded";
41
40
  }
42
- type AvatarService = Service<AvatarSchema>;
43
- type AvatarMachine = Machine<AvatarSchema>;
44
- interface AvatarApi<T extends PropTypes = PropTypes> {
45
- /**
46
- * Whether the image is loaded.
47
- */
48
- loaded: boolean;
49
- /**
50
- * Function to set new src.
51
- */
52
- setSrc: (src: string) => void;
53
- /**
54
- * Function to set loaded state.
55
- */
56
- setLoaded: VoidFunction;
57
- /**
58
- * Function to set error state.
59
- */
60
- setError: VoidFunction;
61
- getRootProps: () => T["element"];
62
- getImageProps: () => T["img"];
63
- getFallbackProps: () => T["element"];
64
- }
65
-
66
- export type { AvatarApi, AvatarMachine, AvatarProps, AvatarSchema, AvatarService, ElementIds, LoadStatus, StatusChangeDetails };
41
+ export type AvatarService = Service<AvatarSchema>;
42
+ export type AvatarMachine = Machine<AvatarSchema>;
43
+ export interface AvatarApi<T extends PropTypes = PropTypes> {
44
+ /**
45
+ * Whether the image is loaded.
46
+ */
47
+ loaded: boolean;
48
+ /**
49
+ * Function to set new src.
50
+ */
51
+ setSrc: (src: string) => void;
52
+ /**
53
+ * Function to set loaded state.
54
+ */
55
+ setLoaded: VoidFunction;
56
+ /**
57
+ * Function to set error state.
58
+ */
59
+ setError: VoidFunction;
60
+ getRootProps: () => T["element"];
61
+ getImageProps: () => T["img"];
62
+ getFallbackProps: () => T["element"];
63
+ }
@@ -1,18 +1,4 @@
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 __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
-
16
- // src/avatar.types.ts
17
- var avatar_types_exports = {};
18
- module.exports = __toCommonJS(avatar_types_exports);
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.d.mts CHANGED
@@ -1,8 +1,6 @@
1
- export { anatomy } from './avatar.anatomy.mjs';
2
- export { connect } from './avatar.connect.mjs';
3
- export { machine } from './avatar.machine.mjs';
4
- export { props, splitProps } from './avatar.props.mjs';
5
- export { AvatarApi as Api, ElementIds, LoadStatus, AvatarMachine as Machine, AvatarProps as Props, AvatarService as Service, StatusChangeDetails } from './avatar.types.mjs';
6
- import '@zag-js/anatomy';
7
- import '@zag-js/types';
8
- import '@zag-js/core';
1
+ import { anatomy } from "./avatar.anatomy.mjs";
2
+ import { connect } from "./avatar.connect.mjs";
3
+ import { machine } from "./avatar.machine.mjs";
4
+ import { props, splitProps } from "./avatar.props.mjs";
5
+ import { AvatarApi, AvatarMachine, AvatarProps, AvatarService, ElementIds, LoadStatus, StatusChangeDetails } from "./avatar.types.mjs";
6
+ export { type AvatarApi as Api, type ElementIds, type LoadStatus, type AvatarMachine as Machine, type AvatarProps as Props, type AvatarService as Service, type StatusChangeDetails, anatomy, connect, machine, props, splitProps };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,6 @@
1
- export { anatomy } from './avatar.anatomy.js';
2
- export { connect } from './avatar.connect.js';
3
- export { machine } from './avatar.machine.js';
4
- export { props, splitProps } from './avatar.props.js';
5
- export { AvatarApi as Api, ElementIds, LoadStatus, AvatarMachine as Machine, AvatarProps as Props, AvatarService as Service, StatusChangeDetails } from './avatar.types.js';
6
- import '@zag-js/anatomy';
7
- import '@zag-js/types';
8
- import '@zag-js/core';
1
+ import { anatomy } from "./avatar.anatomy.js";
2
+ import { connect } from "./avatar.connect.js";
3
+ import { machine } from "./avatar.machine.js";
4
+ import { props, splitProps } from "./avatar.props.js";
5
+ import { AvatarApi, AvatarMachine, AvatarProps, AvatarService, ElementIds, LoadStatus, StatusChangeDetails } from "./avatar.types.js";
6
+ export { type AvatarApi as Api, type ElementIds, type LoadStatus, type AvatarMachine as Machine, type AvatarProps as Props, type AvatarService as Service, type StatusChangeDetails, anatomy, connect, machine, props, splitProps };
package/dist/index.js CHANGED
@@ -1,39 +1,13 @@
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/index.ts
22
- var index_exports = {};
23
- __export(index_exports, {
24
- anatomy: () => import_avatar.anatomy,
25
- connect: () => import_avatar2.connect,
26
- machine: () => import_avatar3.machine
27
- });
28
- module.exports = __toCommonJS(index_exports);
29
- var import_avatar = require("./avatar.anatomy.js");
30
- var import_avatar2 = require("./avatar.connect.js");
31
- var import_avatar3 = require("./avatar.machine.js");
32
- __reExport(index_exports, require("./avatar.props.js"), module.exports);
33
- // Annotate the CommonJS export names for ESM import in node:
34
- 0 && (module.exports = {
35
- anatomy,
36
- connect,
37
- machine,
38
- ...require("./avatar.props.js")
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
39
4
  });
5
+ const require_avatar_anatomy = require("./avatar.anatomy.js");
6
+ const require_avatar_connect = require("./avatar.connect.js");
7
+ const require_avatar_machine = require("./avatar.machine.js");
8
+ const require_avatar_props = require("./avatar.props.js");
9
+ exports.anatomy = require_avatar_anatomy.anatomy;
10
+ exports.connect = require_avatar_connect.connect;
11
+ exports.machine = require_avatar_machine.machine;
12
+ exports.props = require_avatar_props.props;
13
+ exports.splitProps = require_avatar_props.splitProps;
package/dist/index.mjs CHANGED
@@ -1,10 +1,5 @@
1
- // src/index.ts
2
1
  import { anatomy } from "./avatar.anatomy.mjs";
3
2
  import { connect } from "./avatar.connect.mjs";
4
3
  import { machine } from "./avatar.machine.mjs";
5
- export * from "./avatar.props.mjs";
6
- export {
7
- anatomy,
8
- connect,
9
- machine
10
- };
4
+ import { props, splitProps } from "./avatar.props.mjs";
5
+ export { anatomy, connect, machine, props, splitProps };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/avatar",
3
- "version": "1.46.0",
3
+ "version": "1.48.0",
4
4
  "description": "Core logic for the avatar widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -30,11 +30,11 @@
30
30
  "url": "https://github.com/chakra-ui/zag/issues"
31
31
  },
32
32
  "dependencies": {
33
- "@zag-js/anatomy": "1.46.0",
34
- "@zag-js/core": "1.46.0",
35
- "@zag-js/dom-query": "1.46.0",
36
- "@zag-js/utils": "1.46.0",
37
- "@zag-js/types": "1.46.0"
33
+ "@zag-js/anatomy": "1.48.0",
34
+ "@zag-js/core": "1.48.0",
35
+ "@zag-js/dom-query": "1.48.0",
36
+ "@zag-js/utils": "1.48.0",
37
+ "@zag-js/types": "1.48.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "clean-package": "2.2.0"
@@ -66,8 +66,8 @@
66
66
  "./package.json": "./package.json"
67
67
  },
68
68
  "scripts": {
69
- "build": "tsup",
70
- "lint": "eslint src",
69
+ "build": "tsdown",
70
+ "lint": "oxlint src",
71
71
  "typecheck": "tsc --noEmit"
72
72
  }
73
73
  }