@zag-js/toast 1.41.1 → 1.42.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,6 @@
1
1
  import * as _zag_js_anatomy from '@zag-js/anatomy';
2
2
 
3
- declare const anatomy: _zag_js_anatomy.AnatomyInstance<"group" | "title" | "root" | "description" | "actionTrigger" | "closeTrigger">;
4
- declare const parts: Record<"group" | "title" | "root" | "description" | "actionTrigger" | "closeTrigger", _zag_js_anatomy.AnatomyPart>;
3
+ declare const anatomy: _zag_js_anatomy.AnatomyInstance<"title" | "description" | "group" | "root" | "actionTrigger" | "closeTrigger">;
4
+ declare const parts: Record<"title" | "description" | "group" | "root" | "actionTrigger" | "closeTrigger", _zag_js_anatomy.AnatomyPart>;
5
5
 
6
6
  export { anatomy, parts };
@@ -1,6 +1,6 @@
1
1
  import * as _zag_js_anatomy from '@zag-js/anatomy';
2
2
 
3
- declare const anatomy: _zag_js_anatomy.AnatomyInstance<"group" | "title" | "root" | "description" | "actionTrigger" | "closeTrigger">;
4
- declare const parts: Record<"group" | "title" | "root" | "description" | "actionTrigger" | "closeTrigger", _zag_js_anatomy.AnatomyPart>;
3
+ declare const anatomy: _zag_js_anatomy.AnatomyInstance<"title" | "description" | "group" | "root" | "actionTrigger" | "closeTrigger">;
4
+ declare const parts: Record<"title" | "description" | "group" | "root" | "actionTrigger" | "closeTrigger", _zag_js_anatomy.AnatomyPart>;
5
5
 
6
6
  export { anatomy, parts };
@@ -205,10 +205,7 @@ var machine = (0, import_core.createMachine)({
205
205
  const rootEl = dom.getRootEl(scope);
206
206
  if (!rootEl) return;
207
207
  const syncHeight = () => {
208
- const originalHeight = rootEl.style.height;
209
- rootEl.style.height = "auto";
210
- const height = rootEl.getBoundingClientRect().height;
211
- rootEl.style.height = originalHeight;
208
+ const height = measureLayoutHeight(rootEl);
212
209
  const item = { id: prop("id"), height };
213
210
  setHeight(prop("parent"), item);
214
211
  };
@@ -238,10 +235,7 @@ var machine = (0, import_core.createMachine)({
238
235
  queueMicrotask(() => {
239
236
  const rootEl = dom.getRootEl(scope);
240
237
  if (!rootEl) return;
241
- const originalHeight = rootEl.style.height;
242
- rootEl.style.height = "auto";
243
- const height = rootEl.getBoundingClientRect().height;
244
- rootEl.style.height = originalHeight;
238
+ const height = measureLayoutHeight(rootEl);
245
239
  context.set("initialHeight", height);
246
240
  const item = { id: prop("id"), height };
247
241
  setHeight(prop("parent"), item);
@@ -278,6 +272,13 @@ var machine = (0, import_core.createMachine)({
278
272
  }
279
273
  }
280
274
  });
275
+ function measureLayoutHeight(el) {
276
+ const prevHeight = el.style.height;
277
+ el.style.height = "auto";
278
+ const height = el.offsetHeight;
279
+ el.style.height = prevHeight;
280
+ return height;
281
+ }
281
282
  function setHeight(parent, item) {
282
283
  const { id, height } = item;
283
284
  parent.context.set("heights", (prev) => {
@@ -171,10 +171,7 @@ var machine = createMachine({
171
171
  const rootEl = dom.getRootEl(scope);
172
172
  if (!rootEl) return;
173
173
  const syncHeight = () => {
174
- const originalHeight = rootEl.style.height;
175
- rootEl.style.height = "auto";
176
- const height = rootEl.getBoundingClientRect().height;
177
- rootEl.style.height = originalHeight;
174
+ const height = measureLayoutHeight(rootEl);
178
175
  const item = { id: prop("id"), height };
179
176
  setHeight(prop("parent"), item);
180
177
  };
@@ -204,10 +201,7 @@ var machine = createMachine({
204
201
  queueMicrotask(() => {
205
202
  const rootEl = dom.getRootEl(scope);
206
203
  if (!rootEl) return;
207
- const originalHeight = rootEl.style.height;
208
- rootEl.style.height = "auto";
209
- const height = rootEl.getBoundingClientRect().height;
210
- rootEl.style.height = originalHeight;
204
+ const height = measureLayoutHeight(rootEl);
211
205
  context.set("initialHeight", height);
212
206
  const item = { id: prop("id"), height };
213
207
  setHeight(prop("parent"), item);
@@ -244,6 +238,13 @@ var machine = createMachine({
244
238
  }
245
239
  }
246
240
  });
241
+ function measureLayoutHeight(el) {
242
+ const prevHeight = el.style.height;
243
+ el.style.height = "auto";
244
+ const height = el.offsetHeight;
245
+ el.style.height = prevHeight;
246
+ return height;
247
+ }
247
248
  function setHeight(parent, item) {
248
249
  const { id, height } = item;
249
250
  parent.context.set("heights", (prev) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/toast",
3
- "version": "1.41.1",
3
+ "version": "1.42.0",
4
4
  "description": "Core logic for the toast widget implemented as a state machine",
5
5
  "keywords": [
6
6
  "js",
@@ -14,7 +14,10 @@
14
14
  "author": "Segun Adebayo <sage@adebayosegun.com>",
15
15
  "homepage": "https://github.com/chakra-ui/zag#readme",
16
16
  "license": "MIT",
17
- "repository": "https://github.com/chakra-ui/zag/tree/main/packages/toast",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/chakra-ui/zag/tree/main/packages/toast"
20
+ },
18
21
  "sideEffects": false,
19
22
  "files": [
20
23
  "dist"
@@ -26,12 +29,12 @@
26
29
  "url": "https://github.com/chakra-ui/zag/issues"
27
30
  },
28
31
  "dependencies": {
29
- "@zag-js/anatomy": "1.41.1",
30
- "@zag-js/core": "1.41.1",
31
- "@zag-js/dom-query": "1.41.1",
32
- "@zag-js/dismissable": "1.41.1",
33
- "@zag-js/utils": "1.41.1",
34
- "@zag-js/types": "1.41.1"
32
+ "@zag-js/anatomy": "1.42.0",
33
+ "@zag-js/core": "1.42.0",
34
+ "@zag-js/dom-query": "1.42.0",
35
+ "@zag-js/dismissable": "1.42.0",
36
+ "@zag-js/utils": "1.42.0",
37
+ "@zag-js/types": "1.42.0"
35
38
  },
36
39
  "devDependencies": {
37
40
  "clean-package": "2.2.0"