@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,6 +1,2 @@
1
- import * as _zag_js_anatomy from '@zag-js/anatomy';
2
-
3
- declare const anatomy: _zag_js_anatomy.AnatomyInstance<"root" | "image" | "fallback">;
4
- declare const parts: Record<"root" | "image" | "fallback", _zag_js_anatomy.AnatomyPart>;
5
-
6
- export { anatomy, parts };
1
+ export declare const anatomy: import("@zag-js/anatomy").AnatomyInstance<"fallback" | "image" | "root">;
2
+ export declare const parts: Record<"fallback" | "image" | "root", import("@zag-js/anatomy").AnatomyPart>;
@@ -1,6 +1,2 @@
1
- import * as _zag_js_anatomy from '@zag-js/anatomy';
2
-
3
- declare const anatomy: _zag_js_anatomy.AnatomyInstance<"root" | "image" | "fallback">;
4
- declare const parts: Record<"root" | "image" | "fallback", _zag_js_anatomy.AnatomyPart>;
5
-
6
- export { anatomy, parts };
1
+ export declare const anatomy: import("@zag-js/anatomy").AnatomyInstance<"fallback" | "image" | "root">;
2
+ export declare const parts: Record<"fallback" | "image" | "root", import("@zag-js/anatomy").AnatomyPart>;
@@ -1,34 +1,9 @@
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);
19
-
20
- // src/avatar.anatomy.ts
21
- var avatar_anatomy_exports = {};
22
- __export(avatar_anatomy_exports, {
23
- anatomy: () => anatomy,
24
- parts: () => parts
25
- });
26
- module.exports = __toCommonJS(avatar_anatomy_exports);
27
- var import_anatomy = require("@zag-js/anatomy");
28
- var anatomy = (0, import_anatomy.createAnatomy)("avatar").parts("root", "image", "fallback");
29
- var parts = anatomy.build();
30
- // Annotate the CommonJS export names for ESM import in node:
31
- 0 && (module.exports = {
32
- anatomy,
33
- parts
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
34
4
  });
5
+ // src/avatar.anatomy.ts
6
+ const anatomy = (0, require("@zag-js/anatomy").createAnatomy)("avatar").parts("root", "image", "fallback");
7
+ const parts = anatomy.build();
8
+ exports.anatomy = anatomy;
9
+ exports.parts = parts;
@@ -1,8 +1,5 @@
1
- // src/avatar.anatomy.ts
2
1
  import { createAnatomy } from "@zag-js/anatomy";
3
- var anatomy = createAnatomy("avatar").parts("root", "image", "fallback");
4
- var parts = anatomy.build();
5
- export {
6
- anatomy,
7
- parts
8
- };
2
+ // src/avatar.anatomy.ts
3
+ const anatomy = createAnatomy("avatar").parts("root", "image", "fallback");
4
+ const parts = anatomy.build();
5
+ export { anatomy, parts };
@@ -1,7 +1,4 @@
1
- import { PropTypes, NormalizeProps } from '@zag-js/types';
2
- import { Service } from '@zag-js/core';
3
- import { AvatarSchema, AvatarApi } from './avatar.types.mjs';
4
-
5
- declare function connect<T extends PropTypes>(service: Service<AvatarSchema>, normalize: NormalizeProps<T>): AvatarApi<T>;
6
-
7
- export { connect };
1
+ import { AvatarApi, AvatarSchema } from "./avatar.types.mjs";
2
+ import { Service } from "@zag-js/core";
3
+ import { NormalizeProps, PropTypes } from "@zag-js/types";
4
+ export declare function connect<T extends PropTypes>(service: Service<AvatarSchema>, normalize: NormalizeProps<T>): AvatarApi<T>;
@@ -1,7 +1,4 @@
1
- import { PropTypes, NormalizeProps } from '@zag-js/types';
2
- import { Service } from '@zag-js/core';
3
- import { AvatarSchema, AvatarApi } from './avatar.types.js';
4
-
5
- declare function connect<T extends PropTypes>(service: Service<AvatarSchema>, normalize: NormalizeProps<T>): AvatarApi<T>;
6
-
7
- export { connect };
1
+ import { AvatarApi, AvatarSchema } from "./avatar.types.js";
2
+ import { NormalizeProps, PropTypes } from "@zag-js/types";
3
+ import { Service } from "@zag-js/core";
4
+ export declare function connect<T extends PropTypes>(service: Service<AvatarSchema>, normalize: NormalizeProps<T>): AvatarApi<T>;
@@ -1,89 +1,67 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
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
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/avatar.connect.ts
31
- var avatar_connect_exports = {};
32
- __export(avatar_connect_exports, {
33
- connect: () => connect
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
34
4
  });
