ui-ingredients 0.0.47 → 0.0.48

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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Headless component library for [Svelte](https://svelte.dev/) powered by [zag](https://zagjs.com/)
4
4
 
5
- > ⚠️ This project is in early development. Feel free to use it, and contributions are welcome. Use with caution!
5
+ > ⚠️ This project is currently in the early stages of development. You're welcome to use it and we encourage contributions. Please use with caution as it is still evolving!
6
6
 
7
7
  ## Installation
8
8
 
@@ -1,18 +1,10 @@
1
- import { getEnvironmentContext } from '../environment-provider/index.js';
2
- import { getLocaleContext } from '../locale-provider/index.js';
3
1
  import { normalizeProps, reflect } from '@zag-js/svelte';
4
2
  import * as toast from '@zag-js/toast';
5
3
  import { uid } from 'uid';
6
4
  export function createToaster(props) {
7
- const locale = getLocaleContext();
8
- const environment = getEnvironmentContext();
9
- const id = uid();
10
- const machine = $derived(toast.group.machine({
11
- ...props,
12
- id: props?.id ?? id,
13
- dir: locale?.dir,
14
- getRootNode: environment?.getRootNode,
15
- }));
5
+ const id_ = uid();
6
+ const id = $derived(props?.id ?? id_);
7
+ const machine = $derived(toast.group.machine({ ...props, id }));
16
8
  return reflect(() => ({
17
9
  machine,
18
10
  ...toast.group.connect(machine, machine.send, normalizeProps),
@@ -10,6 +10,8 @@
10
10
  </script>
11
11
 
12
12
  <script lang="ts">
13
+ import {getEnvironmentContext} from '../environment-provider/context.svelte.js';
14
+ import {getLocaleContext} from '../locale-provider/context.svelte.js';
13
15
  import {mergeProps} from '../merge-props.js';
14
16
  import {Portal} from '../portal/index.js';
15
17
  import {normalizeProps, useMachine} from '@zag-js/svelte';
@@ -18,7 +20,15 @@
18
20
 
19
21
  let {this: e, toaster, children, ...props}: ToasterProps = $props();
20
22
 
21
- let [snapshot, send] = useMachine(toaster.machine);
23
+ const locale = getLocaleContext();
24
+ const environment = getEnvironmentContext();
25
+
26
+ let [snapshot, send] = useMachine(toaster.machine, {
27
+ context: {
28
+ dir: locale?.dir,
29
+ getRootNode: environment?.getRootNode,
30
+ },
31
+ });
22
32
 
23
33
  let placement = $derived(snapshot.context.placement);
24
34
  let api = $derived(toast.group.connect(snapshot, send, normalizeProps));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ui-ingredients",
3
3
  "type": "module",
4
- "version": "0.0.47",
4
+ "version": "0.0.48",
5
5
  "packageManager": "pnpm@9.7.0",
6
6
  "svelte": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -141,7 +141,7 @@
141
141
  "@sveltejs/package": "2.3.5",
142
142
  "@sveltejs/vite-plugin-svelte": "4.0.0-next.6",
143
143
  "@testing-library/jest-dom": "6.5.0",
144
- "@testing-library/svelte": "5.2.0-next.3",
144
+ "@testing-library/svelte": "5.2.1",
145
145
  "@untitled-theme/icons-svelte": "0.10.7",
146
146
  "autoprefixer": "10.4.20",
147
147
  "globals": "15.9.0",