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:
2026-06-07 16:29:56 +07:00
parent c7644ade69
commit 626fbc70d8
408 changed files with 27367 additions and 154 deletions
@@ -0,0 +1,43 @@
<script lang="ts">
import type { PrimitiveProps } from '../primitive';
export interface CalendarCellProps extends PrimitiveProps {
/** The date this cell represents. */
date: Date;
}
</script>
<script setup lang="ts">
import { computed } from 'vue';
import { Primitive } from '../primitive';
import { useCalendarGridContext, useCalendarRootContext } from './context';
import { isSameDay, isSameMonth } from './utils';
const { as = 'td', date } = defineProps<CalendarCellProps>();
const ctx = useCalendarRootContext();
const gridCtx = useCalendarGridContext();
const isSelected = computed(() => ctx.isDateSelected(date));
const isDisabled = computed(() => ctx.isDateDisabled(date));
const isUnavailable = computed(() => ctx.isDateUnavailable(date));
const isOutsideView = computed(() => !isSameMonth(date, gridCtx.month.value));
const isToday = computed(() => isSameDay(date, new Date()));
</script>
<template>
<Primitive
:as="as"
role="gridcell"
:aria-selected="isSelected ? true : undefined"
:aria-disabled="(isDisabled || isUnavailable) ? true : undefined"
:data-primitives-calendar-cell="''"
:data-selected="isSelected ? '' : undefined"
:data-disabled="isDisabled ? '' : undefined"
:data-unavailable="isUnavailable ? '' : undefined"
:data-outside-view="isOutsideView ? '' : undefined"
:data-today="isToday ? '' : undefined"
>
<slot />
</Primitive>
</template>