@zag-js/avatar 2.0.0-next.1 → 2.0.0-next.2

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,9 +1,7 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
6
  var __export = (target, all) => {
9
7
  for (var name in all)
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
17
15
  }
18
16
  return to;
19
17
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
19
 
30
20
  // src/avatar.connect.ts
@@ -34,7 +24,6 @@ __export(avatar_connect_exports, {
34
24
  });
35
25
  module.exports = __toCommonJS(avatar_connect_exports);
36
26
  var import_avatar = require("./avatar.anatomy.js");
37
- var dom = __toESM(require("./avatar.dom.js"));
38
27
  function connect(service, normalize) {
39
28
  const { send, prop, scope } = service;
40
29
  const status = getStatus(service);
@@ -42,10 +31,6 @@ function connect(service, normalize) {
42
31
  return {
43
32
  status,
44
33
  loaded,
45
- setSrc(src) {
46
- const img = dom.getImageEl(scope);
47
- img?.setAttribute("src", src);
48
- },
49
34
  setLoaded() {
50
35
  send({ type: "img.loaded", src: "api" });
51
36
  },
@@ -1,6 +1,5 @@
1
1
  // src/avatar.connect.ts
2
2
  import { parts } from "./avatar.anatomy.mjs";
3
- import * as dom from "./avatar.dom.mjs";
4
3
  function connect(service, normalize) {
5
4
  const { send, prop, scope } = service;
6
5
  const status = getStatus(service);
@@ -8,10 +7,6 @@ function connect(service, normalize) {
8
7
  return {
9
8
  status,
10
9
  loaded,
11
- setSrc(src) {
12
- const img = dom.getImageEl(scope);
13
- img?.setAttribute("src", src);
14
- },
15
10
  setLoaded() {
16
11
  send({ type: "img.loaded", src: "api" });
17
12
  },
@@ -5,11 +5,11 @@ type LoadStatus = "loading" | "error" | "loaded";
5
5
  interface StatusChangeDetails {
6
6
  status: LoadStatus;
7
7
  }
8
- type ElementIds = Partial<{
9
- root: string;
10
- image: string;
11
- fallback: string;
12
- }>;
8
+ interface ElementIds {
9
+ root?: string | undefined;
10
+ image?: string | undefined;
11
+ fallback?: string | undefined;
12
+ }
13
13
  interface AvatarProps extends CommonProperties, DirectionProperty {
14
14
  /**
15
15
  * Functional called when the image loading status changes.
@@ -22,6 +22,7 @@ interface AvatarProps extends CommonProperties, DirectionProperty {
22
22
  }
23
23
  interface AvatarSchema {
24
24
  props: AvatarProps;
25
+ defaultPropKey: never;
25
26
  context: any;
26
27
  initial: "loading";
27
28
  effect: "trackImageRemoval" | "trackSrcChange";
@@ -50,10 +51,6 @@ interface AvatarApi<T extends PropTypes = PropTypes> {
50
51
  * Whether the image is loaded.
51
52
  */
52
53
  loaded: boolean;
53
- /**
54
- * Function to set new src.
55
- */
56
- setSrc: (src: string) => void;
57
54
  /**
58
55
  * Function to set loaded state.
59
56
  */
@@ -5,11 +5,11 @@ type LoadStatus = "loading" | "error" | "loaded";
5
5
  interface StatusChangeDetails {
6
6
  status: LoadStatus;
7
7
  }
8
- type ElementIds = Partial<{
9
- root: string;
10
- image: string;
11
- fallback: string;
12
- }>;
8
+ interface ElementIds {
9
+ root?: string | undefined;
10
+ image?: string | undefined;
11
+ fallback?: string | undefined;
12
+ }
13
13
  interface AvatarProps extends CommonProperties, DirectionProperty {
14
14
  /**
15
15
  * Functional called when the image loading status changes.
@@ -22,6 +22,7 @@ interface AvatarProps extends CommonProperties, DirectionProperty {
22
22
  }
23
23
  interface AvatarSchema {
24
24
  props: AvatarProps;
25
+ defaultPropKey: never;
25
26
  context: any;
26
27
  initial: "loading";
27
28
  effect: "trackImageRemoval" | "trackSrcChange";
@@ -50,10 +51,6 @@ interface AvatarApi<T extends PropTypes = PropTypes> {
50
51
  * Whether the image is loaded.
51
52
  */
52
53
  loaded: boolean;
53
- /**
54
- * Function to set new src.
55
- */
56
- setSrc: (src: string) => void;
57
54
  /**
58
55
  * Function to set loaded state.
59
56
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/avatar",
3
- "version": "2.0.0-next.1",
3
+ "version": "2.0.0-next.2",
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": "2.0.0-next.1",
34
- "@zag-js/core": "2.0.0-next.1",
35
- "@zag-js/dom-query": "2.0.0-next.1",
36
- "@zag-js/utils": "2.0.0-next.1",
37
- "@zag-js/types": "2.0.0-next.1"
33
+ "@zag-js/anatomy": "2.0.0-next.2",
34
+ "@zag-js/core": "2.0.0-next.2",
35
+ "@zag-js/dom-query": "2.0.0-next.2",
36
+ "@zag-js/utils": "2.0.0-next.2",
37
+ "@zag-js/types": "2.0.0-next.2"
38
38
  },
39
39
  "devDependencies": {
40
40
  "clean-package": "2.2.0"
@@ -67,7 +67,7 @@
67
67
  },
68
68
  "scripts": {
69
69
  "build": "tsup",
70
- "lint": "eslint src",
70
+ "lint": "oxlint src",
71
71
  "typecheck": "tsc --noEmit"
72
72
  }
73
73
  }