weifuwu 0.81.0 → 0.81.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -31,8 +31,9 @@ export declare function classifyChild(c: VNodeChild): ChildKind;
31
31
  export declare function isInvalidVNodeType(t: unknown): boolean;
32
32
  /** 数组上下文:无渲染值(false/null/true)→ 占位(规则表 §1——childNodes 与数组同构) */
33
33
  export declare function isHoleChild(c: VNodeChild): boolean;
34
- /** 数组项必有 key(规则表 §3):无显式 key 的元素/组件项赋默认下标 key(数组原始下标含占位位置,
35
- * 统一字符串);文本/占位值豁免。原地写入 vnode.key(声明规则,非隐藏 magic) */
34
+ /** 数组项 key 规范化(key 业务身份声明协议——design 归档):显式 key 仅字符串化(统一字符串);
35
+ * 无 key 项保持 null(框架不生成身份 key——位置身份由 patch 的 prepPos 显式接管混合数组)。
36
+ * 文本/占位值豁免。原地写入 vnode.key(声明规则,非隐藏 magic) */
36
37
  export declare function ensureArrayKeys(children: VNodeChild[]): void;
37
38
  /** 事件 prop 判定:on + 大写字母(React 约定)——排除 once/only 等 on 开头非事件属性 */
38
39
  export declare const EVENT_RE: RegExp;
@@ -46,8 +47,27 @@ export declare function eventTarget(key: string): {
46
47
  export declare const ENUMERATED_VALUE_BASED: Set<string>;
47
48
  /** CSS 无单位属性(数字不加 px)——其余数字样式属性必须加 px(规则表 §2 UNITLESS 白名单) */
48
49
  export declare const UNITLESS_PROPS: Set<string>;
50
+ /** 属性通道分类(单一判定源——setProp/patchProps/x2html 共用;规则表 §2 属性三通道):
51
+ * - enumerated :value-based 枚举属性(draggable 等——空字符串解析为 false,必须显式 'true'/'false')
52
+ * - class :class/className(字符串/对象形态)
53
+ * - style :style(字符串/对象形态)
54
+ * - ref :ref 回调(挂载调用 el / 卸载调用 null)
55
+ * - event :on + 大写(onClick/onClickCapture——事件通道)
56
+ * - value :input/select value(property)
57
+ * - indeterminate:checkbox 半选态(property——attribute 解析为 false)
58
+ * - innerHTML :innerHTML 内容(存在则 children 不渲染)
59
+ * - aria :aria-* 语义属性(boolean 必须显式 'true'/'false')
60
+ * - default :其余——property + attribute 双写 */
61
+ export type PropChannel = 'enumerated' | 'class' | 'style' | 'ref' | 'event' | 'value' | 'indeterminate' | 'innerHTML' | 'aria' | 'default';
62
+ /** 属性通道判定(key 分类——值判断留在各通道处理函数内,规则表 §2) */
63
+ export declare function propChannelOf(key: string): PropChannel;
64
+ type SetPropFn = (el: Element, key: string, value: any) => void;
65
+ /** 属性设置状态机表(通道 → 设置行为——setProp 查表分派,无 if/else 通道链) */
66
+ export declare const PROP_SETTERS: Record<PropChannel, SetPropFn>;
67
+ /** 属性设置(查表分派——PROP_SETTERS[propChannelOf(key)]) */
49
68
  export declare function setProp(el: Element, key: string, value: any): void;
50
69
  /** 占位内容(规则表 §1——wf-hole 内容可见可审计:false/null/undefined/true/对象摘要/bad-vnode) */
51
70
  /** 创建占位节点(数组上下文的无渲染值 → 注释节点,childNodes 与数组同构——规则表 §1) */
52
71
  export declare function createHole(browser: BrowserEnv, v: unknown): Node | null;
72
+ export {};
53
73
  /** 递归渲染(同步——组件必须已构建) */
@@ -17,7 +17,8 @@ import { type PatchState, type VKind } from './kind.ts';
17
17
  import { type PatchCtx } from './patch.ts';
18
18
  type TransitionFn = (s: PatchState) => Node | null;
19
19
  export declare const TRANSITIONS: Record<VKind, Record<VKind, TransitionFn>>;
20
- /** x2y 状态机分派:由源类型(oldInput)与目标类型(newInput)查表调用转换函数 */
20
+ /** x2y 状态机分派:由源类型(oldInput)与目标类型(newInput)查表调用转换函数
21
+ * 转换事件:machine=x2y(from=旧 kind,to=新 kind)——过程级可观测 */
21
22
  export declare function x2y(s: PatchState): Node | null;
22
23
  export type { PatchCtx };
23
24
  export { Fragment, Portal };
@@ -12,6 +12,7 @@
12
12
  */
13
13
  import type { VNodeChild } from '../vnode.ts';
14
14
  import { isFrag, isComp, isPortal, isNative, Fragment, Portal } from '../vnode.ts';
15
+ import { type VKind } from './kind.ts';
15
16
  export declare function escape(s: string): string;
16
17
  type HtmlCtx = {
17
18
  _fidPath?: string;
@@ -19,5 +20,7 @@ type HtmlCtx = {
19
20
  };
20
21
  /** vnode → HTML(SSR)——类型分派主入口 */
21
22
  export declare function x2html(input: VNodeChild, ctx: HtmlCtx): Promise<string>;
23
+ /** 类型分派表(与客户端 renderValue 同一 classifyKind——SSR/客户端结构同构) */
24
+ export declare const TO_HTML: Record<VKind, (v: VNodeChild, ctx: HtmlCtx) => Promise<string>>;
22
25
  export { Fragment, Portal };
23
26
  export { isFrag, isComp, isPortal, isNative };
@@ -13,6 +13,7 @@
13
13
  */
14
14
  export type VNodeType = string | Component<any, any> | typeof Fragment | typeof Portal;
15
15
  export type VNodeChild = VNode | string | number | boolean | null | undefined | VNodeChild[];
16
+ import type { Lifecycle } from './vdom2/lifecycle.ts';
16
17
  export declare const Fragment: unique symbol;
17
18
  export declare const Portal: unique symbol;
18
19
  /** 通用字段(所有 VNode 共有——构建元数据;渲染前为 null 的显式初始化) */
@@ -34,6 +35,10 @@ interface VNodeBase {
34
35
  _parentVNode: VNode | null;
35
36
  /** 组件 renderFn 上次执行时的 ctx 版本号(buildVNode 剪枝 + diff 三态 skip) */
36
37
  _ctxVersion: number | null;
38
+ /** 生命周期状态(节点生命周期状态机——lifecycle.ts):fresh→building→built / pruned;dispose→disposed */
39
+ _lifecycle: Lifecycle;
40
+ /** 渲染调度状态(render 调度状态机:IDLE/RUNNING——渲染中再次触发跳过,防重入) */
41
+ _rendering?: boolean;
37
42
  }
38
43
  /** 原生元素——type: string;特有:el(元素引用——锚点统一用 _refNode) */
39
44
  export interface NativeVNode extends VNodeBase {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weifuwu",
3
3
  "type": "module",
4
- "version": "0.81.0",
4
+ "version": "0.81.2",
5
5
  "description": "AI SaaS framework — (req, ctx) => Response",
6
6
  "exports": {
7
7
  ".": {