@manohub/ui 1.0.9 → 1.0.10
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defineComponent, createVNode, h } from "vue";
|
|
2
|
+
import { flattenChildren } from "../../utils/vnode-children.js";
|
|
2
3
|
const isBlank = (value) => value === void 0 || value === null || value === false || value === "";
|
|
3
4
|
function resolveSlot(slotFn, propValue, transform) {
|
|
4
5
|
if (slotFn) return slotFn();
|
|
@@ -144,7 +145,6 @@ const CardFooter = /* @__PURE__ */ defineComponent({
|
|
|
144
145
|
}
|
|
145
146
|
});
|
|
146
147
|
const isCardPart = (child) => !!child && typeof child === "object" && (child.type === CardHeader || child.type === CardBody || child.type === CardFooter);
|
|
147
|
-
const flattenChildren = (raw) => (Array.isArray(raw) ? raw : raw == null ? [] : [raw]).flatMap((child) => Array.isArray(child) ? child : [child]).filter((child) => child !== null && child !== void 0 && child !== false && child !== true && child !== "");
|
|
148
148
|
function withImplicitBody(children) {
|
|
149
149
|
const out = [];
|
|
150
150
|
let loose = [];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { defineComponent, ref, createVNode } from "vue";
|
|
2
2
|
import { TabBar } from "../tabbar/index.js";
|
|
3
|
+
import { flattenChildren } from "../../utils/vnode-children.js";
|
|
3
4
|
const TabPanel = /* @__PURE__ */ defineComponent({
|
|
4
5
|
name: "TabPanel",
|
|
5
6
|
/* 渲染的是插槽内容(片段根),属性无处可继承 —— 壳归 `Tabs`,属性由它在渲染期搬过去 */
|
|
@@ -29,7 +30,6 @@ const TabPanel = /* @__PURE__ */ defineComponent({
|
|
|
29
30
|
return () => slots.default?.() ?? null;
|
|
30
31
|
}
|
|
31
32
|
});
|
|
32
|
-
const flattenChildren = (raw) => (Array.isArray(raw) ? raw : raw == null ? [] : [raw]).flatMap((child) => Array.isArray(child) ? child : [child]).filter((child) => child !== null && child !== void 0 && child !== false && child !== true && child !== "");
|
|
33
33
|
const isTabPanel = (child) => !!child && typeof child === "object" && child.type === TabPanel;
|
|
34
34
|
const panelPropsOf = (child) => isTabPanel(child) ? child.props ?? {} : null;
|
|
35
35
|
const Tabs = /* @__PURE__ */ defineComponent({
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type VNodeChild } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* 摊平插槽子节点:**多层数组与 `Fragment` 都拆开**,并去掉 Vue 不渲染的空值
|
|
4
|
+
* (`null` / `undefined` / 布尔量 / 空串 —— 留着会凭空多出一段)。
|
|
5
|
+
*
|
|
6
|
+
* `v-for`、JSX 表达式子节点(`{list.map(…)}`)与数组字面量经 Vue 归一化后都是 `[Fragment(…)]`
|
|
7
|
+
* (`normalizeSlotValue` 把「数组套数组」折成了 Fragment)。组合件按**组件引用**认领分件,不拆开就一个也认不出,
|
|
8
|
+
* 而且不报错、不警告。
|
|
9
|
+
*/
|
|
10
|
+
export declare function flattenChildren(raw: VNodeChild): VNodeChild[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Fragment } from "vue";
|
|
2
|
+
const isFragment = (child) => !!child && typeof child === "object" && child.type === Fragment;
|
|
3
|
+
function flattenChildren(raw) {
|
|
4
|
+
const out = [];
|
|
5
|
+
const push = (child) => {
|
|
6
|
+
if (Array.isArray(child)) {
|
|
7
|
+
for (const item of child) {
|
|
8
|
+
push(item);
|
|
9
|
+
}
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if (isFragment(child)) {
|
|
13
|
+
push(child.children);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (child === null || child === void 0 || child === false || child === true || child === "") {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
out.push(child);
|
|
20
|
+
};
|
|
21
|
+
push(raw);
|
|
22
|
+
return out;
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
flattenChildren
|
|
26
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manohub/ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "AIHub 自绘组件层:不依赖 farris 的手写 Vue TSX 组件 + 自带令牌层(Farris 规范视觉 · daisyUI 式语义令牌 · shadcn 式 API 词汇)。",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"vue": "^3.5.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@manohub/icon": "^1.0.
|
|
38
|
+
"@manohub/icon": "^1.0.10"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/node": "^24.0.0",
|