feat(collections): auto incremental async loading, shared filtering and submenu delay

HD-10 scope, against heroui ce90ea3 collection sources and their
react-aria/react-stately dependencies:

- the ComboBox async demo now auto-loads on scroll-to-bottom
  (IntersectionObserver sentinel + fill chain mirroring the pinned
  ListBoxLoadMoreItem re-observe semantics), never duplicates requests
  (loading guards + monotonic sequence token), drops stale responses on
  query switches, keeps a retry path for failures (injectable mock
  failure) and documents its differences from the pinned SWAPI source;
  the Select demo's observer stays untouched (real-network scroll
  triggering verified in browser)
- the Autocomplete virtualization demo and the default filter share one
  locale-sensitive matcher: createBaseContains (Intl.Collator base
  sensitivity, cafe matches Cafe with accent folding) is now exported
  from the package root
- Autocomplete trigger semantics verified complete (single tab stop,
  Enter/Space/Escape/Delete/IME, single and multiple selection) and the
  scoped slots gained composition data instead of child copying:
  AutocompleteValue exposes selectedItem and per-entry source item,
  the ComboBox root exposes selectedItem
- DropdownSubmenuTrigger exposes the pinned delay contract (default
  200ms): the controlled open gate retimes Reka's fixed 100ms hover,
  keyboard opens stay immediate and cancel the pending hover, pointer
  leave cancels; the dead side/align forwarding is gone (Reka fixes the
  submenu side per direction); Button/Avatar trigger layout
  compensation kept after browser proof it is what wins the cascade
- tests/fixtures/collections-rtl.vue drives the real-browser delay and
  RTL geometry checks; b02-pickers contract pins the new export and
  slot typing

Full suite 111 files / 1666 tests, typecheck, build:docs and the
b02-pickers + api-root-aliases tarball contracts pass.
This commit is contained in:
maoyingjie
2026-10-29 13:46:13 +08:00
parent c34faccd70
commit c8d54abefb
21 changed files with 1020 additions and 173 deletions
+88
View File
@@ -0,0 +1,88 @@
<script setup lang="ts">
import { computed, defineComponent, h, ref } from "vue";
import {
Button,
ConfigProvider,
DropdownItem,
DropdownMenu,
DropdownPopover,
DropdownRoot,
DropdownSubmenuIndicator,
DropdownSubmenuTrigger,
DropdownTrigger,
Label,
useLocale,
} from "@heroui-vue/components";
/**
* HD-10 submenu verification harness: the pinned RTL behaviour (submenu flips
* to the left of its trigger) and the configurable hover delay, driven through
* the public ConfigProvider direction contract.
*/
const rtl = ref(true);
const opened = ref(0);
const localeDir = useLocale().dir;
const probe = computed(() => `outer-dir=${localeDir.value}`);
const InnerProbe = defineComponent({
setup() {
const dir = useLocale().dir;
return () =>
h("output", { "data-probe-inner": "" }, `inner-dir=${dir.value}`);
},
});
</script>
<template>
<main style="padding: 24px; display: grid; gap: 16px; justify-items: center">
<label>
<input v-model="rtl" type="checkbox" />
RTL(ConfigProvider dir)
</label>
<output data-probe>{{ probe }}</output>
<ConfigProvider :dir="rtl ? 'rtl' : 'ltr'">
<InnerProbe />
<div style="width: 700px; display: flex; justify-content: center">
<DropdownRoot :dir="rtl ? 'rtl' : 'ltr'" @open-change="opened++">
<DropdownTrigger>
<Button aria-label="菜单">菜单</Button>
</DropdownTrigger>
<DropdownPopover>
<DropdownMenu aria-label="示例菜单">
<DropdownItem id="copy" text-value="复制">
<Label>复制</Label>
</DropdownItem>
<!-- Baseline default delay: 200ms. -->
<DropdownSubmenuTrigger>
<DropdownItem id="share" text-value="分享">
<Label>分享(默认延迟)</Label>
<DropdownSubmenuIndicator />
</DropdownItem>
<DropdownPopover>
<DropdownMenu aria-label="分享">
<DropdownItem id="mail" text-value="邮件">
<Label>邮件</Label>
</DropdownItem>
</DropdownMenu>
</DropdownPopover>
</DropdownSubmenuTrigger>
<!-- Custom delay: 600ms. -->
<DropdownSubmenuTrigger :delay="600">
<DropdownItem id="more" text-value="更多">
<Label>更多(600ms 延迟)</Label>
<DropdownSubmenuIndicator />
</DropdownItem>
<DropdownPopover>
<DropdownMenu aria-label="更多">
<DropdownItem id="report" text-value="举报">
<Label>举报</Label>
</DropdownItem>
</DropdownMenu>
</DropdownPopover>
</DropdownSubmenuTrigger>
</DropdownMenu>
</DropdownPopover>
</DropdownRoot>
</div>
</ConfigProvider>
</main>
</template>