diff --git a/packages/radix-vue/src/Combobox/ComboboxArrow.vue b/packages/radix-vue/src/Combobox/ComboboxArrow.vue
index e2fbe1f1e..288f90c06 100644
--- a/packages/radix-vue/src/Combobox/ComboboxArrow.vue
+++ b/packages/radix-vue/src/Combobox/ComboboxArrow.vue
@@ -1,19 +1,18 @@
diff --git a/packages/radix-vue/src/Combobox/ComboboxCancel.vue b/packages/radix-vue/src/Combobox/ComboboxCancel.vue
index 6c8a93eb5..0ac6b15bd 100644
--- a/packages/radix-vue/src/Combobox/ComboboxCancel.vue
+++ b/packages/radix-vue/src/Combobox/ComboboxCancel.vue
@@ -1,18 +1,17 @@
diff --git a/packages/radix-vue/src/Combobox/ComboboxContent.vue b/packages/radix-vue/src/Combobox/ComboboxContent.vue
index cf53372f4..179a4a559 100644
--- a/packages/radix-vue/src/Combobox/ComboboxContent.vue
+++ b/packages/radix-vue/src/Combobox/ComboboxContent.vue
@@ -1,6 +1,5 @@
-
+
diff --git a/packages/radix-vue/src/Combobox/ComboboxContentImpl.vue b/packages/radix-vue/src/Combobox/ComboboxContentImpl.vue
index 5b8f3053e..91317aa5a 100644
--- a/packages/radix-vue/src/Combobox/ComboboxContentImpl.vue
+++ b/packages/radix-vue/src/Combobox/ComboboxContentImpl.vue
@@ -1,4 +1,10 @@
@@ -96,21 +94,21 @@ provide(COMBOBOX_CONTENT_INJECTION_KEY, {
as-child
:disable-outside-pointer-events="disableOutsidePointerEvents"
@focus-outside.prevent
- @dismiss="context?.onOpenChange(false)"
+ @dismiss="rootContext.onOpenChange(false)"
@escape-key-down="emits('escapeKeyDown', $event)"
@pointer-down-outside="(ev) => {
// if clicking inside the combobox, prevent dismiss
- if (context?.parentElement.value?.contains(ev.target as Node)) ev.preventDefault()
+ if (rootContext.parentElement.value?.contains(ev.target as Node)) ev.preventDefault()
emits('pointerDownOutside', ev)
}"
>
import { Primitive, type PrimitiveProps } from '@/Primitive'
-import { computed, inject } from 'vue'
-import { COMBOBOX_INJECT_KEY } from './ComboboxRoot.vue'
+import { computed } from 'vue'
+import { injectComboboxRootContext } from './ComboboxRoot.vue'
export interface ComboboxEmptyProps extends PrimitiveProps {}
const props = defineProps()
-const context = inject(COMBOBOX_INJECT_KEY)
+const rootContext = injectComboboxRootContext()
// if no options, then show this
-const isEmpty = computed(() => context?.searchTerm.value && context.filteredOptions.value.length === 0)
+const isEmpty = computed(() => rootContext.searchTerm.value && rootContext.filteredOptions.value.length === 0)
diff --git a/packages/radix-vue/src/Combobox/ComboboxGroup.vue b/packages/radix-vue/src/Combobox/ComboboxGroup.vue
index 37906b910..1b56d87f0 100644
--- a/packages/radix-vue/src/Combobox/ComboboxGroup.vue
+++ b/packages/radix-vue/src/Combobox/ComboboxGroup.vue
@@ -1,34 +1,37 @@
diff --git a/packages/radix-vue/src/Combobox/ComboboxInput.vue b/packages/radix-vue/src/Combobox/ComboboxInput.vue
index 757c65e25..a3cc54420 100644
--- a/packages/radix-vue/src/Combobox/ComboboxInput.vue
+++ b/packages/radix-vue/src/Combobox/ComboboxInput.vue
@@ -1,6 +1,6 @@
diff --git a/packages/radix-vue/src/Combobox/ComboboxItem.vue b/packages/radix-vue/src/Combobox/ComboboxItem.vue
index 00a5bcb21..1abc4b62f 100644
--- a/packages/radix-vue/src/Combobox/ComboboxItem.vue
+++ b/packages/radix-vue/src/Combobox/ComboboxItem.vue
@@ -1,10 +1,12 @@
diff --git a/packages/radix-vue/src/Combobox/ComboboxItemIndicator.vue b/packages/radix-vue/src/Combobox/ComboboxItemIndicator.vue
index bd7e49f8d..6ba5fed5e 100644
--- a/packages/radix-vue/src/Combobox/ComboboxItemIndicator.vue
+++ b/packages/radix-vue/src/Combobox/ComboboxItemIndicator.vue
@@ -1,6 +1,5 @@
-
+
diff --git a/packages/radix-vue/src/Combobox/ComboboxLabel.vue b/packages/radix-vue/src/Combobox/ComboboxLabel.vue
index fe6afc79a..9d973427d 100644
--- a/packages/radix-vue/src/Combobox/ComboboxLabel.vue
+++ b/packages/radix-vue/src/Combobox/ComboboxLabel.vue
@@ -7,16 +7,13 @@ export interface ComboboxLabelProps extends PrimitiveProps {
diff --git a/packages/radix-vue/src/Combobox/ComboboxRoot.vue b/packages/radix-vue/src/Combobox/ComboboxRoot.vue
index 0a0d3874e..08c6142a1 100644
--- a/packages/radix-vue/src/Combobox/ComboboxRoot.vue
+++ b/packages/radix-vue/src/Combobox/ComboboxRoot.vue
@@ -1,5 +1,7 @@
@@ -22,13 +22,13 @@ const disabled = computed(() => props.disabled || context?.disabled.value || fal
tabindex="-1"
aria-label="Show popup"
aria-haspopup="listbox"
- :aria-expanded="context?.open.value"
- :aria-controls="context?.contentId"
- :data-state="context?.open.value ? 'open' : 'closed'"
+ :aria-expanded="rootContext.open.value"
+ :aria-controls="rootContext.contentId"
+ :data-state="rootContext.open.value ? 'open' : 'closed'"
:disabled="disabled"
:data-disabled="disabled"
:aria-disabled="disabled ?? undefined"
- @click="context?.onOpenChange(!context.open.value)"
+ @click="rootContext.onOpenChange(!rootContext.open.value)"
>
diff --git a/packages/radix-vue/src/DropdownMenu/DropdownMenuContent.vue b/packages/radix-vue/src/DropdownMenu/DropdownMenuContent.vue
index 9eb458ded..6556bcd3b 100644
--- a/packages/radix-vue/src/DropdownMenu/DropdownMenuContent.vue
+++ b/packages/radix-vue/src/DropdownMenu/DropdownMenuContent.vue
@@ -1,6 +1,6 @@
{
// only call handler if it's the left button (mousedown gets triggered by all mouse buttons)
// but not when the control key is pressed (avoiding MacOS right click)
if (!disabled && event.button === 0 && event.ctrlKey === false) {
- context?.onOpenToggle();
+ rootContext.onOpenToggle();
// prevent trigger focusing when opening
// this allows the content to be given focus without competition
- if (context?.open.value) event.preventDefault();
+ if (rootContext.open.value) event.preventDefault();
}
}
"
@keydown.enter.space.arrow-down="
(event) => {
if (disabled) return;
- if (['Enter', ' '].includes(event.key)) context?.onOpenToggle();
- if (event.key === 'ArrowDown') context?.onOpenChange(true);
+ if (['Enter', ' '].includes(event.key)) rootContext.onOpenToggle();
+ if (event.key === 'ArrowDown') rootContext.onOpenChange(true);
// prevent keydown from scrolling window / first focused item to execute
// that keydown (inadvertently closing the menu)
if (['Enter', ' ', 'ArrowDown'].includes(event.key))
diff --git a/packages/radix-vue/src/DropdownMenu/utils.ts b/packages/radix-vue/src/DropdownMenu/utils.ts
deleted file mode 100644
index 021390572..000000000
--- a/packages/radix-vue/src/DropdownMenu/utils.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { type InjectionKey, type Ref } from 'vue'
-
-interface DropdownMenuItemContextValue {
- modelValue: Ref
-}
-
-export const DROPDOWN_MENU_ITEM_SYMBOL
- = Symbol() as InjectionKey
diff --git a/packages/radix-vue/src/NavigationMenu/NavigationMenuContent.vue b/packages/radix-vue/src/NavigationMenu/NavigationMenuContent.vue
index 58c5352a3..f5010bb31 100644
--- a/packages/radix-vue/src/NavigationMenu/NavigationMenuContent.vue
+++ b/packages/radix-vue/src/NavigationMenu/NavigationMenuContent.vue
@@ -1,7 +1,7 @@
@@ -45,16 +45,16 @@ export default {
-
+
@@ -32,7 +32,7 @@ export default {
v-bind="$attrs"
:as-child="props.asChild"
:as="as"
- :data-orientation="context?.orientation"
+ :data-orientation="menuContext.orientation"
>
diff --git a/packages/radix-vue/src/NavigationMenu/NavigationMenuRoot.vue b/packages/radix-vue/src/NavigationMenu/NavigationMenuRoot.vue
index cccc00d60..890f67647 100644
--- a/packages/radix-vue/src/NavigationMenu/NavigationMenuRoot.vue
+++ b/packages/radix-vue/src/NavigationMenu/NavigationMenuRoot.vue
@@ -1,14 +1,12 @@
@@ -144,6 +144,6 @@ export default {
:tabindex="0"
@focus="handleVisuallyHiddenFocus"
/>
-
+
diff --git a/packages/radix-vue/src/NavigationMenu/NavigationMenuViewport.vue b/packages/radix-vue/src/NavigationMenu/NavigationMenuViewport.vue
index 16bc2c463..3a5a01634 100644
--- a/packages/radix-vue/src/NavigationMenu/NavigationMenuViewport.vue
+++ b/packages/radix-vue/src/NavigationMenu/NavigationMenuViewport.vue
@@ -1,13 +1,12 @@
@@ -17,7 +16,7 @@ const context = inject(TOAST_PROVIDER_INJECTION_KEY)
style="position: 'fixed'"
@focus="(event) => {
const prevFocusedElement = event.relatedTarget as HTMLElement | null;
- const isFocusFromOutsideViewport = !context!.viewport.value?.contains(prevFocusedElement);
+ const isFocusFromOutsideViewport = !providerContext.viewport.value?.contains(prevFocusedElement);
if (isFocusFromOutsideViewport) emits('focusFromOutsideViewport');
}"
>
diff --git a/packages/radix-vue/src/Toast/ToastAnnounce.vue b/packages/radix-vue/src/Toast/ToastAnnounce.vue
index 9069bfd4a..cd051397c 100644
--- a/packages/radix-vue/src/Toast/ToastAnnounce.vue
+++ b/packages/radix-vue/src/Toast/ToastAnnounce.vue
@@ -1,11 +1,11 @@
@@ -18,7 +17,7 @@ const interactiveContext = inject(TOAST_INTERACTIVE_CONTEXT)
diff --git a/packages/radix-vue/src/Toast/ToastProvider.vue b/packages/radix-vue/src/Toast/ToastProvider.vue
index b3ca997b2..8afe9c140 100644
--- a/packages/radix-vue/src/Toast/ToastProvider.vue
+++ b/packages/radix-vue/src/Toast/ToastProvider.vue
@@ -1,7 +1,8 @@
@@ -142,7 +140,7 @@ provide(TOAST_INTERACTIVE_CONTEXT, {
{{ announceTextContent }}
-
+
{
pointerStartRef = { x: event.clientX, y: event.clientY };
@@ -167,8 +165,8 @@ provide(TOAST_INTERACTIVE_CONTEXT, {
const x = event.clientX - pointerStartRef.x;
const y = event.clientY - pointerStartRef.y;
const hasSwipeMoveStarted = Boolean(swipeDeltaRef);
- const isHorizontalSwipe = ['left', 'right'].includes(context!.swipeDirection.value);
- const clamp = ['left', 'up'].includes(context!.swipeDirection.value)
+ const isHorizontalSwipe = ['left', 'right'].includes(providerContext.swipeDirection.value);
+ const clamp = ['left', 'up'].includes(providerContext.swipeDirection.value)
? Math.min
: Math.max;
const clampedX = isHorizontalSwipe ? clamp(0, x) : 0;
@@ -180,7 +178,7 @@ provide(TOAST_INTERACTIVE_CONTEXT, {
swipeDeltaRef = delta;
handleAndDispatchCustomEvent(TOAST_SWIPE_MOVE, (ev: SwipeEvent) => emits('swipeMove', ev), eventDetail);
}
- else if (isDeltaInDirection(delta, context!.swipeDirection.value, moveStartBuffer)) {
+ else if (isDeltaInDirection(delta, providerContext.swipeDirection.value, moveStartBuffer)) {
swipeDeltaRef = delta;
handleAndDispatchCustomEvent(TOAST_SWIPE_START, (ev: SwipeEvent) => emits('swipeStart', ev), eventDetail);
(event.target as HTMLElement).setPointerCapture(event.pointerId);
@@ -203,7 +201,7 @@ provide(TOAST_INTERACTIVE_CONTEXT, {
const toast = event.currentTarget;
const eventDetail = { originalEvent: event, delta };
if (
- isDeltaInDirection(delta, context!.swipeDirection.value, context!.swipeThreshold.value)
+ isDeltaInDirection(delta, providerContext.swipeDirection.value, providerContext.swipeThreshold.value)
) {
handleAndDispatchCustomEvent(TOAST_SWIPE_END, (ev: SwipeEvent) => emits('swipeEnd', ev), eventDetail);
}
diff --git a/packages/radix-vue/src/Toast/ToastViewport.vue b/packages/radix-vue/src/Toast/ToastViewport.vue
index b4a9ac12e..9db254780 100644
--- a/packages/radix-vue/src/Toast/ToastViewport.vue
+++ b/packages/radix-vue/src/Toast/ToastViewport.vue
@@ -1,8 +1,8 @@