Input
Base 单行文本控件:宿主协同编辑、值所有权和真实 RuntimeBox。
Base Input 当前仍为 draft。本页展示真实 base-input-root 在同一 Web host 上的 Web Components、React、Vue 3 与 Vue 2 演示,不代表原生宿主或所有浏览器已经完成 conformance。
Root 通过 Text Control requirement 拥有一个 single-line plain-text editor。当前 Web profile 每个实例只 materialize 一个原生 input[type="text"];原型 renderer 返回 null,不另建编辑器或 authored children surface。Base 没有视觉样式;演示中的排版、说明和受控值接纳属于应用。
值与编辑所有权
Section titled “值与编辑所有权”defaultValue只初始化非受控值。用户编辑后,无关 props 更新不会把它重置为默认值。value选择受控模式。编辑产生归一化提案,owner 接纳并回传value后才成为权威值;演示第二个 Input 的 owner 会接纳提案。所有权模式在实例创建时确定,不在生命周期中切换。valueChange携带{ value, composing, data, inputType },change携带{ value }。IME 的compositionStart、compositionUpdate、compositionEnd携带{ value, data };组合候选由宿主编辑会话维护。
同一个物理目标
Section titled “同一个物理目标”disabled、readOnly、placeholder、required、name、autoComplete、minLength、maxLength、inputMode 与 enterKeyHint 投影到同一个 Input。
ariaLabel、labelledBy、describedBy 为该 textbox 提供命名与描述。Expose 提供 focusSelf()、blurSelf(),以及 value、disabled、readOnly、focused、focusVisible、composing state。
从 @proto.ui/prototypes-base/input 导入默认 Root、inputRoot 或 asInputRoot;后者复用相同冻结 single-line requirement。
Base 不拥有任意 type、submit/search/send command、表单提交、验证 UI、selection API、系统 selection/edit-menu chrome 或第二个 editor。Enter 仍归宿主/表单 owner;inputMode 和 enterKeyHint 是编辑提示,不是新增输入类型或命令。Shadcn 的视觉投影另见 Shadcn Input。
- 规范:P-BASE-INPUT
- 契约:C-TEXT-CONTROL-0001
- 实现与测试:Base Input、input.test.ts