35
- module.exports = __toCommonJS(avatar_connect_exports);
36
- var import_avatar = require("./avatar.anatomy.js");
37
- var dom = __toESM(require("./avatar.dom.js"));
5
+ const require_avatar_anatomy = require("./avatar.anatomy.js");
6
+ const require_avatar_dom = require("./avatar.dom.js");
7
+ // src/avatar.connect.ts
38
8
  function connect(service, normalize) {
39
- const { state, send, prop, scope } = service;
40
- const loaded = state.matches("loaded");
41
- return {
42
- loaded,
43
- setSrc(src) {
44
- const img = dom.getImageEl(scope);
45
- img?.setAttribute("src", src);
46
- },
47
- setLoaded() {
48
- send({ type: "img.loaded", src: "api" });
49
- },
50
- setError() {
51
- send({ type: "img.error", src: "api" });
52
- },
53
- getRootProps() {
54
- return normalize.element({
55
- ...import_avatar.parts.root.attrs,
56
- dir: prop("dir"),
57
- id: dom.getRootId(scope)
58
- });
59
- },
60
- getImageProps() {
61
- return normalize.img({
62
- ...import_avatar.parts.image.attrs,
63
- hidden: !loaded,
64
- dir: prop("dir"),
65
- id: dom.getImageId(scope),
66
- "data-state": loaded ? "visible" : "hidden",
67
- onLoad() {
68
- send({ type: "img.loaded", src: "element" });
69
- },
70
- onError() {
71
- send({ type: "img.error", src: "element" });
72
- }
73
- });
74
- },
75
- getFallbackProps() {
76
- return normalize.element({
77
- ...import_avatar.parts.fallback.attrs,
78
- dir: prop("dir"),
79
- id: dom.getFallbackId(scope),
80
- hidden: loaded,
81
- "data-state": loaded ? "hidden" : "visible"
82
- });
83
- }
84
- };
9
+ const { state, send, prop, scope } = service;
10
+ const loaded = state.matches("loaded");
11
+ return {
12
+ loaded,
13
+ setSrc(src) {
14
+ require_avatar_dom.getImageEl(scope)?.setAttribute("src", src);
15
+ },
16
+ setLoaded() {
17
+ send({
18
+ type: "img.loaded",
19
+ src: "api"
20
+ });
21
+ },
22
+ setError() {
23
+ send({
24
+ type: "img.error",
25
+ src: "api"
26
+ });
27
+ },
28
+ getRootProps() {
29
+ return normalize.element({
30
+ ...require_avatar_anatomy.parts.root.attrs,
31
+ dir: prop("dir"),
32
+ id: require_avatar_dom.getRootId(scope)
33
+ });
34
+ },
35
+ getImageProps() {
36
+ return normalize.img({
37
+ ...require_avatar_anatomy.parts.image.attrs,
38
+ hidden: !loaded,
39
+ dir: prop("dir"),
40
+ id: require_avatar_dom.getImageId(scope),
41
+ "data-state": loaded ? "visible" : "hidden",
42
+ onLoad() {
43
+ send({
44
+ type: "img.loaded",
45
+ src: "element"
46
+ });
47
+ },
48
+ onError() {
49
+ send({
50
+ type: "img.error",
51
+ src: "element"
52
+ });
53
+ }
54
+ });
55
+ },
56
+ getFallbackProps() {
57
+ return normalize.element({
58
+ ...require_avatar_anatomy.parts.fallback.attrs,
59
+ dir: prop("dir"),
60
+ id: require_avatar_dom.getFallbackId(scope),
61
+ hidden: loaded,
62
+ "data-state": loaded ? "hidden" : "visible"
63
+ });
64
+ }
65
+ };
85
66
  }
86
- // Annotate the CommonJS export names for ESM import in node:
87
- 0 && (module.exports = {
88
- connect
89
- });
67
+ exports.connect = connect;
@@ -1,54 +1,63 @@
1
- // src/avatar.connect.ts
2
1
  import { parts } from "./avatar.anatomy.mjs";
