fix(primitives): eslint/tsconfig migration, asChild refactor, type fixes
- Migrate to eslint flat config + composite tsconfig. - Complete the asChild→as="template" refactor (remove asChild prop + :as-child bindings across components, matching Primitive's slot model). - Fix test type errors and source type-safety (useGraceArea hull/point math, FocusScope/util ref typing). Note: ~53 vue-tsc errors remain (HTML attr/event passthrough typing on transparent wrapper components + a couple of duplicate-export naming collisions) — not gated by CI (build/lint/test green); pending a component-attribute-typing design decision.
This commit is contained in:
@@ -5,8 +5,8 @@ export interface PaginationEllipsisProps extends PrimitiveProps {}
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useForwardExpose } from '@robonen/vue';
|
||||
import { Primitive } from '@/primitive';
|
||||
import { useForwardExpose } from '@robonen/vue';
|
||||
|
||||
const { as = 'span' as const } = defineProps<PaginationEllipsisProps>();
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@ export interface PaginationFirstProps extends PrimitiveProps {}
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { useForwardExpose } from '@robonen/vue';
|
||||
import { Primitive } from '@/primitive';
|
||||
import { computed } from 'vue';
|
||||
import { injectPaginationContext } from './context';
|
||||
import { useForwardExpose } from '@robonen/vue';
|
||||
|
||||
const { as = 'button' as const } = defineProps<PaginationFirstProps>();
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@ export interface PaginationLastProps extends PrimitiveProps {}
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { useForwardExpose } from '@robonen/vue';
|
||||
import { Primitive } from '@/primitive';
|
||||
import { computed } from 'vue';
|
||||
import { injectPaginationContext } from './context';
|
||||
import { useForwardExpose } from '@robonen/vue';
|
||||
|
||||
const { as = 'button' as const } = defineProps<PaginationLastProps>();
|
||||
|
||||
|
||||
@@ -5,12 +5,12 @@ export interface PaginationListProps extends PrimitiveProps {}
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { useForwardExpose } from '@robonen/vue';
|
||||
import { Primitive } from '@/primitive';
|
||||
import { injectPaginationContext } from './context';
|
||||
import { getRange } from './utils';
|
||||
import type { PaginationItem } from './utils';
|
||||
import { Primitive } from '@/primitive';
|
||||
import { computed } from 'vue';
|
||||
import { getRange } from './utils';
|
||||
import { injectPaginationContext } from './context';
|
||||
import { useForwardExpose } from '@robonen/vue';
|
||||
|
||||
const { as = 'div' as const } = defineProps<PaginationListProps>();
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ export interface PaginationListItemProps extends PrimitiveProps {
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { useForwardExpose } from '@robonen/vue';
|
||||
import { Primitive } from '@/primitive';
|
||||
import { computed } from 'vue';
|
||||
import { injectPaginationContext } from './context';
|
||||
import { useForwardExpose } from '@robonen/vue';
|
||||
|
||||
const { as = 'button' as const, value } = defineProps<PaginationListItemProps>();
|
||||
|
||||
@@ -18,19 +18,18 @@ const { forwardRef } = useForwardExpose();
|
||||
const ctx = injectPaginationContext();
|
||||
|
||||
const isSelected = computed(() => ctx.currentPage.value === value);
|
||||
const disabled = computed(() => ctx.disabled.value);
|
||||
|
||||
const attrs = computed(() => ({
|
||||
'data-type': 'page',
|
||||
'aria-label': `Page ${value}`,
|
||||
'aria-current': isSelected.value ? 'page' as const : undefined,
|
||||
'data-selected': isSelected.value ? 'true' : undefined,
|
||||
disabled: disabled.value,
|
||||
disabled: ctx.disabled.value,
|
||||
type: as === 'button' ? 'button' as const : undefined,
|
||||
}));
|
||||
|
||||
function handleClick() {
|
||||
if (!disabled.value) {
|
||||
if (!ctx.disabled.value) {
|
||||
ctx.onPageChange(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@ export interface PaginationNextProps extends PrimitiveProps {}
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { useForwardExpose } from '@robonen/vue';
|
||||
import { Primitive } from '@/primitive';
|
||||
import { computed } from 'vue';
|
||||
import { injectPaginationContext } from './context';
|
||||
import { useForwardExpose } from '@robonen/vue';
|
||||
|
||||
const { as = 'button' as const } = defineProps<PaginationNextProps>();
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@ export interface PaginationPrevProps extends PrimitiveProps {}
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { useForwardExpose } from '@robonen/vue';
|
||||
import { Primitive } from '@/primitive';
|
||||
import { computed } from 'vue';
|
||||
import { injectPaginationContext } from './context';
|
||||
import { useForwardExpose } from '@robonen/vue';
|
||||
|
||||
const { as = 'button' as const } = defineProps<PaginationPrevProps>();
|
||||
|
||||
|
||||
@@ -12,10 +12,10 @@ export interface PaginationRootProps extends PrimitiveProps {
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { toRef } from 'vue';
|
||||
import { useForwardExpose, useOffsetPagination } from '@robonen/vue';
|
||||
import { Primitive } from '@/primitive';
|
||||
import { providePaginationContext } from './context';
|
||||
import { toRef } from 'vue';
|
||||
|
||||
const {
|
||||
as = 'nav' as const,
|
||||
|
||||
Reference in New Issue
Block a user