weifuwu 0.35.0 → 0.35.1

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.
@@ -11,7 +11,13 @@ var jsxs = jsx;
11
11
  function jsxDEV(type, props, key) {
12
12
  return jsx(type, props, key);
13
13
  }
14
- var h = jsx;
14
+ function h(type, props, ...children) {
15
+ const p = normalizeProps(props ?? {});
16
+ if (children.length > 0) {
17
+ p.children = children.length === 1 ? children[0] : children;
18
+ }
19
+ return { type, props: p, key: props?.key ?? void 0 };
20
+ }
15
21
  function normalizeProps(props) {
16
22
  if (!props) return {};
17
23
  const result = {};
@@ -32,7 +32,8 @@ declare global {
32
32
  export declare function jsx(type: VNodeType, props: Record<string, any> | null, key?: string | null): VNode;
33
33
  export declare const jsxs: typeof jsx;
34
34
  export declare function jsxDEV(type: VNodeType, props: Record<string, any> | null, key?: string | null): VNode;
35
- export declare const h: typeof jsx;
35
+ /** `h`(hyperscript)支持 variadic children: `h('div', {class:'x'}, child1, child2)` */
36
+ export declare function h(type: VNodeType, props: Record<string, any> | null, ...children: any[]): VNode;
36
37
  export declare function isNative(vnode: VNode): boolean;
37
38
  export declare function isComponent(vnode: VNode): boolean;
38
39
  export declare function isFragment(vnode: VNode): boolean;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weifuwu",
3
3
  "type": "module",
4
- "version": "0.35.0",
4
+ "version": "0.35.1",
5
5
  "description": "AI SaaS framework — (req, ctx) => Response",
6
6
  "exports": {
7
7
  ".": {