3
- import * as dom from "./avatar.dom.mjs";
2
+ import { getFallbackId, getImageEl, getImageId, getRootId } from "./avatar.dom.mjs";
3
+ // src/avatar.connect.ts
4
4
  function connect(service, normalize) {
5
- const { state, send, prop, scope } = service;
6
- const loaded = state.matches("loaded");
7
- return {
8
- loaded,
9
- setSrc(src) {
10
- const img = dom.getImageEl(scope);
11
- img?.setAttribute("src", src);
12
- },
13
- setLoaded() {
14
- send({ type: "img.loaded", src: "api" });
15
- },
16
- setError() {
17
- send({ type: "img.error", src: "api" });
18
- },
19
- getRootProps() {
20
- return normalize.element({
21
- ...parts.root.attrs,
22
- dir: prop("dir"),
23
- id: dom.getRootId(scope)
24
- });
25
- },
26
- getImageProps() {
27
- return normalize.img({
28
- ...parts.image.attrs,
29
- hidden: !loaded,
30
- dir: prop("dir"),
31
- id: dom.getImageId(scope),
32
- "data-state": loaded ? "visible" : "hidden",
33
- onLoad() {
34
- send({ type: "img.loaded", src: "element" });
35
- },
36
- onError() {
37
- send({ type: "img.error", src: "element" });
38
- }
39
- });
40
- },
41
- getFallbackProps() {
42
- return normalize.element({
43
- ...parts.fallback.attrs,
44
- dir: prop("dir"),
45
- id: dom.getFallbackId(scope),
46
- hidden: loaded,
47
- "data-state": loaded ? "hidden" : "visible"
48
- });
49
- }
50
- };
5
+ const { state, send, prop, scope } = service;
6
+ const loaded = state.matches("loaded");
7
+ return {
8
+ loaded,
9
+ setSrc(src) {
10
+ getImageEl(scope)?.setAttribute("src", src);
11
+ },
12
+ setLoaded() {
13
+ send({
14
+ type: "img.loaded",
15
+ src: "api"
16
+ });
17
+ },
18
+ setError() {
19
+ send({
20
+ type: "img.error",
21
+ src: "api"
22
+ });
23
+ },
24
+ getRootProps() {
25
+ return normalize.element({
26
+ ...parts.root.attrs,
27
+ dir: prop("dir"),
28
+ id: getRootId(scope)
29
+ });
30
+ },
31
+ getImageProps() {
32
+ return normalize.img({
33
+ ...parts.image.attrs,
34
+ hidden: !loaded,
35
+ dir: prop("dir"),
36
+ id: getImageId(scope),
37
+ "data-state": loaded ? "visible" : "hidden",
38
+ onLoad() {
39
+ send({
40
+ type: "img.loaded",
41
+ src: "element"
42
+ });
43
+ },
44
+ onError() {
45
+ send({
46
+ type: "img.error",
47
+ src: "element"
48
+ });
49
+ }
50
+ });
51
+ },
52
+ getFallbackProps() {
53
+ return normalize.element({
54
+ ...parts.fallback.attrs,
55
+ dir: prop("dir"),
56
+ id: getFallbackId(scope),
57
+ hidden: loaded,
58
+ "data-state": loaded ? "hidden" : "visible"
59
+ });
60
+ }
61
+ };
51
62
  }
52
- export {
53
- connect
54
- };
63
+ export { connect };
@@ -1,9 +1,6 @@
1
- import { Scope } from '@zag-js/core';
2
-
3
- declare const getRootId: (ctx: Scope) => any;
4
- declare const getImageId: (ctx: Scope) => any;
5
- declare const getFallbackId: (ctx: Scope) => any;
6
- declare const getRootEl: (ctx: Scope) => HTMLElement | null;
7
- declare const getImageEl: (ctx: Scope) => HTMLImageElement | null;
8
-
9
- export { getFallbackId, getImageEl, getImageId, getRootEl, getRootId };
1
+ import { Scope } from "@zag-js/core";
2
+ export declare const getRootId: (ctx: Scope) => any;
3
+ export declare const getImageId: (ctx: Scope) => any;
4
+ export declare const getFallbackId: (ctx: Scope) => any;
5
+ export declare const getRootEl: (ctx: Scope) => HTMLElement | null;
6
+ export declare const getImageEl: (ctx: Scope) => HTMLImageElement | null;
@@ -1,9 +1,6 @@
1
- import { Scope } from '@zag-js/core';
2
-
3
- declare const getRootId: (ctx: Scope) => any;
4
- declare const getImageId: (ctx: Scope) => any;
5
- declare const getFallbackId: (ctx: Scope) => any;
6
- declare const getRootEl: (ctx: Scope) => HTMLElement | null;
7
- declare const getImageEl: (ctx: Scope) => HTMLImageElement | null;
8
-
9
- export { getFallbackId, getImageEl, getImageId, getRootEl, getRootId };
1
+ import { Scope } from "@zag-js/core";
2
+ export declare const getRootId: (ctx: Scope) => any;
3
+ export declare const getImageId: (ctx: Scope) => any;
4
+ export declare const getFallbackId: (ctx: Scope) => any;
5
+ export declare const getRootEl: (ctx: Scope) => HTMLElement | null;
6
+ export declare const getImageEl: (ctx: Scope) => HTMLImageElement | null;
@@ -1,42 +1,15 @@
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);
19
-
20
- // src/avatar.dom.ts
21
- var avatar_dom_exports = {};
22
- __export(avatar_dom_exports, {
23
- getFallbackId: () => getFallbackId,
24
- getImageEl: () => getImageEl,
25
- getImageId: () => getImageId,
26
- getRootEl: () => getRootEl,
27
- getRootId: () => getRootId
28
- });
29
- module.exports = __toCommonJS(avatar_dom_exports);
30
- var getRootId = (ctx) => ctx.ids?.root ?? `avatar:${ctx.id}`;
31
- var getImageId = (ctx) => ctx.ids?.image ?? `avatar:${ctx.id}:image`;
32
- var getFallbackId = (ctx) => ctx.ids?.fallback ?? `avatar:${ctx.id}:fallback`;
33
- var getRootEl = (ctx) => ctx.getById(getRootId(ctx));
34
- var getImageEl = (ctx) => ctx.getById(getImageId(ctx));
35
- // Annotate the CommonJS export names for ESM import in node:
36
- 0 && (module.exports = {
37
- getFallbackId,
38
- getImageEl,
39
- getImageId,
40
- getRootEl,
41
- getRootId
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
42
4
  });
