Merge Select migration and browser verification

# Conflicts:
#	AGENTS.md
#	docs/migration-handoff.md
#	docs/upstream.md
#	docs/verification.md
#	package.json
#	packages/styles/src/index.ts
#	packages/vue/src/index.ts
#	packages/vue/src/types.ts
#	tests/package/README.md
This commit is contained in:
maoyingjie
2026-10-23 23:00:28 +08:00
54 changed files with 4347 additions and 34 deletions
+2
View File
@@ -19,3 +19,5 @@ M30–M32 增加 consume-m30-m32.mjs 和 m30-m32-contract.ts。将它们复制
LISTBOX-01 增加 `consume-list-box.mjs` / `list-box-contract.ts`。同样复制到独立消费者,用两份新 tarball 安装后运行脚本,并在 NodeNext / bundler 两种模式执行契约文件。Root 的泛型 Props 曾在 Parameters 提取后退化,非法模型/模式反例与事件参数推断必须保留。
M33–M34 使用 consume-m33-m34.mjs / m33-m34-contract.ts;同样复制到独立 tarball 消费工程,分别运行 node 与两种解析模式的 tsc。包括所有公开部件、真正 node SSR、CSS 关键帧与策略/尺寸/方向的正反类型检查。集成验证目录为 /private/tmp/heroui-m33-consumer,不复用其他并行任务的临时产物。
SELECT-01 增加 `consume-select.mjs` / `select-contract.ts`。新 tarball 安装后运行 ESM/SSR/CSS 脚本,两种模块解析模式都纳入类型正反例;数字/字符串/空 key、六部件、validate 与事件载荷推断不应退化。保留旧组件消费回归。
+70
View File
@@ -0,0 +1,70 @@
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { createSSRApp, h } from "vue";
import { renderToString } from "@vue/server-renderer";
import {
Select,
SelectTrigger,
SelectValue,
SelectIndicator,
SelectClearButton,
SelectPopover,
ListBox,
ListBoxItem,
Label,
selectVariants,
} from "@heroui-vue/components";
const html = await renderToString(
createSSRApp({
render: () =>
h(
Select,
{
defaultValue: [0, "0", ""],
selectionMode: "multiple",
name: "choices",
},
() => [
h(Label, {}, () => "Choice"),
h(SelectTrigger, {}, () => [
h(SelectValue),
h(SelectClearButton),
h(SelectIndicator),
]),
h(SelectPopover, {}, () =>
h(ListBox, {}, () => [
h(ListBoxItem, { id: 0, textValue: "Numeric" }, () => "Numeric"),
h(ListBoxItem, { id: "0", textValue: "String" }, () => "String"),
h(ListBoxItem, { id: "", textValue: "Empty" }, () => "Empty"),
]),
),
],
),
}),
);
assert(html.includes("Numeric, String, Empty"));
assert(html.includes('name="choices"'));
assert.equal((html.match(/data-index="\d" selected/g) ?? []).length, 3);
assert(!html.includes('role="listbox"'));
assert(html.includes('aria-haspopup="listbox"'));
assert(
selectVariants({ variant: "secondary" })
.base()
.includes("hv-select--secondary"),
);
const css = readFileSync(
new URL(import.meta.resolve("@heroui-vue/styles/css")),
"utf8",
);
for (const part of [
".hv-select",
".hv-select__trigger",
".hv-select__value",
".hv-select__clear-button",
".hv-select__indicator",
".hv-select__popover",
])
assert(css.includes(part));
console.log(
"Select independent tarball: ESM, SSR labels, raw native values, variants and CSS passed.",
);
+77
View File
@@ -0,0 +1,77 @@
import {
Select,
SelectRoot,
SelectTrigger,
SelectValue,
SelectIndicator,
SelectClearButton,
SelectPopover,
selectVariants,
type SelectProps,
type SelectValueProps,
type SelectPopoverProps,
type SelectModelValue,
} from "@heroui-vue/components";
const value: SelectModelValue = [0, "0", ""];
const props: SelectProps = {
modelValue: value,
selectionMode: "multiple",
variant: "secondary",
autoComplete: "country",
items: [{ id: 0, textValue: "Zero" }],
onChange: (next) => {
if (Array.isArray(next)) next.forEach((key) => String(key));
},
validate: (next) => (next === null ? "Required" : undefined),
onOpenChange: (open) => Boolean(open),
};
const part: SelectValueProps = { as: "span" };
const popup: SelectPopoverProps = { placement: "bottom start", offset: 8 };
// @ts-expect-error Keys are strings or numbers, never objects
const badValue: SelectProps = { modelValue: { id: 0 } };
// @ts-expect-error Selection mode is constrained
const badMode: SelectProps = { selectionMode: "checkbox" };
// @ts-expect-error Variants are constrained
const badVariant: SelectProps = { variant: "solid" };
// @ts-expect-error Metadata text is required
const badItems: SelectProps = { items: [{ id: 0 }] };
// @ts-expect-error Model listener receives SelectModelValue, not boolean
const badEvent: SelectProps = { onChange: (value: boolean) => value };
// @ts-expect-error Popover placement is constrained
const badPlacement: SelectPopoverProps = { placement: "diagonal" };
const badComponent: InstanceType<typeof Select>["$props"] = {
// @ts-expect-error Generated component props are also constrained
modelValue: [false],
};
void [
Select,
SelectRoot,
SelectTrigger,
SelectValue,
SelectIndicator,
SelectClearButton,
SelectPopover,
selectVariants,
props,
part,
popup,
badValue,
badMode,
badVariant,
badItems,
badEvent,
badPlacement,
badComponent,
];
type RootSlot = Parameters<
NonNullable<InstanceType<typeof Select>["$slots"]["default"]>
>[0];
const slotState: RootSlot = {
value: 0,
isOpen: false,
selectedItems: [{ key: 0, textValue: "Zero" }],
};
const selectedKey: string | number = slotState.selectedItems[0].key;
// @ts-expect-error Root scoped slot keys must retain their actual type
const booleanKey: boolean = slotState.selectedItems[0].key;
void [selectedKey, booleanKey];