weifuwu 0.77.0 → 0.79.0
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.
- package/README.md +8 -6
- package/dist/components/AlertGroup/AlertGroup.d.ts +1 -1
- package/dist/components/Anchor/Anchor.d.ts +1 -1
- package/dist/components/AuthPage/AuthPage.d.ts +36 -0
- package/dist/components/AutoComplete/AutoComplete.d.ts +3 -1
- package/dist/components/AvatarGroup/AvatarGroup.d.ts +1 -1
- package/dist/components/Calendar/Calendar.d.ts +1 -1
- package/dist/components/Carousel/Carousel.d.ts +1 -1
- package/dist/components/Cascader/Cascader.d.ts +1 -1
- package/dist/components/ChatInput/ChatInput.d.ts +51 -0
- package/dist/components/ColorPicker/ColorPicker.d.ts +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +2 -0
- package/dist/components/FloatButton/FloatButton.d.ts +1 -1
- package/dist/components/Grid/Grid.d.ts +1 -1
- package/dist/components/InputNumber/InputNumber.d.ts +1 -1
- package/dist/components/JSONViewer/JSONViewer.d.ts +1 -1
- package/dist/components/Link/Link.d.ts +1 -1
- package/dist/components/List/List.d.ts +3 -0
- package/dist/components/LogViewer/LogViewer.d.ts +1 -1
- package/dist/components/Markdown/parser.d.ts +1 -1
- package/dist/components/Mentions/Mentions.d.ts +1 -1
- package/dist/components/Menu/Menu.d.ts +1 -1
- package/dist/components/Menubar/Menubar.d.ts +1 -1
- package/dist/components/MessageBubble/MessageBubble.d.ts +1 -1
- package/dist/components/NavMenu/NavMenu.d.ts +1 -1
- package/dist/components/Popconfirm/Popconfirm.d.ts +1 -1
- package/dist/components/Result/Result.d.ts +1 -1
- package/dist/components/Scrollbar/Scrollbar.d.ts +1 -1
- package/dist/components/SearchInput/SearchInput.d.ts +1 -0
- package/dist/components/Slider/Slider.d.ts +1 -0
- package/dist/components/TagsInput/TagsInput.d.ts +1 -1
- package/dist/components/Timeline/Timeline.d.ts +1 -1
- package/dist/components/Transfer/Transfer.d.ts +1 -1
- package/dist/components/TreeSelect/TreeSelect.d.ts +2 -0
- package/dist/components/VirtualList/VirtualList.d.ts +3 -1
- package/dist/components/VirtualTable/VirtualTable.d.ts +1 -1
- package/dist/components/Watermark/Watermark.d.ts +1 -1
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +12 -12
- package/dist/components/style.css +77 -23
- package/dist/index.js +74 -3
- package/dist/ui-dom/index.js +11 -11
- package/dist/ui-dom/jsx-runtime.js +1 -1
- package/dist/ui-dom/testing.js +1 -1
- package/dist/ui-dom/types.d.ts +2 -0
- package/dist/ui-dom/vdom/audit.d.ts +20 -0
- package/dist/ui-dom/vdom/diff.d.ts +3 -7
- package/dist/ui-dom/vdom/render.d.ts +5 -3
- package/dist/ui-dom/vdom/transform.d.ts +47 -0
- package/dist/ui-dom/vnode.d.ts +8 -1
- package/docs/components-map.md +3 -1
- package/docs/components.md +7 -4
- package/docs/custom-components.md +8 -0
- package/docs/frontend-ui-dom.md +1 -0
- package/package.json +1 -1
|
@@ -1783,29 +1783,6 @@ body.wf-dragging {
|
|
|
1783
1783
|
padding: var(--wf-space-sm);
|
|
1784
1784
|
}
|
|
1785
1785
|
|
|
1786
|
-
.wf-aichat-inputbar {
|
|
1787
|
-
display: flex;
|
|
1788
|
-
gap: var(--wf-gap-sm);
|
|
1789
|
-
align-items: center;
|
|
1790
|
-
}
|
|
1791
|
-
|
|
1792
|
-
.wf-aichat-input {
|
|
1793
|
-
flex: 1;
|
|
1794
|
-
min-width: 0;
|
|
1795
|
-
height: var(--wf-control-height);
|
|
1796
|
-
padding: var(--wf-control-pad-y) var(--wf-space-md);
|
|
1797
|
-
border: 1px solid var(--wf-color-border);
|
|
1798
|
-
border-radius: var(--wf-radius);
|
|
1799
|
-
font-family: var(--wf-font-sans);
|
|
1800
|
-
font-size: var(--wf-font-size-sm);
|
|
1801
|
-
color: var(--wf-color-text);
|
|
1802
|
-
background: var(--wf-color-bg);
|
|
1803
|
-
}
|
|
1804
|
-
|
|
1805
|
-
.wf-aichat-input:focus {
|
|
1806
|
-
outline: none;
|
|
1807
|
-
border-color: var(--wf-color-primary);
|
|
1808
|
-
}
|
|
1809
1786
|
|
|
1810
1787
|
/* weifuwu/components — Alert */
|
|
1811
1788
|
|
|
@@ -2130,6 +2107,10 @@ body.wf-dragging {
|
|
|
2130
2107
|
color: var(--wf-color-primary-text);
|
|
2131
2108
|
}
|
|
2132
2109
|
|
|
2110
|
+
/* error(F2 状态矩阵) */
|
|
2111
|
+
.wf-autocomplete-input--err { border-color: var(--wf-color-error); }
|
|
2112
|
+
.wf-autocomplete-input--err:focus { box-shadow: 0 0 0 2px var(--wf-color-error-bg), 0 0 0 1px var(--wf-color-error); }
|
|
2113
|
+
|
|
2133
2114
|
/* weifuwu/components — Avatar */
|
|
2134
2115
|
|
|
2135
2116
|
.wf-avatar {
|
|
@@ -2853,6 +2834,12 @@ body.wf-dragging {
|
|
|
2853
2834
|
text-align: center;
|
|
2854
2835
|
}
|
|
2855
2836
|
|
|
2837
|
+
/* 键盘高亮(R43 W1):与 hover 同视觉,但独立 class(键盘导航可见性) */
|
|
2838
|
+
.wf-cascader-opt--hl {
|
|
2839
|
+
background: var(--wf-color-primary-bg);
|
|
2840
|
+
color: var(--wf-color-primary-text);
|
|
2841
|
+
}
|
|
2842
|
+
|
|
2856
2843
|
/* weifuwu/components — Chart */
|
|
2857
2844
|
|
|
2858
2845
|
.wf-chart {
|
|
@@ -2921,6 +2908,43 @@ body.wf-dragging {
|
|
|
2921
2908
|
opacity: 0.8;
|
|
2922
2909
|
}
|
|
2923
2910
|
|
|
2911
|
+
/* weifuwu/components — ChatInput(独立聊天输入条——从 AiChat 输入条抽取) */
|
|
2912
|
+
|
|
2913
|
+
.wf-chat-inputbar {
|
|
2914
|
+
display: flex;
|
|
2915
|
+
gap: var(--wf-gap-sm);
|
|
2916
|
+
align-items: center;
|
|
2917
|
+
}
|
|
2918
|
+
|
|
2919
|
+
.wf-chat-input {
|
|
2920
|
+
flex: 1;
|
|
2921
|
+
min-width: 0;
|
|
2922
|
+
height: var(--wf-control-height);
|
|
2923
|
+
padding: var(--wf-control-pad-y) var(--wf-space-md);
|
|
2924
|
+
border: 1px solid var(--wf-color-border);
|
|
2925
|
+
border-radius: var(--wf-radius);
|
|
2926
|
+
font-family: var(--wf-font-sans);
|
|
2927
|
+
font-size: var(--wf-font-size-sm);
|
|
2928
|
+
color: var(--wf-color-text);
|
|
2929
|
+
background: var(--wf-color-bg);
|
|
2930
|
+
}
|
|
2931
|
+
|
|
2932
|
+
.wf-chat-input:focus {
|
|
2933
|
+
outline: none;
|
|
2934
|
+
border-color: var(--wf-color-primary);
|
|
2935
|
+
}
|
|
2936
|
+
|
|
2937
|
+
.wf-chat-input:hover:not(:disabled) {
|
|
2938
|
+
border-color: var(--wf-color-primary-muted, var(--wf-color-primary));
|
|
2939
|
+
}
|
|
2940
|
+
|
|
2941
|
+
/* 多行 textarea:自适应高度(行数由内容撑开) */
|
|
2942
|
+
.wf-chat-inputbar textarea.wf-chat-input {
|
|
2943
|
+
height: auto;
|
|
2944
|
+
min-height: var(--wf-control-height);
|
|
2945
|
+
line-height: 1.5;
|
|
2946
|
+
}
|
|
2947
|
+
|
|
2924
2948
|
/* weifuwu/components — Checkbox */
|
|
2925
2949
|
|
|
2926
2950
|
.wf-checkbox {
|
|
@@ -3970,6 +3994,10 @@ body.wf-dragging {
|
|
|
3970
3994
|
overflow-x: auto;
|
|
3971
3995
|
}
|
|
3972
3996
|
|
|
3997
|
+
/* error(F2 状态矩阵) */
|
|
3998
|
+
.wf-datepicker-input--err { border-color: var(--wf-color-error); }
|
|
3999
|
+
.wf-datepicker-input--err:focus { box-shadow: 0 0 0 2px var(--wf-color-error-bg), 0 0 0 1px var(--wf-color-error); }
|
|
4000
|
+
|
|
3973
4001
|
/* weifuwu/components — Descriptions */
|
|
3974
4002
|
|
|
3975
4003
|
.wf-descriptions {
|
|
@@ -4379,6 +4407,12 @@ body.wf-dragging {
|
|
|
4379
4407
|
to { opacity: 1; }
|
|
4380
4408
|
}
|
|
4381
4409
|
|
|
4410
|
+
/* 键盘高亮(R43 W1):菜单方向键导航可见性 */
|
|
4411
|
+
.wf-dropdown-item--hl {
|
|
4412
|
+
background: var(--wf-color-primary-bg);
|
|
4413
|
+
color: var(--wf-color-primary-text);
|
|
4414
|
+
}
|
|
4415
|
+
|
|
4382
4416
|
/* weifuwu/components — Editor */
|
|
4383
4417
|
|
|
4384
4418
|
.wf-editor { position: relative;
|
|
@@ -7805,6 +7839,10 @@ body.wf-dragging {
|
|
|
7805
7839
|
color: var(--wf-color-text);
|
|
7806
7840
|
}
|
|
7807
7841
|
|
|
7842
|
+
/* disabled(F2 状态矩阵) */
|
|
7843
|
+
.wf-search-input--dis { opacity: 0.5; cursor: not-allowed; }
|
|
7844
|
+
.wf-search-input:disabled { cursor: not-allowed; }
|
|
7845
|
+
|
|
7808
7846
|
/* weifuwu/components — SegmentedControl */
|
|
7809
7847
|
|
|
7810
7848
|
.wf-segmented {
|
|
@@ -8372,6 +8410,10 @@ body.wf-dragging {
|
|
|
8372
8410
|
text-align: center;
|
|
8373
8411
|
}
|
|
8374
8412
|
|
|
8413
|
+
/* disabled(F2 状态矩阵) */
|
|
8414
|
+
.wf-slider-input--dis { opacity: 0.5; cursor: not-allowed; }
|
|
8415
|
+
.wf-slider-input:disabled { cursor: not-allowed; }
|
|
8416
|
+
|
|
8375
8417
|
/* weifuwu/components — Space 间距容器 */
|
|
8376
8418
|
|
|
8377
8419
|
.wf-space {
|
|
@@ -9936,6 +9978,11 @@ body.wf-dragging {
|
|
|
9936
9978
|
overflow: auto;
|
|
9937
9979
|
}
|
|
9938
9980
|
|
|
9981
|
+
/* disabled / error(F2 状态矩阵) */
|
|
9982
|
+
.wf-treeselect-trigger--dis { opacity: 0.5; cursor: not-allowed; background: var(--wf-color-fill); }
|
|
9983
|
+
.wf-treeselect-trigger--err { border-color: var(--wf-color-error); }
|
|
9984
|
+
.wf-treeselect-trigger--err:focus-visible { box-shadow: 0 0 0 2px var(--wf-color-error-bg), 0 0 0 1px var(--wf-color-error); }
|
|
9985
|
+
|
|
9939
9986
|
/* weifuwu/components — Typography */
|
|
9940
9987
|
|
|
9941
9988
|
.wf-title {
|
|
@@ -10028,6 +10075,13 @@ body.wf-dragging {
|
|
|
10028
10075
|
box-sizing: border-box;
|
|
10029
10076
|
}
|
|
10030
10077
|
|
|
10078
|
+
/* 空态(F2 状态矩阵) */
|
|
10079
|
+
.wf-virtual-list--empty {
|
|
10080
|
+
display: flex; align-items: center; justify-content: center;
|
|
10081
|
+
color: var(--wf-color-text-tertiary);
|
|
10082
|
+
font-size: var(--wf-font-size-sm);
|
|
10083
|
+
}
|
|
10084
|
+
|
|
10031
10085
|
/* weifuwu/components — VirtualTable(固定表头 + 虚拟滚动表体) */
|
|
10032
10086
|
|
|
10033
10087
|
.wf-virtual-table {
|
package/dist/index.js
CHANGED
|
@@ -3078,6 +3078,49 @@ var HtmlSafe = class {
|
|
|
3078
3078
|
var Fragment = /* @__PURE__ */ Symbol("Fragment");
|
|
3079
3079
|
var Portal = /* @__PURE__ */ Symbol("Portal");
|
|
3080
3080
|
|
|
3081
|
+
// src/ui-dom/vdom/transform.ts
|
|
3082
|
+
function holeDetail(v) {
|
|
3083
|
+
if (v === false) return "false";
|
|
3084
|
+
if (v === null) return "null";
|
|
3085
|
+
if (v === void 0) return "undefined";
|
|
3086
|
+
if (v === true) return "true";
|
|
3087
|
+
if (typeof v === "object") {
|
|
3088
|
+
try {
|
|
3089
|
+
const s = JSON.stringify(v);
|
|
3090
|
+
const d = s != null && s.length > 80 ? s.slice(0, 80) + "\u2026" : s ?? "";
|
|
3091
|
+
return `object ${d}`;
|
|
3092
|
+
} catch {
|
|
3093
|
+
return `object ${Object.prototype.toString.call(v)}`;
|
|
3094
|
+
}
|
|
3095
|
+
}
|
|
3096
|
+
return `bad-vnode type=${typeof v}`;
|
|
3097
|
+
}
|
|
3098
|
+
function quoteIfNeeded(s) {
|
|
3099
|
+
return /[\s"=]/.test(s) ? `"${s.replace(/"/g, "'")}"` : s;
|
|
3100
|
+
}
|
|
3101
|
+
function holeMarkup(opts) {
|
|
3102
|
+
const parts = [`type=${opts.type}`];
|
|
3103
|
+
if (opts.value !== void 0) parts.push(`value=${quoteIfNeeded(holeDetail(opts.value))}`);
|
|
3104
|
+
if (opts.key != null) parts.push(`key=${quoteIfNeeded(opts.key)}`);
|
|
3105
|
+
if (opts.id != null) parts.push(`id=${quoteIfNeeded(opts.id)}`);
|
|
3106
|
+
if (opts.fid != null) parts.push(`fid=${quoteIfNeeded(opts.fid)}`);
|
|
3107
|
+
return `wf-hole: ${parts.join(" ")}`;
|
|
3108
|
+
}
|
|
3109
|
+
function isInvalidVNodeType(t) {
|
|
3110
|
+
return typeof t !== "string" && typeof t !== "function" && t !== Fragment && t !== Portal;
|
|
3111
|
+
}
|
|
3112
|
+
function ensureArrayKeys(children) {
|
|
3113
|
+
for (let i = 0; i < children.length; i++) {
|
|
3114
|
+
const c = children[i];
|
|
3115
|
+
if (c != null && typeof c === "object" && !Array.isArray(c)) {
|
|
3116
|
+
const v = c;
|
|
3117
|
+
if (v.key === void 0) v.key = String(i);
|
|
3118
|
+
else v.key = String(v.key);
|
|
3119
|
+
}
|
|
3120
|
+
}
|
|
3121
|
+
}
|
|
3122
|
+
var ENUMERATED_VALUE_BASED = /* @__PURE__ */ new Set(["draggable", "contenteditable", "spellcheck", "translate"]);
|
|
3123
|
+
|
|
3081
3124
|
// src/ui-dom/vdom/ssr.ts
|
|
3082
3125
|
var VOID_TAGS = /* @__PURE__ */ new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
|
|
3083
3126
|
var SVG_TAGS = /* @__PURE__ */ new Set(["svg", "path", "circle", "rect", "line", "polyline", "polygon", "g", "text", "defs", "use", "clipPath"]);
|
|
@@ -3101,25 +3144,52 @@ async function renderSsr(input, ctx) {
|
|
|
3101
3144
|
if (input == null || typeof input === "boolean") return "";
|
|
3102
3145
|
if (typeof input === "string" || typeof input === "number") return escape(String(input));
|
|
3103
3146
|
if (Array.isArray(input)) {
|
|
3104
|
-
|
|
3147
|
+
ensureArrayKeys(input);
|
|
3148
|
+
const fidBase = ctx._fidPath;
|
|
3149
|
+
const parts = await Promise.all(input.map(async (c, i) => {
|
|
3150
|
+
const childFid = fidBase != null ? `${fidBase}-${i}` : String(i);
|
|
3151
|
+
if (c == null || typeof c === "boolean") return Promise.resolve(`<!--${holeMarkup({ type: "hole", value: c })}-->`);
|
|
3152
|
+
if (Array.isArray(c)) {
|
|
3153
|
+
const inner = await renderSsr(c, { ...ctx, _fidPath: childFid });
|
|
3154
|
+
return `<!--${holeMarkup({ type: "fragment-start", key: String(i), fid: childFid })}-->${inner}<!--${holeMarkup({ type: "fragment-end", key: String(i), fid: childFid })}-->`;
|
|
3155
|
+
}
|
|
3156
|
+
return renderSsr(c, ctx);
|
|
3157
|
+
}));
|
|
3105
3158
|
return parts.join("");
|
|
3106
3159
|
}
|
|
3107
3160
|
const vnode = input;
|
|
3161
|
+
if (isInvalidVNodeType(vnode.type)) {
|
|
3162
|
+
console.warn(`[weifuwu] children \u9879\u975E\u6CD5\uFF1Atype=${String(vnode.type)}\uFF08${typeof vnode.type}\uFF09\u2014\u2014\u5DF2\u5360\u4F4D\uFF08wf-hole\uFF09`);
|
|
3163
|
+
return `<!--${holeMarkup({ type: "hole", value: input })}-->`;
|
|
3164
|
+
}
|
|
3108
3165
|
if (vnode.type === Portal || vnode.type === Fragment) return renderSsr(vnode.props?.children, ctx);
|
|
3109
3166
|
if (typeof vnode.type === "function") {
|
|
3110
3167
|
const childCtx = Object.create(ctx);
|
|
3168
|
+
delete childCtx._fidPath;
|
|
3111
3169
|
const renderFn = await vnode.type(vnode.props ?? {}, childCtx);
|
|
3112
3170
|
if (typeof renderFn !== "function") {
|
|
3113
3171
|
throw new Error(
|
|
3114
3172
|
`Component ${vnode.type.name || "anonymous"} must return a render function. Use (init_props, ctx) => (props) => VNode pattern.`
|
|
3115
3173
|
);
|
|
3116
3174
|
}
|
|
3117
|
-
|
|
3175
|
+
const out = await renderFn(vnode.props ?? {});
|
|
3176
|
+
if (vnode.key != null && out != null && typeof out === "object") {
|
|
3177
|
+
if (Array.isArray(out)) {
|
|
3178
|
+
for (const c of out) {
|
|
3179
|
+
if (c != null && typeof c === "object" && !Array.isArray(c)) c.key = vnode.key;
|
|
3180
|
+
}
|
|
3181
|
+
} else {
|
|
3182
|
+
;
|
|
3183
|
+
out.key = vnode.key;
|
|
3184
|
+
}
|
|
3185
|
+
}
|
|
3186
|
+
return renderSsr(out, childCtx);
|
|
3118
3187
|
}
|
|
3119
3188
|
const tag = vnode.type;
|
|
3120
3189
|
const props = vnode.props ?? {};
|
|
3121
3190
|
const attrs = [];
|
|
3122
3191
|
let innerHTML;
|
|
3192
|
+
if (vnode.key != null) attrs.push(` data-wf-key="${escape(String(vnode.key))}"`);
|
|
3123
3193
|
for (const [key, value] of Object.entries(props)) {
|
|
3124
3194
|
if (key === "children" || key === "key") continue;
|
|
3125
3195
|
if (key === "ref") continue;
|
|
@@ -3137,7 +3207,7 @@ async function renderSsr(input, ctx) {
|
|
|
3137
3207
|
attrs.push(` style="${escape(styleToString(value))}"`);
|
|
3138
3208
|
continue;
|
|
3139
3209
|
}
|
|
3140
|
-
if (key
|
|
3210
|
+
if (ENUMERATED_VALUE_BASED.has(key)) {
|
|
3141
3211
|
attrs.push(` ${key}="${value ? "true" : "false"}"`);
|
|
3142
3212
|
continue;
|
|
3143
3213
|
}
|
|
@@ -3172,6 +3242,7 @@ function createSsrUi() {
|
|
|
3172
3242
|
},
|
|
3173
3243
|
endMounting: () => {
|
|
3174
3244
|
},
|
|
3245
|
+
onUnmount: () => void 0,
|
|
3175
3246
|
// hooks no-op(组件 SSR 安全——不注册监听/定时器)
|
|
3176
3247
|
useChat: () => ({ messages: [], input: "", streaming: false, error: null, usage: null, step: null, send: () => {
|
|
3177
3248
|
}, stop: () => {
|