@zag-js/avatar 2.0.0-next.2 → 2.0.0-next.4
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/avatar.anatomy.d.mts +2 -6
- package/dist/avatar.anatomy.d.ts +2 -6
- package/dist/avatar.anatomy.js +8 -33
- package/dist/avatar.anatomy.mjs +4 -7
- package/dist/avatar.connect.d.mts +4 -7
- package/dist/avatar.connect.d.ts +4 -7
- package/dist/avatar.connect.js +69 -74
- package/dist/avatar.connect.mjs +65 -49
- package/dist/avatar.dom.d.mts +6 -9
- package/dist/avatar.dom.d.ts +6 -9
- package/dist/avatar.dom.js +15 -42
- package/dist/avatar.dom.mjs +7 -13
- package/dist/avatar.machine.d.mts +2 -7
- package/dist/avatar.machine.d.ts +2 -7
- package/dist/avatar.machine.js +81 -129
- package/dist/avatar.machine.mjs +79 -95
- package/dist/avatar.props.d.mts +3 -8
- package/dist/avatar.props.d.ts +3 -8
- package/dist/avatar.props.js +16 -34
- package/dist/avatar.props.mjs +10 -7
- package/dist/avatar.types.d.mts +69 -62
- package/dist/avatar.types.d.ts +69 -62
- package/dist/avatar.types.js +4 -18
- package/dist/avatar.types.mjs +1 -0
- package/dist/index.d.mts +6 -8
- package/dist/index.d.ts +6 -8
- package/dist/index.js +12 -38
- package/dist/index.mjs +2 -7
- package/package.json +7 -7
package/dist/avatar.types.d.ts
CHANGED
|
@@ -1,67 +1,74 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
status: LoadStatus;
|
|
1
|
+
import { CommonProperties, DirectionProperty, PropTypes } from "@zag-js/types";
|
|
2
|
+
import { Machine, Service } from "@zag-js/core";
|
|
3
|
+
export type LoadStatus = "loading" | "error" | "loaded";
|
|
4
|
+
export interface StatusChangeDetails {
|
|
5
|
+
status: LoadStatus;
|
|
7
6
|
}
|
|
8
|
-
interface ElementIds {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
22
|
+
export interface AvatarSchema {
|
|
23
|
+
props: AvatarProps;
|
|
24
|
+
defaultPropKey: never;
|
|
25
|
+
context: any;
|
|
26
|
+
initial: "loading";
|
|
27
|
+
effect: "trackImage";
|
|
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";
|
|
42
41
|
}
|
|
43
|
-
type AvatarService = Service<AvatarSchema>;
|
|
44
|
-
type AvatarMachine = Machine<AvatarSchema>;
|
|
45
|
-
interface
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Whether the image is loaded.
|
|
52
|
-
*/
|
|
53
|
-
loaded: boolean;
|
|
54
|
-
/**
|
|
55
|
-
* Function to set loaded state.
|
|
56
|
-
*/
|
|
57
|
-
setLoaded: VoidFunction;
|
|
58
|
-
/**
|
|
59
|
-
* Function to set error state.
|
|
60
|
-
*/
|
|
61
|
-
setError: VoidFunction;
|
|
62
|
-
getRootProps: () => T["element"];
|
|
63
|
-
getImageProps: () => T["img"];
|
|
64
|
-
getFallbackProps: () => T["element"];
|
|
42
|
+
export type AvatarService = Service<AvatarSchema>;
|
|
43
|
+
export type AvatarMachine = Machine<AvatarSchema>;
|
|
44
|
+
export interface RootState {
|
|
45
|
+
/**
|
|
46
|
+
* The current image loading status.
|
|
47
|
+
*/
|
|
48
|
+
status: LoadStatus;
|
|
65
49
|
}
|
|
66
|
-
|
|
67
|
-
|
|
50
|
+
export interface AvatarApi<T extends PropTypes = PropTypes> {
|
|
51
|
+
/**
|
|
52
|
+
* The current image loading status.
|
|
53
|
+
*/
|
|
54
|
+
status: LoadStatus;
|
|
55
|
+
/**
|
|
56
|
+
* Whether the image is loaded.
|
|
57
|
+
*/
|
|
58
|
+
loaded: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Function to set loaded state.
|
|
61
|
+
*/
|
|
62
|
+
setLoaded: VoidFunction;
|
|
63
|
+
/**
|
|
64
|
+
* Function to set error state.
|
|
65
|
+
*/
|
|
66
|
+
setError: VoidFunction;
|
|
67
|
+
/**
|
|
68
|
+
* Returns the state of the root.
|
|
69
|
+
*/
|
|
70
|
+
getRootState: () => RootState;
|
|
71
|
+
getRootProps: () => T["element"];
|
|
72
|
+
getImageProps: () => T["img"];
|
|
73
|
+
getFallbackProps: () => T["element"];
|
|
74
|
+
}
|
package/dist/avatar.types.js
CHANGED
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
+
});
|
package/dist/avatar.types.mjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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, RootState, StatusChangeDetails } from "./avatar.types.mjs";
|
|
6
|
+
export { type AvatarApi as Api, type ElementIds, type LoadStatus, type AvatarMachine as Machine, type AvatarProps as Props, type RootState, type AvatarService as Service, type StatusChangeDetails, anatomy, connect, machine, props, splitProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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, RootState, StatusChangeDetails } from "./avatar.types.js";
|
|
6
|
+
export { type AvatarApi as Api, type ElementIds, type LoadStatus, type AvatarMachine as Machine, type AvatarProps as Props, type RootState, type AvatarService as Service, type StatusChangeDetails, anatomy, connect, machine, props, splitProps };
|
package/dist/index.js
CHANGED
|
@@ -1,39 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
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": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.4",
|
|
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.
|
|
34
|
-
"@zag-js/core": "2.0.0-next.
|
|
35
|
-
"@zag-js/dom-query": "2.0.0-next.
|
|
36
|
-
"@zag-js/utils": "2.0.0-next.
|
|
37
|
-
"@zag-js/types": "2.0.0-next.
|
|
33
|
+
"@zag-js/anatomy": "2.0.0-next.4",
|
|
34
|
+
"@zag-js/core": "2.0.0-next.4",
|
|
35
|
+
"@zag-js/dom-query": "2.0.0-next.4",
|
|
36
|
+
"@zag-js/utils": "2.0.0-next.4",
|
|
37
|
+
"@zag-js/types": "2.0.0-next.4"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"clean-package": "2.2.0"
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"./package.json": "./package.json"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
69
|
-
"build": "
|
|
69
|
+
"build": "tsdown",
|
|
70
70
|
"lint": "oxlint src",
|
|
71
71
|
"typecheck": "tsc --noEmit"
|
|
72
72
|
}
|