diff --git a/.changeset/cyan-parrots-grin.md b/.changeset/cyan-parrots-grin.md new file mode 100644 index 0000000000..ca2674ac68 --- /dev/null +++ b/.changeset/cyan-parrots-grin.md @@ -0,0 +1,10 @@ +--- +"@zag-js/checkbox": minor +--- + +Rename `api` properties + +- `isChecked` to `checked` +- `isDisabled` to `disabled` +- `isIndeterminate` to `indeterminate` +- `isFocused` to `focused` diff --git a/.changeset/friendly-rings-impress.md b/.changeset/friendly-rings-impress.md new file mode 100644 index 0000000000..38784828c0 --- /dev/null +++ b/.changeset/friendly-rings-impress.md @@ -0,0 +1,6 @@ +--- +"@zag-js/avatar": minor +--- + +- Rename `api.isLoaded` to `api.loaded` +- Remove `api.showFallback` since it's equivalent to `!api.loaded` diff --git a/.changeset/gold-pigs-smash.md b/.changeset/gold-pigs-smash.md new file mode 100644 index 0000000000..6b0ca3cccb --- /dev/null +++ b/.changeset/gold-pigs-smash.md @@ -0,0 +1,7 @@ +--- +"@zag-js/radio-group": minor +"@zag-js/checkbox": minor +"@zag-js/switch": minor +--- + +Add support for `readOnly` prop diff --git a/.changeset/large-weeks-shout.md b/.changeset/large-weeks-shout.md new file mode 100644 index 0000000000..1d6bee5450 --- /dev/null +++ b/.changeset/large-weeks-shout.md @@ -0,0 +1,8 @@ +--- +"@zag-js/editable": minor +--- + +Rename `api` properties + +- `isEditing` -> `editing` +- `isValueEmpty` -> `empty` diff --git a/.changeset/plenty-cherries-lay.md b/.changeset/plenty-cherries-lay.md new file mode 100644 index 0000000000..c7c262201c --- /dev/null +++ b/.changeset/plenty-cherries-lay.md @@ -0,0 +1,13 @@ +--- +"@zag-js/tree-view": minor +--- + +- Rename `api.getItemState` properties + + - `isDisabled` -> `disabled` + - `isFocused` -> `focused` + - `isSelected` -> `selected` + +- Rename `api.getBranchState` properties + + - `isExpanded` -> `expanded` diff --git a/.changeset/polite-vans-nail.md b/.changeset/polite-vans-nail.md new file mode 100644 index 0000000000..62fbb45405 --- /dev/null +++ b/.changeset/polite-vans-nail.md @@ -0,0 +1,10 @@ +--- +"@zag-js/combobox": minor +--- + +Rename `api` properties + +- `isFocused` -> `focused` +- `isOpen` -> `open` +- `isInputValueEmpty` -> `inputEmpty` +- `open()`, `close()` -> `setOpen(true|false)` diff --git a/.changeset/quick-flowers-sparkle.md b/.changeset/quick-flowers-sparkle.md new file mode 100644 index 0000000000..90dd3a247e --- /dev/null +++ b/.changeset/quick-flowers-sparkle.md @@ -0,0 +1,8 @@ +--- +"@zag-js/signature-pad": minor +--- + +Rename `api` properties + +- `isDrawing` -> `drawing` +- `isEmpty` -> `empty` diff --git a/.changeset/real-icons-study.md b/.changeset/real-icons-study.md new file mode 100644 index 0000000000..4d40cc0f28 --- /dev/null +++ b/.changeset/real-icons-study.md @@ -0,0 +1,10 @@ +--- +"@zag-js/collapsible": minor +--- + +Rename `api` properties + +- `isVisible` -> `visible` +- `isDisabled` -> `disabled` +- `isOpen` -> `open` +- `open`, `close` -> `setOpen(true|false)` diff --git a/.changeset/sour-boxes-march.md b/.changeset/sour-boxes-march.md new file mode 100644 index 0000000000..156a0b7ff6 --- /dev/null +++ b/.changeset/sour-boxes-march.md @@ -0,0 +1,9 @@ +--- +"@zag-js/file-upload": minor +--- + +Rename `api` properties + +- `isDragging` -> `dragging` +- `isFocused` -> `focused` +- `open()` -> `openFilePicker()` diff --git a/.changeset/swift-hornets-hug.md b/.changeset/swift-hornets-hug.md new file mode 100644 index 0000000000..db776ab2e9 --- /dev/null +++ b/.changeset/swift-hornets-hug.md @@ -0,0 +1,12 @@ +--- +"@zag-js/carousel": minor +--- + +- Rename `api.getItemState` properties + + - `isCurrent` to `current` + - `isNext` to `next` + - `isPrevious` to `previous` + - `isInView` to `inView` + +- Rename `api.isAutoPlay` to `api.autoPlaying` diff --git a/.changeset/swift-years-do.md b/.changeset/swift-years-do.md new file mode 100644 index 0000000000..b9cf3b7e8a --- /dev/null +++ b/.changeset/swift-years-do.md @@ -0,0 +1,9 @@ +--- +"@zag-js/color-picker": minor +--- + +Rename `api` properties + +- `isDragging` -> `dragging` +- `isOpen` -> `open` +- `open()`, `close()` -> `setOpen(true|false)` diff --git a/.changeset/three-planes-mix.md b/.changeset/three-planes-mix.md new file mode 100644 index 0000000000..b417e631fe --- /dev/null +++ b/.changeset/three-planes-mix.md @@ -0,0 +1,5 @@ +--- +"@zag-js/clipboard": minor +--- + +Rename `api.isCopied` to `api.copied` diff --git a/.changeset/unlucky-pumpkins-impress.md b/.changeset/unlucky-pumpkins-impress.md new file mode 100644 index 0000000000..36643677f3 --- /dev/null +++ b/.changeset/unlucky-pumpkins-impress.md @@ -0,0 +1,9 @@ +--- +"@zag-js/tabs": minor +--- + +Rename `api.getTriggerState` properties + +- `isSelected` -> `selected` +- `isDisabled` -> `disabled` +- `isFocused` -> `focused` diff --git a/.changeset/witty-tomatoes-roll.md b/.changeset/witty-tomatoes-roll.md new file mode 100644 index 0000000000..15735e1686 --- /dev/null +++ b/.changeset/witty-tomatoes-roll.md @@ -0,0 +1,8 @@ +--- +"@zag-js/accordion": minor +--- + +- Rename `getItemState` properties + - `isOpen` -> `expanded` + - `isDisabled` -> `disabled` + - `isFocused` -> `focused` diff --git a/.xstate/toggle-group.js b/.xstate/toggle-group.js index 74fae65531..52b2b1b8cb 100644 --- a/.xstate/toggle-group.js +++ b/.xstate/toggle-group.js @@ -15,7 +15,7 @@ const fetchMachine = createMachine({ context: { "!(isClickFocus && isTabbingBackward)": false }, - entry: ["checkFocusableToggles", "checkIfWithinToolbar"], + entry: ["checkIfWithinToolbar"], on: { "VALUE.SET": { actions: ["setValue"] diff --git a/examples/next-ts/components/dialog.tsx b/examples/next-ts/components/dialog.tsx index 2f901d4d3b..7737ff8642 100644 --- a/examples/next-ts/components/dialog.tsx +++ b/examples/next-ts/components/dialog.tsx @@ -28,7 +28,7 @@ export function Dialog(props: Props) { return ( <> - {api.isOpen && ( + {api.open && (
diff --git a/examples/next-ts/package.json b/examples/next-ts/package.json index 5e8a1d5856..a8884cd3e1 100644 --- a/examples/next-ts/package.json +++ b/examples/next-ts/package.json @@ -80,7 +80,6 @@ "@zag-js/tree-view": "workspace:*", "@zag-js/types": "workspace:*", "@zag-js/utils": "workspace:*", - "@zag-js/visually-hidden": "workspace:*", "form-serialize": "0.7.2", "lucide-react": "0.372.0", "match-sorter": "6.3.4", diff --git a/examples/next-ts/pages/checkbox.tsx b/examples/next-ts/pages/checkbox.tsx index 98a3ebcc2c..b3ab9f27bc 100644 --- a/examples/next-ts/pages/checkbox.tsx +++ b/examples/next-ts/pages/checkbox.tsx @@ -34,15 +34,15 @@ export default function Page() {
diff --git a/examples/nuxt-ts/pages/clipboard.vue b/examples/nuxt-ts/pages/clipboard.vue index 8a68784370..d84b3a2a02 100644 --- a/examples/nuxt-ts/pages/clipboard.vue +++ b/examples/nuxt-ts/pages/clipboard.vue @@ -26,7 +26,7 @@ const api = computed(() => clipboard.connect(state.value, send, normalizeProps))
diff --git a/examples/nuxt-ts/pages/editable.vue b/examples/nuxt-ts/pages/editable.vue index 3fca9482d5..b6824225a5 100644 --- a/examples/nuxt-ts/pages/editable.vue +++ b/examples/nuxt-ts/pages/editable.vue @@ -20,9 +20,9 @@ const api = computed(() => editable.connect(state.value, send, normalizeProps))
- + - + diff --git a/examples/nuxt-ts/pages/hover-card.vue b/examples/nuxt-ts/pages/hover-card.vue index 03870049a8..d51305275a 100644 --- a/examples/nuxt-ts/pages/hover-card.vue +++ b/examples/nuxt-ts/pages/hover-card.vue @@ -17,7 +17,7 @@ const api = computed(() => hoverCard.connect(state.value, send, normalizeProps))
Twitter - +
diff --git a/examples/nuxt-ts/pages/rating-group.vue b/examples/nuxt-ts/pages/rating-group.vue index cd46775e18..e4d3e8a90b 100644 --- a/examples/nuxt-ts/pages/rating-group.vue +++ b/examples/nuxt-ts/pages/rating-group.vue @@ -27,7 +27,7 @@ const items = computed(() =>
- +
diff --git a/examples/nuxt-ts/pages/switch.vue b/examples/nuxt-ts/pages/switch.vue index 14c1c33423..a81ca014ac 100644 --- a/examples/nuxt-ts/pages/switch.vue +++ b/examples/nuxt-ts/pages/switch.vue @@ -23,7 +23,7 @@ const api = computed(() => zagSwitch.connect(state.value, send, normalizeProps)) - Feature is {{ api.isChecked ? "enabled" : "disabled" }} + Feature is {{ api.checked ? "enabled" : "disabled" }} diff --git a/examples/nuxt-ts/pages/tooltip.vue b/examples/nuxt-ts/pages/tooltip.vue index 1d4ac7d911..d11ce05f63 100644 --- a/examples/nuxt-ts/pages/tooltip.vue +++ b/examples/nuxt-ts/pages/tooltip.vue @@ -20,7 +20,7 @@ const api = computed(() => tooltip.connect(state.value, send, normalizeProps))
{{ state.value }}
-
+
Tooltip with alot of text probably
diff --git a/examples/preact-ts/package.json b/examples/preact-ts/package.json index 74ee7e4067..c58058d4dc 100644 --- a/examples/preact-ts/package.json +++ b/examples/preact-ts/package.json @@ -77,7 +77,6 @@ "@zag-js/tree-view": "workspace:*", "@zag-js/types": "workspace:*", "@zag-js/utils": "workspace:*", - "@zag-js/visually-hidden": "workspace:*", "match-sorter": "6.3.4", "lucide-preact": "0.372.0", "preact": "10.20.2", diff --git a/examples/solid-ts/package.json b/examples/solid-ts/package.json index e20b5f446d..b8dec359e9 100644 --- a/examples/solid-ts/package.json +++ b/examples/solid-ts/package.json @@ -87,7 +87,6 @@ "@zag-js/tree-view": "workspace:*", "@zag-js/types": "workspace:*", "@zag-js/utils": "workspace:*", - "@zag-js/visually-hidden": "workspace:*", "form-serialize": "0.7.2", "match-sorter": "6.3.4", "lucide-solid": "0.372.0", diff --git a/examples/solid-ts/src/pages/checkbox.tsx b/examples/solid-ts/src/pages/checkbox.tsx index 89e205fac4..52b1a539d9 100644 --- a/examples/solid-ts/src/pages/checkbox.tsx +++ b/examples/solid-ts/src/pages/checkbox.tsx @@ -35,17 +35,17 @@ export default function Page() {
- - diff --git a/examples/solid-ts/src/pages/clipboard.tsx b/examples/solid-ts/src/pages/clipboard.tsx index 6279f4080e..7f46fc1766 100644 --- a/examples/solid-ts/src/pages/clipboard.tsx +++ b/examples/solid-ts/src/pages/clipboard.tsx @@ -30,7 +30,7 @@ export default function Page() {
diff --git a/examples/solid-ts/src/pages/collapsible.tsx b/examples/solid-ts/src/pages/collapsible.tsx index cd26e4a204..a6b8adf341 100644 --- a/examples/solid-ts/src/pages/collapsible.tsx +++ b/examples/solid-ts/src/pages/collapsible.tsx @@ -33,8 +33,8 @@ export default function Page() {
Toggle Controls
- - + +
diff --git a/examples/solid-ts/src/pages/date-picker.tsx b/examples/solid-ts/src/pages/date-picker.tsx index 6bb25adf4d..0dc42a186a 100644 --- a/examples/solid-ts/src/pages/date-picker.tsx +++ b/examples/solid-ts/src/pages/date-picker.tsx @@ -36,7 +36,7 @@ export default function Page() {
- +
diff --git a/examples/solid-ts/src/pages/dialog.tsx b/examples/solid-ts/src/pages/dialog.tsx index f8ccc9ff2a..486053199e 100644 --- a/examples/solid-ts/src/pages/dialog.tsx +++ b/examples/solid-ts/src/pages/dialog.tsx @@ -25,7 +25,7 @@ export default function Page() {
- +
@@ -43,7 +43,7 @@ export default function Page() { - +
@@ -52,7 +52,7 @@ export default function Page() { -
diff --git a/examples/solid-ts/src/pages/editable.tsx b/examples/solid-ts/src/pages/editable.tsx index d30b5ed4b6..7418ede7f6 100644 --- a/examples/solid-ts/src/pages/editable.tsx +++ b/examples/solid-ts/src/pages/editable.tsx @@ -28,12 +28,12 @@ export default function Page() {
- + - + <> + {(page, i) => { @@ -78,9 +75,7 @@ export default function Page() { }}
  • - +
  • diff --git a/examples/solid-ts/src/pages/presence.tsx b/examples/solid-ts/src/pages/presence.tsx index 7223fa53c9..77083b20f3 100644 --- a/examples/solid-ts/src/pages/presence.tsx +++ b/examples/solid-ts/src/pages/presence.tsx @@ -16,7 +16,7 @@ export default function Page() { return (
    - +
    { api().setNode(node) diff --git a/examples/solid-ts/src/pages/rating-group.tsx b/examples/solid-ts/src/pages/rating-group.tsx index 5f7ab5029c..e3646662a5 100644 --- a/examples/solid-ts/src/pages/rating-group.tsx +++ b/examples/solid-ts/src/pages/rating-group.tsx @@ -62,7 +62,7 @@ export default function Page() { {(index) => { const state = createMemo(() => api().getItemState({ index: index() })) return ( - {state().isHalf ? : } + {state().half ? : } ) }} diff --git a/examples/solid-ts/src/pages/switch.tsx b/examples/solid-ts/src/pages/switch.tsx index f6310021c9..7891ac5367 100644 --- a/examples/solid-ts/src/pages/switch.tsx +++ b/examples/solid-ts/src/pages/switch.tsx @@ -29,7 +29,7 @@ export default function Page() { - Feature is {api().isChecked ? "enabled" : "disabled"} + Feature is {api().checked ? "enabled" : "disabled"}
    diff --git a/examples/solid-ts/src/pages/toast.tsx b/examples/solid-ts/src/pages/toast.tsx index 35ab01dfe1..784cacd03f 100644 --- a/examples/solid-ts/src/pages/toast.tsx +++ b/examples/solid-ts/src/pages/toast.tsx @@ -12,23 +12,10 @@ function ToastItem(props: { actor: toast.Service }) { const [state, send] = useActor(props.actor) const api = createMemo(() => toast.connect(state, send, normalizeProps)) - const progressbarProps = createMemo(() => ({ - "data-scope": "toast", - "data-part": "progressbar", - "data-type": state.context.type, - style: { - opacity: api().isVisible ? 1 : 0, - "transform-origin": api().isRtl ? "right" : "left", - "animation-name": api().type === "loading" ? "none" : undefined, - "animation-play-state": api().isPaused ? "paused" : "running", - "animation-duration": `${state.context.duration}ms`, - }, - })) - return (
    -
    +

    {api().type === "loading" && } {api().title} diff --git a/examples/solid-ts/src/pages/tooltip.tsx b/examples/solid-ts/src/pages/tooltip.tsx index cf003e2a6c..2d1c53080e 100644 --- a/examples/solid-ts/src/pages/tooltip.tsx +++ b/examples/solid-ts/src/pages/tooltip.tsx @@ -20,7 +20,7 @@ export default function Page() { Hover me - +

    @@ -34,7 +34,7 @@ export default function Page() { Over me - +
    diff --git a/examples/svelte-ts/package.json b/examples/svelte-ts/package.json index 9dc0c8c1af..9c8874415d 100644 --- a/examples/svelte-ts/package.json +++ b/examples/svelte-ts/package.json @@ -79,7 +79,6 @@ "@zag-js/tree-view": "workspace:*", "@zag-js/types": "workspace:*", "@zag-js/utils": "workspace:*", - "@zag-js/visually-hidden": "workspace:*", "form-serialize": "0.7.2", "match-sorter": "6.3.4", "lucide-svelte": "0.372.0", diff --git a/examples/svelte-ts/src/lib/components/toast-item.svelte b/examples/svelte-ts/src/lib/components/toast-item.svelte index 4defff7ff5..a3a23cd578 100644 --- a/examples/svelte-ts/src/lib/components/toast-item.svelte +++ b/examples/svelte-ts/src/lib/components/toast-item.svelte @@ -1,6 +1,7 @@ -
    -    
    -

    {api.title}

    -

    {api.description}

    - -
    +
    +
    +

    {api.title}

    +

    {api.description}

    + +
    diff --git a/examples/svelte-ts/src/routes/accordion.svelte b/examples/svelte-ts/src/routes/accordion.svelte index 1ad9cf8e5f..155564898b 100644 --- a/examples/svelte-ts/src/routes/accordion.svelte +++ b/examples/svelte-ts/src/routes/accordion.svelte @@ -9,11 +9,11 @@ const controls = useControls(accordionControls) - const [_state, send] = useMachine(accordion.machine({ id: "1" }), { + const [snapshot, send] = useMachine(accordion.machine({ id: "1" }), { context: controls.context, }) - const api = $derived(accordion.connect(_state, send, normalizeProps)) + const api = $derived(accordion.connect(snapshot, send, normalizeProps))
    @@ -38,5 +38,5 @@
    - + diff --git a/examples/svelte-ts/src/routes/avatar.svelte b/examples/svelte-ts/src/routes/avatar.svelte index 85f47bb29b..7f8e9d00e0 100644 --- a/examples/svelte-ts/src/routes/avatar.svelte +++ b/examples/svelte-ts/src/routes/avatar.svelte @@ -11,8 +11,8 @@ let src = $state(images[0]) let showImage = $state(true) - const [_state, send] = useMachine(avatar.machine({ id: "1" })) - const api = $derived(avatar.connect(_state, send, normalizeProps)) + const [snapshot, send] = useMachine(avatar.machine({ id: "1" })) + const api = $derived(avatar.connect(snapshot, send, normalizeProps))
    @@ -31,5 +31,5 @@
    - + diff --git a/examples/svelte-ts/src/routes/carousel.svelte b/examples/svelte-ts/src/routes/carousel.svelte index 56d238d2f1..cf168d6005 100644 --- a/examples/svelte-ts/src/routes/carousel.svelte +++ b/examples/svelte-ts/src/routes/carousel.svelte @@ -8,11 +8,11 @@ const controls = useControls(carouselControls) - const [_state, send] = useMachine(carousel.machine({ id: "1", index: 0, spacing: "20px", slidesPerView: 2 }), { + const [snapshot, send] = useMachine(carousel.machine({ id: "1", index: 0, spacing: "20px", slidesPerView: 2 }), { // context: controls.context, }) - const api = $derived(carousel.connect(_state, send, normalizeProps)) + const api = $derived(carousel.connect(snapshot, send, normalizeProps))
    @@ -32,5 +32,5 @@
    - + diff --git a/examples/svelte-ts/src/routes/checkbox.svelte b/examples/svelte-ts/src/routes/checkbox.svelte index 8066ec2d01..b6afdd4d5b 100644 --- a/examples/svelte-ts/src/routes/checkbox.svelte +++ b/examples/svelte-ts/src/routes/checkbox.svelte @@ -9,11 +9,11 @@ const controls = useControls(checkboxControls) - const [_state, send] = useMachine(checkbox.machine({ id: "1" }), { + const [snapshot, send] = useMachine(checkbox.machine({ id: "1" }), { context: controls.context, }) - const api = $derived(checkbox.connect(_state, send, normalizeProps)) + const api = $derived(checkbox.connect(snapshot, send, normalizeProps))
    @@ -25,19 +25,19 @@ >
    - + diff --git a/examples/svelte-ts/src/routes/clipboard.svelte b/examples/svelte-ts/src/routes/clipboard.svelte index 0e8c2ca9d5..b738a8ade6 100644 --- a/examples/svelte-ts/src/routes/clipboard.svelte +++ b/examples/svelte-ts/src/routes/clipboard.svelte @@ -9,7 +9,7 @@ const controls = useControls(clipboardControls) - const [_state, send] = useMachine( + const [snapshot, send] = useMachine( clipboard.machine({ id: "1", value: "https://github/com/chakra-ui/zag", @@ -19,7 +19,7 @@ }, ) - const api = $derived(clipboard.connect(_state, send, normalizeProps)) + const api = $derived(clipboard.connect(snapshot, send, normalizeProps))
    @@ -29,7 +29,7 @@
    - + diff --git a/examples/svelte-ts/src/routes/collapsible.svelte b/examples/svelte-ts/src/routes/collapsible.svelte index f3dc09de4b..38213d6bba 100644 --- a/examples/svelte-ts/src/routes/collapsible.svelte +++ b/examples/svelte-ts/src/routes/collapsible.svelte @@ -8,11 +8,11 @@ const controls = useControls(collapsibleControls) - const [_state, send] = useMachine(collapsible.machine({ id: "1" }), { + const [snapshot, send] = useMachine(collapsible.machine({ id: "1" }), { context: controls.context, }) - const api = $derived(collapsible.connect(_state, send, normalizeProps)) + const api = $derived(collapsible.connect(snapshot, send, normalizeProps))
    @@ -31,11 +31,11 @@
    Toggle Controls
    - - + +
    - + diff --git a/examples/svelte-ts/src/routes/color-picker.svelte b/examples/svelte-ts/src/routes/color-picker.svelte index 5f67febf57..8907223454 100644 --- a/examples/svelte-ts/src/routes/color-picker.svelte +++ b/examples/svelte-ts/src/routes/color-picker.svelte @@ -11,7 +11,7 @@ const controls = useControls(colorPickerControls) - const [_state, send] = useMachine( + const [snapshot, send] = useMachine( colorPicker.machine({ id: "1", name: "color", @@ -23,7 +23,7 @@ }, ) - const api = $derived(colorPicker.connect(_state, send, normalizeProps)) + const api = $derived(colorPicker.connect(snapshot, send, normalizeProps))
    @@ -128,7 +128,7 @@
    - + {#snippet EyeDropIcon()} diff --git a/examples/svelte-ts/src/routes/combobox.svelte b/examples/svelte-ts/src/routes/combobox.svelte index 911bc12e9b..3fb252f673 100644 --- a/examples/svelte-ts/src/routes/combobox.svelte +++ b/examples/svelte-ts/src/routes/combobox.svelte @@ -19,7 +19,7 @@ controls.setContext("collection", collection) - const [_state, send] = useMachine( + const [snapshot, send] = useMachine( combobox.machine({ id: "1", collection, @@ -39,7 +39,7 @@ }, ) - const api = $derived(combobox.connect(_state, send, normalizeProps)) + const api = $derived(combobox.connect(snapshot, send, normalizeProps)) $inspect(api.inputValue) @@ -71,5 +71,5 @@ - + diff --git a/examples/svelte-ts/src/routes/context-menu.svelte b/examples/svelte-ts/src/routes/context-menu.svelte index 8db193d270..7733fc7946 100644 --- a/examples/svelte-ts/src/routes/context-menu.svelte +++ b/examples/svelte-ts/src/routes/context-menu.svelte @@ -4,14 +4,14 @@ import * as menu from "@zag-js/menu" import { normalizeProps, portal, useMachine } from "@zag-js/svelte" - const [_state, send] = useMachine( + const [snapshot, send] = useMachine( menu.machine({ id: "1", onSelect: console.log, }), ) - const api = $derived(menu.connect(_state, send, normalizeProps)) + const api = $derived(menu.connect(snapshot, send, normalizeProps))
    @@ -27,5 +27,5 @@
    - + diff --git a/examples/svelte-ts/src/routes/file-upload.svelte b/examples/svelte-ts/src/routes/file-upload.svelte index 17e4c44ae0..4d4fa1eea8 100644 --- a/examples/svelte-ts/src/routes/file-upload.svelte +++ b/examples/svelte-ts/src/routes/file-upload.svelte @@ -8,11 +8,11 @@ const controls = useControls(fileUploadControls) - const [state, send] = useMachine(fileUpload.machine({ id: "1" }), { + const [snapshot, send] = useMachine(fileUpload.machine({ id: "1" }), { context: controls.context, }) - const api = $derived(fileUpload.connect(state, send, normalizeProps)) + const api = $derived(fileUpload.connect(snapshot, send, normalizeProps))
    @@ -40,5 +40,5 @@
    - + diff --git a/examples/svelte-ts/src/routes/floating-panel.svelte b/examples/svelte-ts/src/routes/floating-panel.svelte index 332450b06b..c6b14e79fa 100644 --- a/examples/svelte-ts/src/routes/floating-panel.svelte +++ b/examples/svelte-ts/src/routes/floating-panel.svelte @@ -9,11 +9,11 @@ const controls = useControls(floatingPanelControls) - const [_state, send] = useMachine(floatingPanel.machine({ id: "1" }), { + const [snapshot, send] = useMachine(floatingPanel.machine({ id: "1" }), { context: controls.context, }) - const api = $derived(floatingPanel.connect(_state, send, normalizeProps)) + const api = $derived(floatingPanel.connect(snapshot, send, normalizeProps))
    @@ -58,5 +58,5 @@
    - + diff --git a/examples/svelte-ts/src/routes/hover-card.svelte b/examples/svelte-ts/src/routes/hover-card.svelte index ee8de30b40..0da60ac927 100644 --- a/examples/svelte-ts/src/routes/hover-card.svelte +++ b/examples/svelte-ts/src/routes/hover-card.svelte @@ -8,22 +8,22 @@ const controls = useControls(hoverCardControls) - const [state, send] = useMachine(hoverCard.machine({ id: "1" }), { + const [snapshot, send] = useMachine(hoverCard.machine({ id: "1" }), { context: controls.context, }) - const api = $derived(hoverCard.connect(state, send, normalizeProps)) + const api = $derived(hoverCard.connect(snapshot, send, normalizeProps))
    Twitter - {#if api.isOpen} + {#if api.open}
    -
    +
    Twitter Preview Twitter @@ -36,5 +36,5 @@
    - + diff --git a/examples/svelte-ts/src/routes/menu-options.svelte b/examples/svelte-ts/src/routes/menu-options.svelte index ecb154336b..cabbc699b3 100644 --- a/examples/svelte-ts/src/routes/menu-options.svelte +++ b/examples/svelte-ts/src/routes/menu-options.svelte @@ -11,11 +11,11 @@ let order = $state("") let type = $state([]) - const [_state, send] = useMachine(menu.machine({ id: "1" }), { + const [snapshot, send] = useMachine(menu.machine({ id: "1" }), { context: controls.context, }) - const api = $derived(menu.connect(_state, send, normalizeProps)) + const api = $derived(menu.connect(snapshot, send, normalizeProps)) const radios = $derived( menuOptionData.order.map((item) => ({ @@ -71,5 +71,5 @@ - + diff --git a/examples/svelte-ts/src/routes/menu.svelte b/examples/svelte-ts/src/routes/menu.svelte index 4459ccef1b..7d277a4db5 100644 --- a/examples/svelte-ts/src/routes/menu.svelte +++ b/examples/svelte-ts/src/routes/menu.svelte @@ -8,11 +8,11 @@ const controls = useControls(menuControls) - const [state, send] = useMachine(menu.machine({ id: "1", onSelect: console.log }), { + const [snapshot, send] = useMachine(menu.machine({ id: "1", onSelect: console.log }), { context: controls.context, }) - const api = $derived(menu.connect(state, send, normalizeProps)) + const api = $derived(menu.connect(snapshot, send, normalizeProps))
    @@ -32,5 +32,5 @@
    - + diff --git a/examples/svelte-ts/src/routes/number-input.svelte b/examples/svelte-ts/src/routes/number-input.svelte index 433145fd4d..71d8a9a347 100644 --- a/examples/svelte-ts/src/routes/number-input.svelte +++ b/examples/svelte-ts/src/routes/number-input.svelte @@ -8,16 +8,16 @@ const controls = useControls(numberInputControls) - const [_state, send] = useMachine(numberInput.machine({ id: "1" }), { + const [snapshot, send] = useMachine(numberInput.machine({ id: "1" }), { context: controls.context, }) - const api = $derived(numberInput.connect(_state, send, normalizeProps)) + const api = $derived(numberInput.connect(snapshot, send, normalizeProps))
    -
    +
    @@ -29,5 +29,5 @@
    - + diff --git a/examples/svelte-ts/src/routes/pagination.svelte b/examples/svelte-ts/src/routes/pagination.svelte index 18f3c426d9..7a8cf7b012 100644 --- a/examples/svelte-ts/src/routes/pagination.svelte +++ b/examples/svelte-ts/src/routes/pagination.svelte @@ -9,7 +9,7 @@ const controls = useControls(paginationControls) let details = $state({}) - const [_state, send] = useMachine( + const [snapshot, send] = useMachine( pagination.machine({ id: "1", count: paginationData.length, @@ -22,7 +22,7 @@ }, ) - const api = $derived(pagination.connect(_state, send, normalizeProps)) + const api = $derived(pagination.connect(snapshot, send, normalizeProps)) const data = $derived(api.slice(paginationData)) @@ -82,5 +82,5 @@ - + diff --git a/examples/svelte-ts/src/routes/pin-input.svelte b/examples/svelte-ts/src/routes/pin-input.svelte index eee5614dd5..4e6b2f7a5e 100644 --- a/examples/svelte-ts/src/routes/pin-input.svelte +++ b/examples/svelte-ts/src/routes/pin-input.svelte @@ -9,7 +9,7 @@ const controls = useControls(pinInputControls) - const [_state, send] = useMachine( + const [snapshot, send] = useMachine( pinInput.machine({ name: "test", id: "1", @@ -19,7 +19,7 @@ }, ) - const api = $derived(pinInput.connect(_state, send, normalizeProps)) + const api = $derived(pinInput.connect(snapshot, send, normalizeProps))
    @@ -46,5 +46,5 @@
    - + diff --git a/examples/svelte-ts/src/routes/popover.svelte b/examples/svelte-ts/src/routes/popover.svelte index f901b26b5b..1c0f5589fb 100644 --- a/examples/svelte-ts/src/routes/popover.svelte +++ b/examples/svelte-ts/src/routes/popover.svelte @@ -8,11 +8,11 @@ const controls = useControls(popoverControls) - const [state, send] = useMachine(popover.machine({ id: "1" }), { + const [snapshot, send] = useMachine(popover.machine({ id: "1" }), { context: controls.context, }) - const api = $derived(popover.connect(state, send, normalizeProps)) + const api = $derived(popover.connect(snapshot, send, normalizeProps))
    @@ -29,7 +29,7 @@
    -
    +
    Popover Title
    @@ -48,5 +48,5 @@
    - + diff --git a/examples/svelte-ts/src/routes/progress.svelte b/examples/svelte-ts/src/routes/progress.svelte index 4a4233940e..744cc5f177 100644 --- a/examples/svelte-ts/src/routes/progress.svelte +++ b/examples/svelte-ts/src/routes/progress.svelte @@ -8,11 +8,11 @@ const controls = useControls(progressControls) - const [_state, send] = useMachine(progress.machine({ id: "1" }), { + const [snapshot, send] = useMachine(progress.machine({ id: "1" }), { context: controls.context, }) - const api = $derived(progress.connect(_state, send, normalizeProps)) + const api = $derived(progress.connect(snapshot, send, normalizeProps))
    @@ -25,7 +25,7 @@
    -
    +
    {api.valueAsString}
    @@ -39,5 +39,5 @@
    - + diff --git a/examples/svelte-ts/src/routes/radio-group.svelte b/examples/svelte-ts/src/routes/radio-group.svelte index 76070535dd..111ab8046a 100644 --- a/examples/svelte-ts/src/routes/radio-group.svelte +++ b/examples/svelte-ts/src/routes/radio-group.svelte @@ -9,11 +9,11 @@ const controls = useControls(radioControls) - const [state, send] = useMachine(radio.machine({ id: "1", name: "fruit" }), { + const [snapshot, send] = useMachine(radio.machine({ id: "1", name: "fruit" }), { context: controls.context, }) - const api = $derived(radio.connect(state, send, normalizeProps)) + const api = $derived(radio.connect(snapshot, send, normalizeProps))
    @@ -26,10 +26,10 @@

    Fruits

    -
    +
    {#each radioData as opt}
    - + diff --git a/examples/svelte-ts/src/routes/range-slider.svelte b/examples/svelte-ts/src/routes/range-slider.svelte index 0213cab1b7..e091e846e4 100644 --- a/examples/svelte-ts/src/routes/range-slider.svelte +++ b/examples/svelte-ts/src/routes/range-slider.svelte @@ -9,7 +9,7 @@ const controls = useControls(sliderControls) - const [state, send] = useMachine( + const [snapshot, send] = useMachine( slider.machine({ id: "1", name: "quantity", @@ -18,7 +18,7 @@ { context: controls.context }, ) - const api = $derived(slider.connect(state, send, normalizeProps)) + const api = $derived(slider.connect(snapshot, send, normalizeProps))
    @@ -37,7 +37,7 @@
    -
    +
    {#each api.value as _, index}
    @@ -57,5 +57,5 @@
    - + diff --git a/examples/svelte-ts/src/routes/rating-group.svelte b/examples/svelte-ts/src/routes/rating-group.svelte index 9eb49779cb..0b0b648801 100644 --- a/examples/svelte-ts/src/routes/rating-group.svelte +++ b/examples/svelte-ts/src/routes/rating-group.svelte @@ -8,11 +8,11 @@ const controls = useControls(ratingControls) - const [state, send] = useMachine(rating.machine({ id: "1", value: 2.5 }), { + const [snapshot, send] = useMachine(rating.machine({ id: "1", value: 2.5 }), { context: controls.context, }) - const api = $derived(rating.connect(state, send, normalizeProps)) + const api = $derived(rating.connect(snapshot, send, normalizeProps)) {#snippet HalfStar()} @@ -50,7 +50,7 @@ {#each api.items as index} {@const itemState = api.getItemState({ index })} - {#if itemState.isHalf} + {#if itemState.half} {@render HalfStar()} {:else} {@render Star()} @@ -65,5 +65,5 @@ - + diff --git a/examples/svelte-ts/src/routes/segment-control.svelte b/examples/svelte-ts/src/routes/segment-control.svelte index 09760f00c9..b0c0bdea9c 100644 --- a/examples/svelte-ts/src/routes/segment-control.svelte +++ b/examples/svelte-ts/src/routes/segment-control.svelte @@ -8,16 +8,16 @@ const controls = useControls(radioControls) - const [state, send] = useMachine(radio.machine({ id: "2", name: "fruit", orientation: "horizontal" }), { + const [snapshot, send] = useMachine(radio.machine({ id: "2", name: "fruit", orientation: "horizontal" }), { context: controls.context, }) - const api = $derived(radio.connect(state, send, normalizeProps)) + const api = $derived(radio.connect(snapshot, send, normalizeProps))
    -
    +
    {#each radioData as opt}
    - + diff --git a/examples/svelte-ts/src/routes/select.svelte b/examples/svelte-ts/src/routes/select.svelte index c9ac118008..6c920ebcdd 100644 --- a/examples/svelte-ts/src/routes/select.svelte +++ b/examples/svelte-ts/src/routes/select.svelte @@ -9,7 +9,7 @@ const controls = useControls(selectControls) - const [_state, send] = useMachine( + const [snapshot, send] = useMachine( select.machine({ id: "1", name: "select", @@ -20,7 +20,7 @@ }, ) - const api = $derived(select.connect(_state, send, normalizeProps)) + const api = $derived(select.connect(snapshot, send, normalizeProps))
    @@ -71,5 +71,5 @@
    - + diff --git a/examples/svelte-ts/src/routes/signature-pad.svelte b/examples/svelte-ts/src/routes/signature-pad.svelte index 12cf0d019e..4682c3dc86 100644 --- a/examples/svelte-ts/src/routes/signature-pad.svelte +++ b/examples/svelte-ts/src/routes/signature-pad.svelte @@ -12,7 +12,7 @@ let url = $state("") const setUrl = (value: string) => (url = value) - const [_state, send] = useMachine( + const [snapshot, send] = useMachine( signaturePad.machine({ id: "1", onDrawEnd(details) { @@ -29,7 +29,7 @@ }, ) - const api = $derived(signaturePad.connect(_state, send, normalizeProps)) + const api = $derived(signaturePad.connect(snapshot, send, normalizeProps))
    @@ -69,5 +69,5 @@
    - + diff --git a/examples/svelte-ts/src/routes/slider.svelte b/examples/svelte-ts/src/routes/slider.svelte index af2fa2c5ba..2082542b29 100644 --- a/examples/svelte-ts/src/routes/slider.svelte +++ b/examples/svelte-ts/src/routes/slider.svelte @@ -9,7 +9,7 @@ const controls = useControls(sliderControls) - const [_state, send] = useMachine( + const [snapshot, send] = useMachine( slider.machine({ id: "1", name: "quantity", @@ -20,7 +20,7 @@ }, ) - const api = $derived(slider.connect(_state, send, normalizeProps)) + const api = $derived(slider.connect(snapshot, send, normalizeProps))
    @@ -60,5 +60,5 @@
    - + diff --git a/examples/svelte-ts/src/routes/switch.svelte b/examples/svelte-ts/src/routes/switch.svelte index 5b643b2708..dc497cfc5f 100644 --- a/examples/svelte-ts/src/routes/switch.svelte +++ b/examples/svelte-ts/src/routes/switch.svelte @@ -8,11 +8,11 @@ const controls = useControls(switchControls) - const [state, send] = useMachine(zagSwitch.machine({ id: "1", name: "switch" }), { + const [snapshot, send] = useMachine(zagSwitch.machine({ id: "1", name: "switch" }), { context: controls.context, }) - const api = $derived(zagSwitch.connect(state, send, normalizeProps)) + const api = $derived(zagSwitch.connect(snapshot, send, normalizeProps))
    @@ -20,12 +20,12 @@
    - + diff --git a/examples/svelte-ts/src/routes/tabs.svelte b/examples/svelte-ts/src/routes/tabs.svelte index f3419dab4c..9591f2505d 100644 --- a/examples/svelte-ts/src/routes/tabs.svelte +++ b/examples/svelte-ts/src/routes/tabs.svelte @@ -8,7 +8,7 @@ const controls = useControls(tabsControls) - const [_state, send] = useMachine( + const [snapshot, send] = useMachine( tabs.machine({ id: "1", value: "nils", @@ -18,12 +18,12 @@ }, ) - const api = $derived(tabs.connect(_state, send, normalizeProps)) + const api = $derived(tabs.connect(snapshot, send, normalizeProps))
    -
    +
    {#each tabsData as data}
    - + diff --git a/examples/svelte-ts/src/routes/tags-input.svelte b/examples/svelte-ts/src/routes/tags-input.svelte index 1cfe03fef5..f832d7a26f 100644 --- a/examples/svelte-ts/src/routes/tags-input.svelte +++ b/examples/svelte-ts/src/routes/tags-input.svelte @@ -12,7 +12,7 @@ const controls = useControls(tagsInputControls) - const [_state, send] = useMachine( + const [snapshot, send] = useMachine( tagsInput.machine({ id: "1", value: ["React", "Vue"], @@ -22,7 +22,7 @@ }, ) - const api = $derived(tagsInput.connect(_state, send, normalizeProps)) + const api = $derived(tagsInput.connect(snapshot, send, normalizeProps))
    @@ -54,5 +54,5 @@
    - + diff --git a/examples/svelte-ts/src/routes/toast.svelte b/examples/svelte-ts/src/routes/toast.svelte index 44d5a1bbe1..97f11649ff 100644 --- a/examples/svelte-ts/src/routes/toast.svelte +++ b/examples/svelte-ts/src/routes/toast.svelte @@ -9,7 +9,7 @@ const controls = useControls(toastControls) - const [state, send] = useMachine( + const [snapshot, send] = useMachine( toast.group.machine({ id: "1", placement: "bottom-end", @@ -21,7 +21,7 @@ }, ) - const api = $derived(toast.group.connect(state, send, normalizeProps)) + const api = $derived(toast.group.connect(snapshot, send, normalizeProps)) let id: string | undefined = "" @@ -73,5 +73,5 @@ - + diff --git a/examples/svelte-ts/src/routes/toggle-group.svelte b/examples/svelte-ts/src/routes/toggle-group.svelte index ad8f226d4b..0d58f6fc0f 100644 --- a/examples/svelte-ts/src/routes/toggle-group.svelte +++ b/examples/svelte-ts/src/routes/toggle-group.svelte @@ -8,11 +8,11 @@ const controls = useControls(toggleGroupControls) - const [_state, send] = useMachine(toggle.machine({ id: "1" }), { + const [snapshot, send] = useMachine(toggle.machine({ id: "1" }), { context: controls.context, }) - const api = $derived(toggle.connect(_state, send, normalizeProps)) + const api = $derived(toggle.connect(snapshot, send, normalizeProps))
    @@ -27,5 +27,5 @@
    - + diff --git a/examples/svelte-ts/src/routes/tooltip.svelte b/examples/svelte-ts/src/routes/tooltip.svelte index 49771ece97..1402169fdf 100644 --- a/examples/svelte-ts/src/routes/tooltip.svelte +++ b/examples/svelte-ts/src/routes/tooltip.svelte @@ -7,23 +7,23 @@ const id = "tip-1" const id2 = "tip-2" - const [_state, send] = useMachine(tooltip.machine({ id })) - const [_state2, send2] = useMachine(tooltip.machine({ id: id2 })) + const [snapshot, send] = useMachine(tooltip.machine({ id })) + const [snapshot2, send2] = useMachine(tooltip.machine({ id: id2 })) - const api = $derived(tooltip.connect(_state, send, normalizeProps)) - const api2 = $derived(tooltip.connect(_state2, send2, normalizeProps)) + const api = $derived(tooltip.connect(snapshot, send, normalizeProps)) + const api2 = $derived(tooltip.connect(snapshot2, send2, normalizeProps))
    - {#if api.isOpen} + {#if api.open}
    Tooltip
    {/if} - {#if api2.isOpen} + {#if api2.open}
    Tooltip 2
    @@ -32,6 +32,6 @@
    - - + + diff --git a/examples/svelte-ts/src/routes/tour.svelte b/examples/svelte-ts/src/routes/tour.svelte index 83a7e1ac6a..560698f068 100644 --- a/examples/svelte-ts/src/routes/tour.svelte +++ b/examples/svelte-ts/src/routes/tour.svelte @@ -7,11 +7,11 @@ const controls = useControls(tourControls) - const [state, send] = useMachine(tour.machine({ id: "1", steps: tourData }), { + const [snapshot, send] = useMachine(tour.machine({ id: "1", steps: tourData }), { context: controls.context, }) - const api = $derived(tour.connect(state, send, normalizeProps)) + const api = $derived(tour.connect(snapshot, send, normalizeProps))
    @@ -20,9 +20,9 @@

    Step 1

    -
    +

    Step 2

    -
    +