@zag-js/toast 0.1.9 → 0.1.12

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/index.mjs CHANGED
@@ -1,35 +1,3 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __objRest = (source, exclude) => {
21
- var target = {};
22
- for (var prop in source)
23
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
- target[prop] = source[prop];
25
- if (source != null && __getOwnPropSymbols)
26
- for (var prop of __getOwnPropSymbols(source)) {
27
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
- target[prop] = source[prop];
29
- }
30
- return target;
31
- };
32
-
33
1
  // ../../utilities/dom/dist/index.mjs
34
2
  var dataAttr = (guard) => {
35
3
  return guard ? "" : void 0;
@@ -37,11 +5,40 @@ var dataAttr = (guard) => {
37
5
  var MAX_Z_INDEX = 2147483647;
38
6
  var runIfFn = (v, ...a) => {
39
7
  const res = typeof v === "function" ? v(...a) : v;
40
- return res != null ? res : void 0;
8
+ return res ?? void 0;
41
9
  };
42
10
  var cast = (v) => v;
43
11
  var hasProp = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
44
12
  var isDom = () => typeof window !== "undefined";
13
+ function isDocument(el) {
14
+ return el.nodeType === Node.DOCUMENT_NODE;
15
+ }
16
+ function isWindow(value) {
17
+ return (value == null ? void 0 : value.toString()) === "[object Window]";
18
+ }
19
+ function getDocument(el) {
20
+ if (isWindow(el))
21
+ return el.document;
22
+ if (isDocument(el))
23
+ return el;
24
+ return (el == null ? void 0 : el.ownerDocument) ?? document;
25
+ }
26
+ function defineDomHelpers(helpers) {
27
+ const dom2 = {
28
+ getRootNode: (ctx) => {
29
+ var _a;
30
+ return ((_a = ctx.getRootNode) == null ? void 0 : _a.call(ctx)) ?? document;
31
+ },
32
+ getDoc: (ctx) => getDocument(dom2.getRootNode(ctx)),
33
+ getWin: (ctx) => dom2.getDoc(ctx).defaultView ?? window,
34
+ getActiveElement: (ctx) => dom2.getDoc(ctx).activeElement,
35
+ getById: (ctx, id) => dom2.getRootNode(ctx).getElementById(id)
36
+ };
37
+ return {
38
+ ...dom2,
39
+ ...helpers
40
+ };
41
+ }
45
42
  var isRef = (v) => hasProp(v, "current");
46
43
  function addDomEvent(target, eventName, handler, options) {
47
44
  const node = isRef(target) ? target.current : runIfFn(target);
@@ -61,7 +58,7 @@ function trackDocumentVisibility(_doc, callback) {
61
58
  // ../../utilities/core/dist/index.mjs
62
59
  var runIfFn2 = (v, ...a) => {
63
60
  const res = typeof v === "function" ? v(...a) : v;
64
- return res != null ? res : void 0;
61
+ return res ?? void 0;
65
62
  };
66
63
  var uuid = /* @__PURE__ */ (() => {
67
64
  let id = 0;
@@ -73,7 +70,7 @@ var uuid = /* @__PURE__ */ (() => {
73
70
  function warn(...a) {
74
71
  const m = a.length === 1 ? a[0] : a[1];
75
72
  const c = a.length === 2 ? a[0] : true;
76
- if (c && void 0 !== "production") {
73
+ if (c && process.env.NODE_ENV !== "production") {
77
74
  console.warn(m);
78
75
  }
79
76
  }
@@ -82,20 +79,13 @@ function warn(...a) {
82
79
  import { subscribe } from "@zag-js/core";
83
80
 
84
81
  // src/toast.dom.ts
85
- var dom = {
86
- getDoc: (ctx) => {
87
- var _a;
88
- return (_a = ctx.doc) != null ? _a : document;
89
- },
90
- getRootNode: (ctx) => {
91
- var _a;
92
- return (_a = ctx.rootNode) != null ? _a : dom.getDoc(ctx);
93
- },
82
+ var dom = defineDomHelpers({
94
83
  getGroupId: (placement) => `toast-group:${placement}`,
95
84
  getContainerId: (ctx) => `toast:${ctx.id}`,
96
85
  getTitleId: (ctx) => `toast-title:${ctx.id}`,
86
+ getDescriptionId: (ctx) => `toast-description:${ctx.id}`,
97
87
  getCloseButtonId: (ctx) => `toast-close-button:${ctx.id}`,
98
- getPortalId: (ctx) => `toast-portal:${ctx.uid}`,
88
+ getPortalId: (ctx) => `toast-portal:${ctx.id}`,
99
89
  getPortalEl: (ctx) => dom.getDoc(ctx).getElementById(dom.getPortalId(ctx)),
100
90
  createPortalEl: (ctx) => {
101
91
  const existing = dom.getPortalEl(ctx);
@@ -105,7 +95,7 @@ var dom = {
105
95
  portal.id = dom.getPortalId(ctx);
106
96
  return portal;
107
97
  }
108
- };
98
+ });
109
99
 
110
100
  // src/toast.utils.ts
111
101
  function getToastsByPlacement(toasts) {
@@ -125,7 +115,7 @@ var defaultTimeouts = {
125
115
  custom: 5e3
126
116
  };
127
117
  function getToastDuration(duration, type) {
128
- return duration != null ? duration : defaultTimeouts[type];
118
+ return duration ?? defaultTimeouts[type];
129
119
  }
130
120
  function getGroupPlacementStyle(ctx, placement) {
131
121
  const offset = ctx.offsets;
@@ -184,7 +174,7 @@ function groupConnect(state, send, normalize) {
184
174
  const id = options.id ? options.id : uid;
185
175
  if (group2.isVisible(id))
186
176
  return;
187
- send({ type: "ADD_TOAST", toast: __spreadProps(__spreadValues({}, options), { id }) });
177
+ send({ type: "ADD_TOAST", toast: { ...options, id } });
188
178
  return id;
189
179
  },
190
180
  upsert(options) {
@@ -235,13 +225,13 @@ function groupConnect(state, send, normalize) {
235
225
  return group2.upsert(options);
236
226
  },
237
227
  promise(promise, options, shared = {}) {
238
- const id = group2.loading(__spreadValues(__spreadValues({}, shared), options.loading));
228
+ const id = group2.loading({ ...shared, ...options.loading });
239
229
  promise.then((response) => {
240
230
  const successOptions = runIfFn2(options.success, response);
241
- group2.success(__spreadProps(__spreadValues(__spreadValues({}, shared), successOptions), { id }));
231
+ group2.success({ ...shared, ...successOptions, id });
242
232
  }).catch((error) => {
243
233
  const errorOptions = runIfFn2(options.error, error);
244
- group2.error(__spreadProps(__spreadValues(__spreadValues({}, shared), errorOptions), { id }));
234
+ group2.error({ ...shared, ...errorOptions, id });
245
235
  });
246
236
  return promise;
247
237
  },
@@ -291,184 +281,180 @@ function groupConnect(state, send, normalize) {
291
281
  }
292
282
 
293
283
  // src/toast-group.machine.ts
294
- import { createMachine as createMachine2, ref } from "@zag-js/core";
284
+ import { createMachine as createMachine2 } from "@zag-js/core";
295
285
 
296
286
  // src/toast.machine.ts
297
287
  import { createMachine, guards } from "@zag-js/core";
298
288
  var { not, and, or } = guards;
299
289
  function createToastMachine(options = {}) {
300
- const _a = options, { type = "info", duration, id = "toast", placement = "bottom", removeDelay = 500 } = _a, rest = __objRest(_a, ["type", "duration", "id", "placement", "removeDelay"]);
290
+ const { type = "info", duration, id = "toast", placement = "bottom", removeDelay = 500, ...rest } = options;
301
291
  const __duration = getToastDuration(duration, type);
302
- return createMachine({
303
- id,
304
- entry: "invokeOnOpen",
305
- initial: type === "loading" ? "persist" : "active",
306
- context: __spreadValues({
292
+ return createMachine(
293
+ {
307
294
  id,
308
- type,
309
- remaining: __duration,
310
- duration: __duration,
311
- removeDelay,
312
- createdAt: Date.now(),
313
- placement
314
- }, rest),
315
- on: {
316
- UPDATE: [
317
- {
318
- guard: and("hasTypeChanged", "isChangingToLoading"),
319
- target: "persist",
320
- actions: ["setContext", "invokeOnUpdate"]
321
- },
322
- {
323
- guard: or("hasDurationChanged", "hasTypeChanged"),
324
- target: "active:temp",
325
- actions: ["setContext", "invokeOnUpdate"]
326
- },
327
- {
328
- actions: ["setContext", "invokeOnUpdate"]
329
- }
330
- ]
331
- },
332
- states: {
333
- "active:temp": {
334
- tags: ["visible", "updating"],
335
- after: {
336
- 0: "active"
337
- }
295
+ entry: "invokeOnOpen",
296
+ initial: type === "loading" ? "persist" : "active",
297
+ context: {
298
+ id,
299
+ type,
300
+ remaining: __duration,
301
+ duration: __duration,
302
+ removeDelay,
303
+ createdAt: Date.now(),
304
+ placement,
305
+ ...rest
338
306
  },
339
- persist: {
340
- tags: ["visible", "paused"],
341
- activities: "trackDocumentVisibility",
342
- on: {
343
- RESUME: {
344
- guard: not("isLoadingType"),
345
- target: "active",
346
- actions: ["setCreatedAt"]
307
+ on: {
308
+ UPDATE: [
309
+ {
310
+ guard: and("hasTypeChanged", "isChangingToLoading"),
311
+ target: "persist",
312
+ actions: ["setContext", "invokeOnUpdate"]
347
313
  },
348
- DISMISS: "dismissing"
349
- }
314
+ {
315
+ guard: or("hasDurationChanged", "hasTypeChanged"),
316
+ target: "active:temp",
317
+ actions: ["setContext", "invokeOnUpdate"]
318
+ },
319
+ {
320
+ actions: ["setContext", "invokeOnUpdate"]
321
+ }
322
+ ]
350
323
  },
351
- active: {
352
- tags: ["visible"],
353
- activities: "trackDocumentVisibility",
354
- after: {
355
- VISIBLE_DURATION: "dismissing"
324
+ states: {
325
+ "active:temp": {
326
+ tags: ["visible", "updating"],
327
+ after: {
328
+ 0: "active"
329
+ }
356
330
  },
357
- on: {
358
- DISMISS: "dismissing",
359
- PAUSE: {
360
- target: "persist",
361
- actions: "setRemainingDuration"
331
+ persist: {
332
+ tags: ["visible", "paused"],
333
+ activities: "trackDocumentVisibility",
334
+ on: {
335
+ RESUME: {
336
+ guard: not("isLoadingType"),
337
+ target: "active",
338
+ actions: ["setCreatedAt"]
339
+ },
340
+ DISMISS: "dismissing"
362
341
  }
363
- }
364
- },
365
- dismissing: {
366
- entry: "invokeOnClosing",
367
- after: {
368
- REMOVE_DELAY: {
369
- target: "inactive",
370
- actions: "notifyParentToRemove"
342
+ },
343
+ active: {
344
+ tags: ["visible"],
345
+ activities: "trackDocumentVisibility",
346
+ after: {
347
+ VISIBLE_DURATION: "dismissing"
348
+ },
349
+ on: {
350
+ DISMISS: "dismissing",
351
+ PAUSE: {
352
+ target: "persist",
353
+ actions: "setRemainingDuration"
354
+ }
355
+ }
356
+ },
357
+ dismissing: {
358
+ entry: "invokeOnClosing",
359
+ after: {
360
+ REMOVE_DELAY: {
361
+ target: "inactive",
362
+ actions: "notifyParentToRemove"
363
+ }
371
364
  }
365
+ },
366
+ inactive: {
367
+ entry: "invokeOnClose",
368
+ type: "final"
372
369
  }
373
- },
374
- inactive: {
375
- entry: "invokeOnClose",
376
- type: "final"
377
- }
378
- }
379
- }, {
380
- activities: {
381
- trackDocumentVisibility(ctx, _evt, { send }) {
382
- if (!ctx.pauseOnPageIdle)
383
- return;
384
- return trackDocumentVisibility(dom.getDoc(ctx), function(hidden) {
385
- send(hidden ? "PAUSE" : "RESUME");
386
- });
387
370
  }
388
371
  },
389
- guards: {
390
- isChangingToLoading: (_, evt) => {
391
- var _a2;
392
- return ((_a2 = evt.toast) == null ? void 0 : _a2.type) === "loading";
393
- },
394
- isLoadingType: (ctx) => ctx.type === "loading",
395
- hasTypeChanged: (ctx, evt) => {
396
- var _a2;
397
- return ((_a2 = evt.toast) == null ? void 0 : _a2.type) !== ctx.type;
398
- },
399
- hasDurationChanged: (ctx, evt) => {
400
- var _a2;
401
- return ((_a2 = evt.toast) == null ? void 0 : _a2.duration) !== ctx.duration;
402
- }
403
- },
404
- delays: {
405
- VISIBLE_DURATION: (ctx) => ctx.remaining,
406
- REMOVE_DELAY: (ctx) => ctx.removeDelay
407
- },
408
- actions: {
409
- setRemainingDuration(ctx) {
410
- ctx.remaining -= Date.now() - ctx.createdAt;
411
- },
412
- setCreatedAt(ctx) {
413
- ctx.createdAt = Date.now();
414
- },
415
- notifyParentToRemove(_ctx, _evt, { self }) {
416
- self.sendParent({ type: "REMOVE_TOAST", id: self.id });
417
- },
418
- invokeOnClosing(ctx) {
419
- var _a2;
420
- (_a2 = ctx.onClosing) == null ? void 0 : _a2.call(ctx);
421
- },
422
- invokeOnClose(ctx) {
423
- var _a2;
424
- (_a2 = ctx.onClose) == null ? void 0 : _a2.call(ctx);
372
+ {
373
+ activities: {
374
+ trackDocumentVisibility(ctx, _evt, { send }) {
375
+ if (!ctx.pauseOnPageIdle)
376
+ return;
377
+ return trackDocumentVisibility(dom.getDoc(ctx), function(hidden) {
378
+ send(hidden ? "PAUSE" : "RESUME");
379
+ });
380
+ }
425
381
  },
426
- invokeOnOpen(ctx) {
427
- var _a2;
428
- (_a2 = ctx.onOpen) == null ? void 0 : _a2.call(ctx);
382
+ guards: {
383
+ isChangingToLoading: (_, evt) => {
384
+ var _a;
385
+ return ((_a = evt.toast) == null ? void 0 : _a.type) === "loading";
386
+ },
387
+ isLoadingType: (ctx) => ctx.type === "loading",
388
+ hasTypeChanged: (ctx, evt) => {
389
+ var _a;
390
+ return ((_a = evt.toast) == null ? void 0 : _a.type) !== ctx.type;
391
+ },
392
+ hasDurationChanged: (ctx, evt) => {
393
+ var _a;
394
+ return ((_a = evt.toast) == null ? void 0 : _a.duration) !== ctx.duration;
395
+ }
429
396
  },
430
- invokeOnUpdate(ctx) {
431
- var _a2;
432
- (_a2 = ctx.onUpdate) == null ? void 0 : _a2.call(ctx);
397
+ delays: {
398
+ VISIBLE_DURATION: (ctx) => ctx.remaining,
399
+ REMOVE_DELAY: (ctx) => ctx.removeDelay
433
400
  },
434
- setContext(ctx, evt) {
435
- const { duration: duration2, type: type2 } = evt.toast;
436
- const time = getToastDuration(duration2, type2);
437
- Object.assign(ctx, __spreadProps(__spreadValues({}, evt.toast), { duration: time, remaining: time }));
401
+ actions: {
402
+ setRemainingDuration(ctx) {
403
+ ctx.remaining -= Date.now() - ctx.createdAt;
404
+ },
405
+ setCreatedAt(ctx) {
406
+ ctx.createdAt = Date.now();
407
+ },
408
+ notifyParentToRemove(_ctx, _evt, { self }) {
409
+ self.sendParent({ type: "REMOVE_TOAST", id: self.id });
410
+ },
411
+ invokeOnClosing(ctx) {
412
+ var _a;
413
+ (_a = ctx.onClosing) == null ? void 0 : _a.call(ctx);
414
+ },
415
+ invokeOnClose(ctx) {
416
+ var _a;
417
+ (_a = ctx.onClose) == null ? void 0 : _a.call(ctx);
418
+ },
419
+ invokeOnOpen(ctx) {
420
+ var _a;
421
+ (_a = ctx.onOpen) == null ? void 0 : _a.call(ctx);
422
+ },
423
+ invokeOnUpdate(ctx) {
424
+ var _a;
425
+ (_a = ctx.onUpdate) == null ? void 0 : _a.call(ctx);
426
+ },
427
+ setContext(ctx, evt) {
428
+ const { duration: duration2, type: type2 } = evt.toast;
429
+ const time = getToastDuration(duration2, type2);
430
+ Object.assign(ctx, { ...evt.toast, duration: time, remaining: time });
431
+ }
438
432
  }
439
433
  }
440
- });
434
+ );
441
435
  }
442
436
 
443
437
  // src/toast-group.machine.ts
444
- function groupMachine(ctx = {}) {
438
+ function groupMachine(ctx) {
445
439
  return createMachine2({
446
440
  id: "toaster",
447
441
  initial: "active",
448
- context: __spreadValues({
442
+ context: {
449
443
  dir: "ltr",
450
444
  max: Number.MAX_SAFE_INTEGER,
451
- uid: "",
452
445
  toasts: [],
453
446
  gutter: "1rem",
454
447
  zIndex: MAX_Z_INDEX,
455
448
  pauseOnPageIdle: false,
456
449
  pauseOnInteraction: true,
457
- offsets: { left: "0px", right: "0px", top: "0px", bottom: "0px" }
458
- }, ctx),
450
+ offsets: { left: "0px", right: "0px", top: "0px", bottom: "0px" },
451
+ ...ctx
452
+ },
459
453
  computed: {
460
454
  count: (ctx2) => ctx2.toasts.length
461
455
  },
462
456
  on: {
463
- SETUP: {
464
- actions: (ctx2, evt) => {
465
- ctx2.uid = evt.id;
466
- if (evt.doc)
467
- ctx2.doc = ref(evt.doc);
468
- if (evt.root)
469
- ctx2.rootNode = ref(evt.root);
470
- }
471
- },
457
+ SETUP: {},
472
458
  PAUSE_TOAST: {
473
459
  actions: (_ctx, evt, { self }) => {
474
460
  self.sendChild("PAUSE", evt.id);
@@ -492,13 +478,13 @@ function groupMachine(ctx = {}) {
492
478
  ADD_TOAST: {
493
479
  guard: (ctx2) => ctx2.toasts.length < ctx2.max,
494
480
  actions: (ctx2, evt, { self }) => {
495
- var _a;
496
- const options = __spreadProps(__spreadValues({}, evt.toast), {
481
+ const options = {
482
+ ...evt.toast,
497
483
  pauseOnPageIdle: ctx2.pauseOnPageIdle,
498
484
  pauseOnInteraction: ctx2.pauseOnInteraction,
499
485
  dir: ctx2.dir,
500
- doc: ref((_a = ctx2.doc) != null ? _a : document)
501
- });
486
+ getRootNode: ctx2.getRootNode
487
+ };
502
488
  const toast = createToastMachine(options);
503
489
  const actor = self.spawn(toast);
504
490
  ctx2.toasts.push(actor);
@@ -549,6 +535,7 @@ function connect(state, send, normalize) {
549
535
  return {
550
536
  type: state.context.type,
551
537
  title: state.context.title,
538
+ description: state.context.description,
552
539
  placement,
553
540
  isVisible,
554
541
  isPaused,
@@ -621,6 +608,10 @@ function connect(state, send, normalize) {
621
608
  "data-part": "title",
622
609
  id: dom.getTitleId(state.context)
623
610
  }),
611
+ descriptionProps: normalize.element({
612
+ "data-part": "description",
613
+ id: dom.getDescriptionId(state.context)
614
+ }),
624
615
  closeButtonProps: normalize.button({
625
616
  id: dom.getCloseButtonId(state.context),
626
617
  "data-part": "close-button",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/toast",
3
- "version": "0.1.9",
3
+ "version": "0.1.12",
4
4
  "description": "Core logic for the toast widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -29,18 +29,21 @@
29
29
  "url": "https://github.com/chakra-ui/zag/issues"
30
30
  },
31
31
  "dependencies": {
32
- "@zag-js/core": "0.1.7",
33
- "@zag-js/dom-utils": "0.1.6",
34
- "@zag-js/types": "0.2.1",
35
- "@zag-js/utils": "0.1.2"
32
+ "@zag-js/core": "0.1.9",
33
+ "@zag-js/types": "0.2.3"
34
+ },
35
+ "devDependencies": {
36
+ "@zag-js/dom-utils": "0.1.9",
37
+ "@zag-js/utils": "0.1.3"
36
38
  },
37
39
  "scripts": {
38
- "build:fast": "zag build",
39
- "start": "zag build --watch",
40
- "build": "zag build --prod",
40
+ "build-fast": "tsup src/index.ts --format=esm,cjs",
41
+ "start": "pnpm build --watch",
42
+ "build": "tsup src/index.ts --format=esm,cjs --dts",
41
43
  "test": "jest --config ../../../jest.config.js --rootDir . --passWithNoTests",
42
44
  "lint": "eslint src --ext .ts,.tsx",
43
- "test:ci": "yarn test --ci --runInBand",
44
- "test:watch": "yarn test --watch --updateSnapshot"
45
+ "test-ci": "pnpm test --ci --runInBand",
46
+ "test-watch": "pnpm test --watch -u",
47
+ "typecheck": "tsc --noEmit"
45
48
  }
46
- }
49
+ }
@@ -1,24 +0,0 @@
1
- import type { NormalizeProps, PropTypes } from "@zag-js/types";
2
- import type { GroupMachineContext, GroupProps, GroupSend, GroupState, Placement, PromiseOptions, Toaster, Options } from "./toast.types";
3
- export declare let toaster: Toaster;
4
- export declare function groupConnect<T extends PropTypes>(state: GroupState, send: GroupSend, normalize: NormalizeProps<T>): {
5
- count: number;
6
- toasts: import("./toast.types").Service[];
7
- toastsByPlacement: Partial<Record<Placement, import("./toast.types").Service[]>>;
8
- isVisible(id: string): boolean;
9
- create(options: Options): string;
10
- upsert(options: Options): string;
11
- dismiss(id?: string): void;
12
- remove(id?: string): void;
13
- dismissByPlacement(placement: Placement): void;
14
- update(id: string, options: Options): string;
15
- loading(options: Options): string;
16
- success(options: Options): string;
17
- error(options: Options): string;
18
- promise<T_1>(promise: Promise<T_1>, options: PromiseOptions<T_1>, shared?: Options): Promise<T_1>;
19
- pause(id?: string): void;
20
- resume(id?: string): void;
21
- getGroupProps(options: GroupProps): T["element"];
22
- createPortal(): HTMLElement;
23
- subscribe(fn: (toasts: GroupMachineContext["toasts"]) => void): () => void;
24
- };
@@ -1,2 +0,0 @@
1
- import type { GroupMachineContext, UserDefinedGroupContext } from "./toast.types";
2
- export declare function groupMachine(ctx?: Partial<UserDefinedGroupContext>): import("@zag-js/core").Machine<GroupMachineContext, import("@zag-js/core").StateMachine.StateSchema, import("@zag-js/core").StateMachine.AnyEventObject>;
@@ -1,17 +0,0 @@
1
- import type { NormalizeProps, PropTypes } from "@zag-js/types";
2
- import type { Send, State } from "./toast.types";
3
- export declare function connect<T extends PropTypes>(state: State, send: Send, normalize: NormalizeProps<T>): {
4
- type: import("./toast.types").Type;
5
- title: string;
6
- placement: import("./toast.types").Placement;
7
- isVisible: boolean;
8
- isPaused: boolean;
9
- pause(): void;
10
- resume(): void;
11
- dismiss(): void;
12
- rootProps: T["element"];
13
- progressbarProps: T["element"];
14
- titleProps: T["element"];
15
- closeButtonProps: T["button"];
16
- render(): any;
17
- };
@@ -1,12 +0,0 @@
1
- import type { GroupMachineContext as GroupCtx, MachineContext as Ctx, Placement } from "./toast.types";
2
- export declare const dom: {
3
- getDoc: (ctx: Ctx | GroupCtx) => Document;
4
- getRootNode: (ctx: Ctx | GroupCtx) => Document | ShadowRoot;
5
- getGroupId: (placement: Placement) => string;
6
- getContainerId: (ctx: Ctx) => string;
7
- getTitleId: (ctx: Ctx) => string;
8
- getCloseButtonId: (ctx: Ctx) => string;
9
- getPortalId: (ctx: GroupCtx) => string;
10
- getPortalEl: (ctx: GroupCtx) => HTMLElement;
11
- createPortalEl: (ctx: GroupCtx) => HTMLElement;
12
- };
@@ -1,2 +0,0 @@
1
- import type { MachineContext, MachineState, Options } from "./toast.types";
2
- export declare function createToastMachine(options?: Options): import("@zag-js/core").Machine<MachineContext, MachineState, import("@zag-js/core").StateMachine.AnyEventObject>;