@zag-js/toast 0.2.6 → 0.2.8

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.
@@ -0,0 +1,287 @@
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/toast.machine.ts
21
+ var toast_machine_exports = {};
22
+ __export(toast_machine_exports, {
23
+ createToastMachine: () => createToastMachine
24
+ });
25
+ module.exports = __toCommonJS(toast_machine_exports);
26
+ var import_core = require("@zag-js/core");
27
+
28
+ // ../../utilities/core/src/functions.ts
29
+ var runIfFn = (v, ...a) => {
30
+ const res = typeof v === "function" ? v(...a) : v;
31
+ return res != null ? res : void 0;
32
+ };
33
+ var cast = (v) => v;
34
+
35
+ // ../../utilities/core/src/guard.ts
36
+ var isArray = (v) => Array.isArray(v);
37
+ var isObject = (v) => !(v == null || typeof v !== "object" || isArray(v));
38
+ var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
39
+
40
+ // ../../utilities/core/src/object.ts
41
+ function compact(obj) {
42
+ if (obj === void 0)
43
+ return obj;
44
+ return Object.fromEntries(
45
+ Object.entries(obj).filter(([, value]) => value !== void 0).map(([key, value]) => [key, isObject(value) ? compact(value) : value])
46
+ );
47
+ }
48
+
49
+ // ../../utilities/dom/src/query.ts
50
+ function isDocument(el) {
51
+ return el.nodeType === Node.DOCUMENT_NODE;
52
+ }
53
+ function isWindow(value) {
54
+ return (value == null ? void 0 : value.toString()) === "[object Window]";
55
+ }
56
+ function getDocument(el) {
57
+ var _a;
58
+ if (isWindow(el))
59
+ return el.document;
60
+ if (isDocument(el))
61
+ return el;
62
+ return (_a = el == null ? void 0 : el.ownerDocument) != null ? _a : document;
63
+ }
64
+ function defineDomHelpers(helpers) {
65
+ const dom2 = {
66
+ getRootNode: (ctx) => {
67
+ var _a, _b;
68
+ return (_b = (_a = ctx.getRootNode) == null ? void 0 : _a.call(ctx)) != null ? _b : document;
69
+ },
70
+ getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
71
+ getWin: (ctx) => {
72
+ var _a;
73
+ return (_a = dom2.getDoc(ctx).defaultView) != null ? _a : window;
74
+ },
75
+ getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
76
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
77
+ };
78
+ return {
79
+ ...dom2,
80
+ ...helpers
81
+ };
82
+ }
83
+
84
+ // ../../utilities/dom/src/listener.ts
85
+ var isRef = (v) => hasProp(v, "current");
86
+ function addDomEvent(target, eventName, handler, options) {
87
+ const node = isRef(target) ? target.current : runIfFn(target);
88
+ node == null ? void 0 : node.addEventListener(eventName, handler, options);
89
+ return () => {
90
+ node == null ? void 0 : node.removeEventListener(eventName, handler, options);
91
+ };
92
+ }
93
+
94
+ // ../../utilities/dom/src/visibility-event.ts
95
+ function trackDocumentVisibility(_doc, callback) {
96
+ const doc = cast(_doc);
97
+ return addDomEvent(doc, "visibilitychange", () => {
98
+ const hidden = doc.hidden || doc.msHidden || doc.webkitHidden;
99
+ callback(!!hidden);
100
+ });
101
+ }
102
+
103
+ // src/toast.dom.ts
104
+ var dom = defineDomHelpers({
105
+ getGroupId: (placement) => `toast-group:${placement}`,
106
+ getRootId: (ctx) => `toast:${ctx.id}`,
107
+ getTitleId: (ctx) => `toast:${ctx.id}:title`,
108
+ getDescriptionId: (ctx) => `toast:${ctx.id}:description`,
109
+ getCloseTriggerId: (ctx) => `toast${ctx.id}:close`,
110
+ getPortalId: (ctx) => `toast-portal:${ctx.id}`,
111
+ getPortalEl: (ctx) => dom.getDoc(ctx).getElementById(dom.getPortalId(ctx)),
112
+ createPortalEl: (ctx) => {
113
+ const existing = dom.getPortalEl(ctx);
114
+ if (existing)
115
+ return existing;
116
+ const portal = dom.getDoc(ctx).createElement("toast-portal");
117
+ portal.id = dom.getPortalId(ctx);
118
+ return portal;
119
+ }
120
+ });
121
+
122
+ // src/toast.utils.ts
123
+ var defaultTimeouts = {
124
+ info: 5e3,
125
+ error: 5e3,
126
+ success: 2e3,
127
+ loading: Infinity,
128
+ custom: 5e3
129
+ };
130
+ function getToastDuration(duration, type) {
131
+ return duration != null ? duration : defaultTimeouts[type];
132
+ }
133
+
134
+ // src/toast.machine.ts
135
+ var { not, and, or } = import_core.guards;
136
+ function createToastMachine(options = {}) {
137
+ const { type = "info", duration, id = "toast", placement = "bottom", removeDelay = 0, ...restProps } = options;
138
+ const ctx = compact(restProps);
139
+ const computedDuration = getToastDuration(duration, type);
140
+ return (0, import_core.createMachine)(
141
+ {
142
+ id,
143
+ entry: "invokeOnOpen",
144
+ initial: type === "loading" ? "persist" : "active",
145
+ context: {
146
+ id,
147
+ type,
148
+ remaining: computedDuration,
149
+ duration: computedDuration,
150
+ removeDelay,
151
+ createdAt: Date.now(),
152
+ placement,
153
+ ...ctx
154
+ },
155
+ on: {
156
+ UPDATE: [
157
+ {
158
+ guard: and("hasTypeChanged", "isChangingToLoading"),
159
+ target: "persist",
160
+ actions: ["setContext", "invokeOnUpdate"]
161
+ },
162
+ {
163
+ guard: or("hasDurationChanged", "hasTypeChanged"),
164
+ target: "active:temp",
165
+ actions: ["setContext", "invokeOnUpdate"]
166
+ },
167
+ {
168
+ actions: ["setContext", "invokeOnUpdate"]
169
+ }
170
+ ]
171
+ },
172
+ states: {
173
+ "active:temp": {
174
+ tags: ["visible", "updating"],
175
+ after: {
176
+ 0: "active"
177
+ }
178
+ },
179
+ persist: {
180
+ tags: ["visible", "paused"],
181
+ activities: "trackDocumentVisibility",
182
+ on: {
183
+ RESUME: {
184
+ guard: not("isLoadingType"),
185
+ target: "active",
186
+ actions: ["setCreatedAt"]
187
+ },
188
+ DISMISS: "dismissing"
189
+ }
190
+ },
191
+ active: {
192
+ tags: ["visible"],
193
+ activities: "trackDocumentVisibility",
194
+ after: {
195
+ VISIBLE_DURATION: "dismissing"
196
+ },
197
+ on: {
198
+ DISMISS: "dismissing",
199
+ PAUSE: {
200
+ target: "persist",
201
+ actions: "setRemainingDuration"
202
+ }
203
+ }
204
+ },
205
+ dismissing: {
206
+ entry: "invokeOnClosing",
207
+ after: {
208
+ REMOVE_DELAY: {
209
+ target: "inactive",
210
+ actions: "notifyParentToRemove"
211
+ }
212
+ }
213
+ },
214
+ inactive: {
215
+ entry: "invokeOnClose",
216
+ type: "final"
217
+ }
218
+ }
219
+ },
220
+ {
221
+ activities: {
222
+ trackDocumentVisibility(ctx2, _evt, { send }) {
223
+ if (!ctx2.pauseOnPageIdle)
224
+ return;
225
+ return trackDocumentVisibility(dom.getDoc(ctx2), function(hidden) {
226
+ send(hidden ? "PAUSE" : "RESUME");
227
+ });
228
+ }
229
+ },
230
+ guards: {
231
+ isChangingToLoading: (_, evt) => {
232
+ var _a;
233
+ return ((_a = evt.toast) == null ? void 0 : _a.type) === "loading";
234
+ },
235
+ isLoadingType: (ctx2) => ctx2.type === "loading",
236
+ hasTypeChanged: (ctx2, evt) => {
237
+ var _a;
238
+ return ((_a = evt.toast) == null ? void 0 : _a.type) !== ctx2.type;
239
+ },
240
+ hasDurationChanged: (ctx2, evt) => {
241
+ var _a;
242
+ return ((_a = evt.toast) == null ? void 0 : _a.duration) !== ctx2.duration;
243
+ }
244
+ },
245
+ delays: {
246
+ VISIBLE_DURATION: (ctx2) => ctx2.remaining,
247
+ REMOVE_DELAY: (ctx2) => ctx2.removeDelay
248
+ },
249
+ actions: {
250
+ setRemainingDuration(ctx2) {
251
+ ctx2.remaining -= Date.now() - ctx2.createdAt;
252
+ },
253
+ setCreatedAt(ctx2) {
254
+ ctx2.createdAt = Date.now();
255
+ },
256
+ notifyParentToRemove(_ctx, _evt, { self }) {
257
+ self.sendParent({ type: "REMOVE_TOAST", id: self.id });
258
+ },
259
+ invokeOnClosing(ctx2) {
260
+ var _a;
261
+ (_a = ctx2.onClosing) == null ? void 0 : _a.call(ctx2);
262
+ },
263
+ invokeOnClose(ctx2) {
264
+ var _a;
265
+ (_a = ctx2.onClose) == null ? void 0 : _a.call(ctx2);
266
+ },
267
+ invokeOnOpen(ctx2) {
268
+ var _a;
269
+ (_a = ctx2.onOpen) == null ? void 0 : _a.call(ctx2);
270
+ },
271
+ invokeOnUpdate(ctx2) {
272
+ var _a;
273
+ (_a = ctx2.onUpdate) == null ? void 0 : _a.call(ctx2);
274
+ },
275
+ setContext(ctx2, evt) {
276
+ const { duration: duration2, type: type2 } = evt.toast;
277
+ const time = getToastDuration(duration2, type2);
278
+ Object.assign(ctx2, { ...evt.toast, duration: time, remaining: time });
279
+ }
280
+ }
281
+ }
282
+ );
283
+ }
284
+ // Annotate the CommonJS export names for ESM import in node:
285
+ 0 && (module.exports = {
286
+ createToastMachine
287
+ });
@@ -0,0 +1,9 @@
1
+ import {
2
+ createToastMachine
3
+ } from "./chunk-KJLVUGML.mjs";
4
+ import "./chunk-YVYADWQR.mjs";
5
+ import "./chunk-LOJTIJID.mjs";
6
+ import "./chunk-SMQXX7JA.mjs";
7
+ export {
8
+ createToastMachine
9
+ };
@@ -0,0 +1,150 @@
1
+ import { StateMachine, Machine } from '@zag-js/core';
2
+ import { RootProperties, CommonProperties, Direction, RequiredBy, DirectionProperty, Context } from '@zag-js/types';
3
+
4
+ type Type = "success" | "error" | "loading" | "info" | "custom";
5
+ type Placement = "top-start" | "top" | "top-end" | "bottom-start" | "bottom" | "bottom-end";
6
+ type SharedContext = {
7
+ /**
8
+ * Whether to pause toast when the user leaves the browser tab
9
+ */
10
+ pauseOnPageIdle?: boolean;
11
+ /**
12
+ * Whether to pause the toast when interacted with
13
+ */
14
+ pauseOnInteraction?: boolean;
15
+ };
16
+ type ToastOptions = {
17
+ /**
18
+ * The unique id of the toast
19
+ */
20
+ id: string;
21
+ /**
22
+ * The type of the toast
23
+ */
24
+ type: Type;
25
+ /**
26
+ * The placement of the toast
27
+ */
28
+ placement: Placement;
29
+ /**
30
+ * The message of the toast
31
+ */
32
+ title?: string;
33
+ /**
34
+ * The description of the toast
35
+ */
36
+ description?: string;
37
+ /**
38
+ * The duration the toast will be visible
39
+ */
40
+ duration: number;
41
+ /**
42
+ * Custom function to render the toast element.
43
+ */
44
+ render?: (options: RenderOptions) => any;
45
+ /**
46
+ * The duration for the toast to kept alive before it is removed.
47
+ * Useful for exit transitions.
48
+ */
49
+ removeDelay?: number;
50
+ /**
51
+ * Function called when the toast has been closed and removed
52
+ */
53
+ onClose?: VoidFunction;
54
+ /**
55
+ * Function called when the toast is leaving
56
+ */
57
+ onClosing?: VoidFunction;
58
+ /**
59
+ * Function called when the toast is shown
60
+ */
61
+ onOpen?: VoidFunction;
62
+ /**
63
+ * Function called when the toast is updated
64
+ */
65
+ onUpdate?: VoidFunction;
66
+ };
67
+ type Options = Partial<ToastOptions>;
68
+ type RenderOptions = Omit<ToastOptions, "render"> & {
69
+ dismiss(): void;
70
+ };
71
+ type MachineContext = SharedContext & RootProperties & CommonProperties & Omit<ToastOptions, "removeDelay"> & {
72
+ /**
73
+ * The duration for the toast to kept alive before it is removed.
74
+ * Useful for exit transitions.
75
+ */
76
+ removeDelay: number;
77
+ /**
78
+ * The document's text/writing direction.
79
+ */
80
+ dir?: Direction;
81
+ /**
82
+ * The time the toast was created
83
+ */
84
+ createdAt: number;
85
+ /**
86
+ * The time left before the toast is removed
87
+ */
88
+ remaining: number;
89
+ };
90
+ type MachineState = {
91
+ value: "active" | "active:temp" | "dismissing" | "inactive" | "persist";
92
+ tags: "visible" | "paused" | "updating";
93
+ };
94
+ type State = StateMachine.State<MachineContext, MachineState>;
95
+ type Send = StateMachine.Send;
96
+ type Service = Machine<MachineContext, MachineState>;
97
+ type GroupPublicContext = SharedContext & DirectionProperty & CommonProperties & {
98
+ /**
99
+ * The gutter or spacing between toasts
100
+ */
101
+ gutter: string;
102
+ /**
103
+ * The z-index applied to each toast group
104
+ */
105
+ zIndex: number;
106
+ /**
107
+ * The maximum number of toasts that can be shown at once
108
+ */
109
+ max: number;
110
+ /**
111
+ * The offset from the safe environment edge of the viewport
112
+ */
113
+ offsets: string | Record<"left" | "right" | "bottom" | "top", string>;
114
+ };
115
+ type UserDefinedGroupContext = RequiredBy<GroupPublicContext, "id">;
116
+ type GroupComputedContext = Readonly<{
117
+ /**
118
+ * @computed
119
+ * The total number of toasts in the group
120
+ */
121
+ readonly count: number;
122
+ }>;
123
+ type GroupPrivateContext = Context<{}>;
124
+ type GroupMachineContext = GroupPublicContext & GroupComputedContext & GroupPrivateContext;
125
+ type GroupState = StateMachine.State<GroupMachineContext>;
126
+ type GroupSend = (event: StateMachine.Event<StateMachine.AnyEventObject>) => void;
127
+ type MaybeFunction<Value, Args> = Value | ((arg: Args) => Value);
128
+ type PromiseOptions<Value> = {
129
+ loading: ToastOptions;
130
+ success: MaybeFunction<ToastOptions, Value>;
131
+ error: MaybeFunction<ToastOptions, Error>;
132
+ };
133
+ type GroupProps = {
134
+ placement: Placement;
135
+ label?: string;
136
+ };
137
+ type Toaster = {
138
+ count: number;
139
+ isVisible(id: string): boolean;
140
+ upsert(options: ToastOptions): string | undefined;
141
+ create(options: ToastOptions): string | undefined;
142
+ success(options: ToastOptions): string | undefined;
143
+ error(options: ToastOptions): string | undefined;
144
+ loading(options: ToastOptions): string | undefined;
145
+ dismiss(id?: string | undefined): void;
146
+ remove(id?: string | undefined): void;
147
+ promise<T>(promise: Promise<T>, options: PromiseOptions<T>, shared?: ToastOptions): Promise<T>;
148
+ };
149
+
150
+ export { GroupMachineContext, GroupProps, GroupSend, GroupState, MachineContext, MachineState, Options, Placement, PromiseOptions, RenderOptions, Send, Service, State, ToastOptions, Toaster, Type, UserDefinedGroupContext };
@@ -0,0 +1,18 @@
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/toast.types.ts
17
+ var toast_types_exports = {};
18
+ module.exports = __toCommonJS(toast_types_exports);
File without changes
@@ -0,0 +1,10 @@
1
+ import { Style } from '@zag-js/types';
2
+ import { Service, Placement, Type, MachineContext, GroupMachineContext } from './toast.types.js';
3
+ import '@zag-js/core';
4
+
5
+ declare function getToastsByPlacement(toasts: Service[]): Partial<Record<Placement, Service[]>>;
6
+ declare const defaultTimeouts: Record<Type, number>;
7
+ declare function getToastDuration(duration: number | undefined, type: MachineContext["type"]): number;
8
+ declare function getGroupPlacementStyle(ctx: GroupMachineContext, placement: Placement): Style;
9
+
10
+ export { defaultTimeouts, getGroupPlacementStyle, getToastDuration, getToastsByPlacement };
@@ -0,0 +1,93 @@
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/toast.utils.ts
21
+ var toast_utils_exports = {};
22
+ __export(toast_utils_exports, {
23
+ defaultTimeouts: () => defaultTimeouts,
24
+ getGroupPlacementStyle: () => getGroupPlacementStyle,
25
+ getToastDuration: () => getToastDuration,
26
+ getToastsByPlacement: () => getToastsByPlacement
27
+ });
28
+ module.exports = __toCommonJS(toast_utils_exports);
29
+ function getToastsByPlacement(toasts) {
30
+ const result = {};
31
+ for (const toast of toasts) {
32
+ const placement = toast.state.context.placement;
33
+ result[placement] || (result[placement] = []);
34
+ result[placement].push(toast);
35
+ }
36
+ return result;
37
+ }
38
+ var defaultTimeouts = {
39
+ info: 5e3,
40
+ error: 5e3,
41
+ success: 2e3,
42
+ loading: Infinity,
43
+ custom: 5e3
44
+ };
45
+ function getToastDuration(duration, type) {
46
+ return duration != null ? duration : defaultTimeouts[type];
47
+ }
48
+ function getGroupPlacementStyle(ctx, placement) {
49
+ const offset = ctx.offsets;
50
+ const __offset = typeof offset === "string" ? { left: offset, right: offset, bottom: offset, top: offset } : offset;
51
+ const rtl = ctx.dir === "rtl";
52
+ const __placement = placement.replace("-start", rtl ? "-right" : "-left").replace("-end", rtl ? "-left" : "-right");
53
+ const isRighty = __placement.includes("right");
54
+ const isLefty = __placement.includes("left");
55
+ const styles = {
56
+ position: "fixed",
57
+ pointerEvents: ctx.count > 0 ? void 0 : "none",
58
+ display: "flex",
59
+ flexDirection: "column",
60
+ "--toast-gutter": ctx.gutter,
61
+ zIndex: ctx.zIndex
62
+ };
63
+ let alignItems = "center";
64
+ if (isRighty)
65
+ alignItems = "flex-end";
66
+ if (isLefty)
67
+ alignItems = "flex-start";
68
+ styles.alignItems = alignItems;
69
+ if (__placement.includes("top")) {
70
+ const offset2 = __offset.top;
71
+ styles.top = `calc(env(safe-area-inset-top, 0px) + ${offset2})`;
72
+ }
73
+ if (__placement.includes("bottom")) {
74
+ const offset2 = __offset.bottom;
75
+ styles.bottom = `calc(env(safe-area-inset-bottom, 0px) + ${offset2})`;
76
+ }
77
+ if (!__placement.includes("left")) {
78
+ const offset2 = __offset.right;
79
+ styles.right = `calc(env(safe-area-inset-right, 0px) + ${offset2})`;
80
+ }
81
+ if (!__placement.includes("right")) {
82
+ const offset2 = __offset.left;
83
+ styles.left = `calc(env(safe-area-inset-left, 0px) + ${offset2})`;
84
+ }
85
+ return styles;
86
+ }
87
+ // Annotate the CommonJS export names for ESM import in node:
88
+ 0 && (module.exports = {
89
+ defaultTimeouts,
90
+ getGroupPlacementStyle,
91
+ getToastDuration,
92
+ getToastsByPlacement
93
+ });
@@ -0,0 +1,12 @@
1
+ import {
2
+ defaultTimeouts,
3
+ getGroupPlacementStyle,
4
+ getToastDuration,
5
+ getToastsByPlacement
6
+ } from "./chunk-LOJTIJID.mjs";
7
+ export {
8
+ defaultTimeouts,
9
+ getGroupPlacementStyle,
10
+ getToastDuration,
11
+ getToastsByPlacement
12
+ };
package/package.json CHANGED
@@ -1,10 +1,7 @@
1
1
  {
2
2
  "name": "@zag-js/toast",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "description": "Core logic for the toast widget implemented as a state machine",
5
- "main": "dist/index.js",
6
- "module": "dist/index.mjs",
7
- "types": "dist/index.d.ts",
8
5
  "keywords": [
9
6
  "js",
10
7
  "machine",
@@ -29,18 +26,31 @@
29
26
  "url": "https://github.com/chakra-ui/zag/issues"
30
27
  },
31
28
  "dependencies": {
32
- "@zag-js/core": "0.2.3",
33
- "@zag-js/types": "0.3.1",
34
- "@zag-js/anatomy": "0.1.2"
29
+ "@zag-js/anatomy": "0.1.3",
30
+ "@zag-js/core": "0.2.5",
31
+ "@zag-js/types": "0.3.3"
35
32
  },
36
33
  "devDependencies": {
37
- "@zag-js/dom-utils": "0.2.1",
38
- "@zag-js/utils": "0.3.1"
34
+ "clean-package": "2.2.0",
35
+ "@zag-js/dom-utils": "0.2.3",
36
+ "@zag-js/utils": "0.3.2"
37
+ },
38
+ "clean-package": "../../../clean-package.config.json",
39
+ "main": "dist/index.js",
40
+ "module": "dist/index.mjs",
41
+ "types": "dist/index.d.ts",
42
+ "exports": {
43
+ ".": {
44
+ "types": "./dist/index.d.ts",
45
+ "import": "./dist/index.mjs",
46
+ "require": "./dist/index.js"
47
+ },
48
+ "./package.json": "./package.json"
39
49
  },
40
50
  "scripts": {
41
- "build-fast": "tsup src/index.ts --format=esm,cjs",
51
+ "build-fast": "tsup src",
42
52
  "start": "pnpm build --watch",
43
- "build": "tsup src/index.ts --format=esm,cjs --dts",
53
+ "build": "tsup src --dts",
44
54
  "test": "jest --config ../../../jest.config.js --rootDir . --passWithNoTests",
45
55
  "lint": "eslint src --ext .ts,.tsx",
46
56
  "test-ci": "pnpm test --ci --runInBand",