5
+ // src/avatar.dom.ts
6
+ const getRootId = (ctx) => ctx.ids?.root ?? `avatar:${ctx.id}`;
7
+ const getImageId = (ctx) => ctx.ids?.image ?? `avatar:${ctx.id}:image`;
8
+ const getFallbackId = (ctx) => ctx.ids?.fallback ?? `avatar:${ctx.id}:fallback`;
9
+ const getRootEl = (ctx) => ctx.getById(getRootId(ctx));
10
+ const getImageEl = (ctx) => ctx.getById(getImageId(ctx));
11
+ exports.getFallbackId = getFallbackId;
12
+ exports.getImageEl = getImageEl;
13
+ exports.getImageId = getImageId;
14
+ exports.getRootEl = getRootEl;
15
+ exports.getRootId = getRootId;
@@ -1,13 +1,7 @@
1
1
  // src/avatar.dom.ts
2
- var getRootId = (ctx) => ctx.ids?.root ?? `avatar:${ctx.id}`;
3
- var getImageId = (ctx) => ctx.ids?.image ?? `avatar:${ctx.id}:image`;
4
- var getFallbackId = (ctx) => ctx.ids?.fallback ?? `avatar:${ctx.id}:fallback`;
5
- var getRootEl = (ctx) => ctx.getById(getRootId(ctx));
6
- var getImageEl = (ctx) => ctx.getById(getImageId(ctx));
7
- export {
8
- getFallbackId,
9
- getImageEl,
10
- getImageId,
11
- getRootEl,
12
- getRootId
13
- };
2
+ const getRootId = (ctx) => ctx.ids?.root ?? `avatar:${ctx.id}`;
3
+ const getImageId = (ctx) => ctx.ids?.image ?? `avatar:${ctx.id}:image`;
4
+ const getFallbackId = (ctx) => ctx.ids?.fallback ?? `avatar:${ctx.id}:fallback`;
5
+ const getRootEl = (ctx) => ctx.getById(getRootId(ctx));
6
+ const getImageEl = (ctx) => ctx.getById(getImageId(ctx));
7
+ export { getFallbackId, getImageEl, getImageId, getRootEl, getRootId };
@@ -1,7 +1,2 @@
1
- import * as _zag_js_core from '@zag-js/core';
2
- import { AvatarSchema } from './avatar.types.mjs';
3
- import '@zag-js/types';
4
-
5
- declare const machine: _zag_js_core.Machine<AvatarSchema>;
6
-
7
- export { machine };
1
+ import { AvatarSchema } from "./avatar.types.mjs";
2
+ export declare const machine: import("@zag-js/core").Machine<AvatarSchema>;
@@ -1,7 +1,2 @@
1
- import * as _zag_js_core from '@zag-js/core';
2
- import { AvatarSchema } from './avatar.types.js';
3
- import '@zag-js/types';
4
-
5
- declare const machine: _zag_js_core.Machine<AvatarSchema>;
6
-
7
- export { machine };
1
+ import { AvatarSchema } from "./avatar.types.js";
2
+ export declare const machine: import("@zag-js/core").Machine<AvatarSchema>;