Skip to content

Commit

Permalink
chore: group type import into single import
Browse files Browse the repository at this point in the history
  • Loading branch information
zernonia committed Jul 17, 2023
1 parent 43ce299 commit fb5609e
Show file tree
Hide file tree
Showing 60 changed files with 159 additions and 154 deletions.
3 changes: 1 addition & 2 deletions packages/radix-vue/src/Accordion/AccordionHeader.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script setup lang="ts">
import { inject } from "vue";
import { PrimitiveH3 } from "@/Primitive";
import { type PrimitiveProps } from "@/Primitive";
import { PrimitiveH3, type PrimitiveProps } from "@/Primitive";
interface AccordionHeaderProps extends PrimitiveProps {}
const props = defineProps<AccordionHeaderProps>();
Expand Down
7 changes: 5 additions & 2 deletions packages/radix-vue/src/Accordion/AccordionImpl.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script lang="ts">
import type { InjectionKey, Ref } from "vue";
export type Direction = "ltr" | "rtl";
import { type PrimitiveProps } from "@/Primitive";
export interface AccordionImplProps extends PrimitiveProps {
/**
Expand Down Expand Up @@ -50,7 +49,11 @@ export const ACCORDION_IMPL_INJECTION_KEY =

<script setup lang="ts">
import { provide } from "vue";
import { PrimitiveDiv, usePrimitiveElement } from "@/Primitive";
import {
PrimitiveDiv,
usePrimitiveElement,
type PrimitiveProps,
} from "@/Primitive";
const props = withDefaults(defineProps<AccordionImplProps>(), {
orientation: "vertical",
Expand Down
4 changes: 1 addition & 3 deletions packages/radix-vue/src/AlertDialog/AlertDialogCancel.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script lang="ts">
import { type PrimitiveProps } from "@/Primitive";
export interface AlertDialogCancelProps extends PrimitiveProps {}
</script>

Expand All @@ -10,7 +8,7 @@ import {
DIALOG_INJECTION_KEY,
type DialogProvideValue,
} from "./AlertDialogRoot.vue";
import { PrimitiveButton } from "../Primitive";
import { PrimitiveButton, type PrimitiveProps } from "../Primitive";
const props = defineProps<AlertDialogCancelProps>();
Expand Down
8 changes: 5 additions & 3 deletions packages/radix-vue/src/AlertDialog/AlertDialogContent.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script lang="ts">
import { type PrimitiveProps } from "@/Primitive";
export interface AlertDialogContentProps extends PrimitiveProps {
forceMount?: boolean;
//onOpenAutoFocus?: void;
Expand All @@ -16,7 +14,11 @@ import {
DIALOG_INJECTION_KEY,
type DialogProvideValue,
} from "./AlertDialogRoot.vue";
import { PrimitiveDiv, usePrimitiveElement } from "../Primitive";
import {
PrimitiveDiv,
usePrimitiveElement,
type PrimitiveProps,
} from "../Primitive";
const injectedValue = inject<DialogProvideValue>(DIALOG_INJECTION_KEY);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<script lang="ts">
import { type PrimitiveProps } from "@/Primitive";
export interface AlertDialogDescriptionProps extends PrimitiveProps {}
</script>

<script setup lang="ts">
import { PrimitiveP } from "@/Primitive";
import { PrimitiveP, type PrimitiveProps } from "@/Primitive";
const props = defineProps<AlertDialogDescriptionProps>();
</script>
Expand Down
4 changes: 1 addition & 3 deletions packages/radix-vue/src/AlertDialog/AlertDialogOverlay.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script lang="ts">
import { type PrimitiveProps } from "@/Primitive";
export interface AlertDialogOverlayProps extends PrimitiveProps {
forceMount?: boolean;
}
Expand All @@ -12,7 +10,7 @@ import {
DIALOG_INJECTION_KEY,
type DialogProvideValue,
} from "./AlertDialogRoot.vue";
import { PrimitiveDiv } from "../Primitive";
import { PrimitiveDiv, type PrimitiveProps } from "../Primitive";
const injectedValue = inject<DialogProvideValue>(DIALOG_INJECTION_KEY);
Expand Down
4 changes: 1 addition & 3 deletions packages/radix-vue/src/AlertDialog/AlertDialogTitle.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<script lang="ts">
import { type PrimitiveProps } from "@/Primitive";
export interface AlertDialogTitleProps extends PrimitiveProps {}
</script>

<script setup lang="ts">
import { PrimitiveH2 } from "../Primitive";
import { PrimitiveH2, type PrimitiveProps } from "../Primitive";
const props = defineProps<AlertDialogTitleProps>();
</script>
Expand Down
8 changes: 5 additions & 3 deletions packages/radix-vue/src/AlertDialog/AlertDialogTrigger.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script lang="ts">
import { type PrimitiveProps } from "@/Primitive";
export interface AlertDialogTriggerProps extends PrimitiveProps {}
</script>

Expand All @@ -10,7 +8,11 @@ import {
DIALOG_INJECTION_KEY,
type DialogProvideValue,
} from "./AlertDialogRoot.vue";
import { PrimitiveButton, usePrimitiveElement } from "../Primitive";
import {
PrimitiveButton,
usePrimitiveElement,
type PrimitiveProps,
} from "../Primitive";
const injectedValue = inject<DialogProvideValue>(DIALOG_INJECTION_KEY);
Expand Down
4 changes: 1 addition & 3 deletions packages/radix-vue/src/AspectRatio/AspectRatio.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<script lang="ts">
import { type PrimitiveProps } from "@/Primitive";
interface AspectRatioProps extends PrimitiveProps {
ratio?: number;
}
</script>

<script setup lang="ts">
import { PrimitiveDiv } from "@/Primitive";
import { PrimitiveDiv, type PrimitiveProps } from "@/Primitive";
import { computed } from "vue";
const props = withDefaults(defineProps<AspectRatioProps>(), {
Expand Down
4 changes: 1 addition & 3 deletions packages/radix-vue/src/Avatar/AvatarFallback.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script lang="ts">
import { type PrimitiveProps } from "@/Primitive";
export interface AvatarFallbackProps extends PrimitiveProps {
delayMs?: number;
}
Expand All @@ -12,7 +10,7 @@ import {
AVATAR_INJECTION_KEY,
type AvatarProvideValue,
} from "./AvatarRoot.vue";
import { PrimitiveSpan } from "../Primitive";
import { PrimitiveSpan, type PrimitiveProps } from "../Primitive";
const injectedValue = inject<AvatarProvideValue>(AVATAR_INJECTION_KEY);
Expand Down
4 changes: 1 addition & 3 deletions packages/radix-vue/src/Avatar/AvatarImage.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script lang="ts">
import { type PrimitiveProps } from "@/Primitive";
export interface AvatarImageProps extends PrimitiveProps {
onLoadingStatusChange?: void;
}
Expand All @@ -12,7 +10,7 @@ import {
AVATAR_INJECTION_KEY,
type AvatarProvideValue,
} from "./AvatarRoot.vue";
import { PrimitiveImg } from "../Primitive";
import { PrimitiveImg, type PrimitiveProps } from "../Primitive";
const injectedValue = inject<AvatarProvideValue>(AVATAR_INJECTION_KEY);
Expand Down
3 changes: 1 addition & 2 deletions packages/radix-vue/src/Avatar/AvatarRoot.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script lang="ts">
import type { Ref, InjectionKey } from "vue";
import { type PrimitiveProps } from "@/Primitive";
type ImageLoadingStatus = "loading" | "loaded";
Expand All @@ -16,7 +15,7 @@ export interface AvatarProvideValue {

<script setup lang="ts">
import { ref, provide } from "vue";
import { PrimitiveSpan } from "../Primitive";
import { PrimitiveSpan, type PrimitiveProps } from "../Primitive";
const imageLoadingStatusRef = ref<ImageLoadingStatus>("loading");
Expand Down
4 changes: 1 addition & 3 deletions packages/radix-vue/src/Checkbox/CheckboxIndicator.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script lang="ts">
import { type PrimitiveProps } from "@/Primitive";
export interface CheckboxIndicatorProps extends PrimitiveProps {
forceMount?: boolean;
}
Expand All @@ -12,7 +10,7 @@ import {
CHECKBOX_INJECTION_KEY,
type CheckboxProvideValue,
} from "./CheckboxRoot.vue";
import { PrimitiveSpan } from "@/Primitive";
import { PrimitiveSpan, type PrimitiveProps } from "@/Primitive";
const injectedValue = inject<CheckboxProvideValue>(CHECKBOX_INJECTION_KEY);
Expand Down
3 changes: 1 addition & 2 deletions packages/radix-vue/src/Checkbox/CheckboxRoot.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script lang="ts">
import type { InjectionKey, Ref } from "vue";
import { type PrimitiveProps } from "@/Primitive";
export interface CheckboxRootProps extends PrimitiveProps {
defaultChecked?: boolean;
Expand All @@ -25,7 +24,7 @@ export const CHECKBOX_INJECTION_KEY =
</script>

<script setup lang="ts">
import { PrimitiveDiv } from "@/Primitive";
import { PrimitiveDiv, type PrimitiveProps } from "@/Primitive";
import { toRef, provide } from "vue";
const props = withDefaults(defineProps<CheckboxRootProps>(), {
Expand Down
8 changes: 5 additions & 3 deletions packages/radix-vue/src/Collapsible/CollapsibleContent.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script lang="ts">
import { type PrimitiveProps } from "@/Primitive";
export interface CollapsibleContentProps extends PrimitiveProps {}
</script>

Expand All @@ -10,7 +8,11 @@ import {
COLLAPSIBLE_INJECTION_KEY,
type CollapsibleProvideValue,
} from "./CollapsibleRoot.vue";
import { PrimitiveDiv, usePrimitiveElement } from "@/Primitive";
import {
PrimitiveDiv,
usePrimitiveElement,
type PrimitiveProps,
} from "@/Primitive";
import { Presence } from "@/Presence";
const injectedValue = inject<CollapsibleProvideValue>(
Expand Down
3 changes: 1 addition & 2 deletions packages/radix-vue/src/Collapsible/CollapsibleRoot.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script lang="ts">
import type { InjectionKey, Ref } from "vue";
import { type PrimitiveProps } from "@/Primitive";
import { useId } from "@/shared";
export interface CollapsibleRootProps extends PrimitiveProps {
Expand All @@ -22,7 +21,7 @@ export const COLLAPSIBLE_INJECTION_KEY =

<script setup lang="ts">
import { provide } from "vue";
import { PrimitiveDiv } from "@/Primitive";
import { PrimitiveDiv, type PrimitiveProps } from "@/Primitive";
import { useVModel } from "@vueuse/core";
const props = withDefaults(defineProps<CollapsibleRootProps>(), {
Expand Down
4 changes: 1 addition & 3 deletions packages/radix-vue/src/Collapsible/CollapsibleTrigger.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<script lang="ts">
import { type PrimitiveProps } from "@/Primitive";
export interface CollapsibleTriggerProps extends PrimitiveProps {}
</script>

<script setup lang="ts">
import { inject } from "vue";
import { PrimitiveButton } from "../Primitive";
import { PrimitiveButton, type PrimitiveProps } from "../Primitive";
import {
COLLAPSIBLE_INJECTION_KEY,
type CollapsibleProvideValue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ provide(CONTEXT_MENU_ITEM_SYMBOL, {
:disabled="props.disabled"
:rootProvider="injectedValue"
:orientation="injectedValue?.orientation"
:as-child="props.asChild"
@handle-click="handleClick"
@escape-keydown="handleEscape"
role="menuitemcheckbox"
Expand Down
7 changes: 5 additions & 2 deletions packages/radix-vue/src/ContextMenu/ContextMenuGroup.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script lang="ts">
import type { Ref, InjectionKey } from "vue";
import type { DataOrientation, Direction } from "../shared/types";
import { type PrimitiveProps } from "@/Primitive";
type TypeEnum = "single" | "multiple";
Expand Down Expand Up @@ -30,7 +29,11 @@ export interface ContextMenuGroupProvideValue {

<script setup lang="ts">
import { toRef, provide } from "vue";
import { PrimitiveDiv, usePrimitiveElement } from "@/Primitive";
import {
PrimitiveDiv,
usePrimitiveElement,
type PrimitiveProps,
} from "@/Primitive";
const props = withDefaults(defineProps<ContextMenuGroupProps>(), {
type: "single",
Expand Down
1 change: 1 addition & 0 deletions packages/radix-vue/src/ContextMenu/ContextMenuItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function handleEscape() {
:rootProvider="rootInjectedValue"
:subProvider="subInjectedValue"
:orientation="rootInjectedValue?.orientation"
:as-child="props.asChild"
@handle-click="handleClick"
@escape-keydown="handleEscape"
>
Expand Down
12 changes: 8 additions & 4 deletions packages/radix-vue/src/ContextMenu/ContextMenuItemIndicator.vue
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
<script lang="ts">
import { type PrimitiveProps } from "@/Primitive";
export interface ContextMenuItemIndicatorProps extends PrimitiveProps {
forceMount?: boolean;
}
</script>

<script setup lang="ts">
import { inject } from "vue";
import { PrimitiveSpan } from "@/Primitive";
import { PrimitiveSpan, type PrimitiveProps } from "@/Primitive";
import { CONTEXT_MENU_ITEM_SYMBOL } from "./utils";
const context = inject(CONTEXT_MENU_ITEM_SYMBOL);
const props = defineProps<ContextMenuItemIndicatorProps>();
</script>

<template>
<PrimitiveSpan v-if="context?.modelValue.value" style="pointer-events: none">
<PrimitiveSpan
v-if="context?.modelValue.value"
:as-child="props.asChild"
style="pointer-events: none"
>
<slot />
</PrimitiveSpan>
</template>
5 changes: 2 additions & 3 deletions packages/radix-vue/src/ContextMenu/ContextMenuLabel.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script lang="ts">
import { PrimitiveLabel } from "@/Primitive";
import { type PrimitiveProps } from "@/Primitive";
import { PrimitiveLabel, type PrimitiveProps } from "@/Primitive";
interface ContextMenuLabelProps extends PrimitiveProps {
for?: string;
Expand All @@ -12,5 +11,5 @@ const props = defineProps<ContextMenuLabelProps>();
</script>

<template>
<PrimitiveLabel :for="props.for"><slot /></PrimitiveLabel>
<PrimitiveLabel v-bind="props"><slot /></PrimitiveLabel>
</template>
8 changes: 6 additions & 2 deletions packages/radix-vue/src/ContextMenu/ContextMenuRadioGroup.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script lang="ts">
import type { Ref } from "vue";
import { useVModel } from "@vueuse/core";
import { type PrimitiveProps } from "@/Primitive";
export interface RadioGroupRootProps extends PrimitiveProps {
value?: string;
Expand All @@ -22,7 +21,11 @@ export interface RadioGroupProvideValue {

<script setup lang="ts">
import { provide } from "vue";
import { PrimitiveDiv, usePrimitiveElement } from "@/Primitive";
import {
PrimitiveDiv,
usePrimitiveElement,
type PrimitiveProps,
} from "@/Primitive";
const props = defineProps<RadioGroupRootProps>();
Expand All @@ -49,6 +52,7 @@ provide<RadioGroupProvideValue>(RADIO_GROUP_INJECTION_KEY, {
ref="primitiveElement"
role="radiogroup"
aria-label="radiogroup"
:as-child="props.asChild"
>
<slot />
</PrimitiveDiv>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ provide(CONTEXT_MENU_ITEM_SYMBOL, {
:rootProvider="rootInjectedValue"
:orientation="rootInjectedValue?.orientation"
:data-radix-vue-radio-value="props.value"
:as-child="props.asChild"
@handle-click="handleClick"
@escape-keydown="handleEscape"
@click="handleClick"
Expand Down
Loading

0 comments on commit fb5609e

Please sign in to comment.