dsh-plugin-core-demo 0.2.1 → 0.2.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.
- package/dist/client.js +73 -17
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -446,17 +446,22 @@ var BUTTON_CSS = `
|
|
|
446
446
|
|
|
447
447
|
\u26A0\uFE0F hover \u4E0D\u518D\u7528 opacity \u538B\u4E00\u5C42\uFF08\u7528\u6237 2026-10-19\uFF1A\u300C\u9ED1\u8272\u548C\u7EA2\u8272\u7684\u6309\u94AE\u79FB\u4E0A\u53BB\u53D8\u5316\u592A\u5C0F\uFF0C
|
|
448
448
|
\u5B8C\u5168\u611F\u89C9\u4E0D\u5230\u989C\u8272\u53D8\u4E86\u300D\uFF09\u21D2 \u8D70 --dshpc-*-hover / -active \u7684\u660E\u786E\u6DF7\u8272\uFF0C\u89C1 tokens-css.ts\u3002 */
|
|
449
|
-
.dshpc-btn{--btn-bg:transparent;--btn-fg:var(--dshpc-fg);--btn-border:transparent;
|
|
449
|
+
.dshpc-btn{--btn-bg:transparent;--btn-fg:var(--dshpc-fg);--btn-border:transparent;--btn-pad:12px;
|
|
450
450
|
--btn-bg-hover:var(--dshpc-hover);--btn-bg-active:var(--dshpc-active);--btn-fg-hover:var(--btn-fg);
|
|
451
451
|
appearance:none;display:inline-flex;align-items:center;justify-content:center;gap:6px;
|
|
452
452
|
box-sizing:border-box;border:1px solid var(--btn-border);border-radius:var(--dshpc-radius-md);
|
|
453
453
|
background-color:var(--btn-bg);color:var(--btn-fg);font-family:inherit;font-weight:500;white-space:nowrap;cursor:pointer;
|
|
454
454
|
transition:background-color var(--dshpc-dur-fast) var(--dshpc-ease),border-color var(--dshpc-dur-fast) var(--dshpc-ease),color var(--dshpc-dur-fast) var(--dshpc-ease),box-shadow var(--dshpc-dur-fast) var(--dshpc-ease),transform var(--dshpc-dur-fast) var(--dshpc-ease);}
|
|
455
|
-
.dshpc-btn--sm{height:var(--dshpc-control-h-sm);padding:0
|
|
456
|
-
.dshpc-btn--md{height:var(--dshpc-control-h-md);padding:0
|
|
457
|
-
.dshpc-btn--lg{height:var(--dshpc-control-h-lg);padding:0
|
|
455
|
+
.dshpc-btn--sm{--btn-pad:10px;height:var(--dshpc-control-h-sm);padding:0 var(--btn-pad);font-size:var(--dshpc-font-sm);line-height:var(--dshpc-line-sm);}
|
|
456
|
+
.dshpc-btn--md{--btn-pad:12px;height:var(--dshpc-control-h-md);padding:0 var(--btn-pad);font-size:var(--dshpc-font-md);line-height:var(--dshpc-line-md);}
|
|
457
|
+
.dshpc-btn--lg{--btn-pad:14px;height:var(--dshpc-control-h-lg);padding:0 var(--btn-pad);font-size:var(--dshpc-font-md);line-height:var(--dshpc-line-md);}
|
|
458
458
|
/* block\uFF1A\u6491\u6EE1\u7236\u5BBD\uFF08\u8868\u5355\u5E95\u680F / \u62BD\u5C49\u5E95\u90E8\u7684\u4E3B\u64CD\u4F5C\uFF09 */
|
|
459
459
|
.dshpc-btn--block{display:flex;width:100%;}
|
|
460
|
+
/* block + \u524D\u7F6E\u56FE\u6807 \u21D2 \u6587\u5B57\u89C6\u89C9\u5C45\u4E2D\uFF082026-10-19 \u7528\u6237\u70B9\u540D\uFF09\uFF1A
|
|
461
|
+
\u5185\u5BB9\u7EC4 [\u56FE\u6807 + \u95F4\u8DDD + \u6587\u5B57] \u6574\u4F53\u5728\u76D2\u5185\u5C45\u4E2D\u65F6\uFF0C**\u6587\u5B57**\u7684\u4E2D\u5FC3\u4F1A\u88AB\u56FE\u6807\u63A8\u53F3\u534A\u683C\u3002
|
|
462
|
+
\u628A\u53F3\u5185\u8FB9\u8DDD\u8865\u4E0A\u300C\u56FE\u6807\u5BBD + \u95F4\u8DDD\u300D\uFF0C\u53EF\u7528\u76D2\u968F\u4E4B\u5DE6\u79FB\u540C\u91CF \u21D2 \u6587\u5B57\u843D\u56DE\u89C6\u89C9\u4E2D\u5FC3\uFF0C\u56FE\u6807\u8D34\u5DE6\u4FA7\u3002
|
|
463
|
+
\u56FE\u6807\u5BBD\u6309 1.2em \u4F30\uFF08\u5B98\u65B9\u56FE\u6807 14/16px vs \u5B57\u53F7 12/13px\uFF09\uFF0Cem \u968F\u5B57\u53F7\u6863\u81EA\u52A8\u7F29\u653E\u3002 */
|
|
464
|
+
.dshpc-btn--block.dshpc-btn--icon-start{padding-right:calc(var(--btn-pad) + 1.2em + 6px);}
|
|
460
465
|
.dshpc-btn__icon,.dshpc-btn__icon-end{display:inline-flex;align-items:center;justify-content:center;flex:none;}
|
|
461
466
|
/* loading\uFF1A\u4E0D\u6362 DOM \u7ED3\u6784\uFF0C\u53EA\u5728\u6587\u6848\u524D\u63D2\u4E00\u4E2A\u540C\u8272\u5C0F\u5708\uFF08\u5C3A\u5BF8\u968F\u5B57\u53F7\uFF0C\u7F29\u653E\u4E0D\u4F9D\u8D56\u5E38\u91CF\uFF09 */
|
|
462
467
|
.dshpc-btn__spinner{display:inline-block;flex:none;width:1em;height:1em;box-sizing:border-box;
|
|
@@ -1525,8 +1530,8 @@ function colorVars(variant, color) {
|
|
|
1525
1530
|
"--btn-bg-active": `color-mix(in srgb, ${color} 18%, transparent)`
|
|
1526
1531
|
};
|
|
1527
1532
|
}
|
|
1528
|
-
function buttonClass(variant, size, block, extra) {
|
|
1529
|
-
return `dshpc-btn dshpc-btn--${variant} dshpc-btn--${size}${block ? " dshpc-btn--block" : ""}${extra !== void 0 && extra !== "" ? ` ${extra}` : ""}`;
|
|
1533
|
+
function buttonClass(variant, size, block, hasIcon, extra) {
|
|
1534
|
+
return `dshpc-btn dshpc-btn--${variant} dshpc-btn--${size}${block ? " dshpc-btn--block" : ""}${hasIcon ? " dshpc-btn--icon-start" : ""}${extra !== void 0 && extra !== "" ? ` ${extra}` : ""}`;
|
|
1530
1535
|
}
|
|
1531
1536
|
function Button(props) {
|
|
1532
1537
|
ensureControls();
|
|
@@ -1535,7 +1540,7 @@ function Button(props) {
|
|
|
1535
1540
|
...rest,
|
|
1536
1541
|
type: rest.type ?? "button",
|
|
1537
1542
|
disabled: rest.disabled === true || loading,
|
|
1538
|
-
className: buttonClass(variant, size, block, className),
|
|
1543
|
+
className: buttonClass(variant, size, block, icon !== void 0 && icon !== null && !loading, className),
|
|
1539
1544
|
style: { ...colorVars(variant, color), ...style }
|
|
1540
1545
|
};
|
|
1541
1546
|
return (0, import_react9.createElement)("button", attrs, loading ? (0, import_react9.createElement)("span", { className: "dshpc-btn__spinner", "aria-hidden": true }) : icon !== void 0 && icon !== null ? (0, import_react9.createElement)("span", { className: "dshpc-btn__icon" }, icon) : null, children, iconRight !== void 0 && iconRight !== null ? (0, import_react9.createElement)("span", { className: "dshpc-btn__icon-end" }, iconRight) : null);
|
|
@@ -2021,7 +2026,10 @@ var DICT2 = {
|
|
|
2021
2026
|
btnVariantTitle: "\u5916\u89C2\u6863\uFF0810 \u6863\uFF09",
|
|
2022
2027
|
btnVariantHint: "\u5B9E\u5FC3\uFF1Aprimary / secondary / danger / success / warning / info\uFF1B\u7EBF\u6846\uFF1Aoutline / danger-outline\uFF1B\u65E0\u5E95\uFF1Aghost / link",
|
|
2023
2028
|
btnSizeTitle: "\u5C3A\u5BF8 / \u56FE\u6807 / block",
|
|
2024
|
-
btnSizeHint: "sm 24 \xB7 md 28 \xB7 lg 32 \u540C\u9AD8\uFF1Bicon \
|
|
2029
|
+
btnSizeHint: "sm 24 \xB7 md 28 \xB7 lg 32 \u540C\u9AD8\uFF1Bicon \u6536\u7684\u662F ReactNode\u2014\u2014\u5B98\u65B9\u56FE\u6807\u7EC4\u4EF6\u3001\u81EA\u7ED8 SVG\u3001\u751A\u81F3\u4E00\u4E2A\u5B57\u7B26\u90FD\u884C\uFF0C\u4E0D\u662F\u540D\u5B57\u4E5F\u4E0D\u662F class\uFF08\u4E0B\u9762\u4E09\u9897\u5206\u522B\u662F\u8FD9\u4E09\u79CD\uFF09\uFF1BiconRight \u540E\u7F6E\u3001block \u6491\u6EE1\u7236\u5BBD",
|
|
2030
|
+
btnIconOnly: "\u7EAF\u56FE\u6807\u94AE",
|
|
2031
|
+
btnHintTitle: "\u95EE\u53F7\u63D0\u793A\uFF08FieldHint\uFF09",
|
|
2032
|
+
btnHintHint: "\u72EC\u7ACB\u7EC4\u4EF6\uFF0C\u653E\u54EA\u90FD\u884C\uFF1A\u6807\u9898\u540E / \u6309\u94AE\u540E / \u4E00\u6BB5\u6587\u5B57\u540E / \u8F93\u5165\u6846\u540E\uFF1B\u9F20\u6807\u60AC\u505C\u6216\u952E\u76D8\u805A\u7126\u6D6E\u51FA\u6C14\u6CE1",
|
|
2025
2033
|
btnStateTitle: "\u72B6\u6001",
|
|
2026
2034
|
btnStateHint: "disabled \u534A\u900F\u660E\u4E0D\u53EF\u70B9\uFF1Bloading \u524D\u7F6E\u540C\u8272\u5C0F\u5708\u5E76\u81EA\u52A8\u7981\u7528",
|
|
2027
2035
|
btnColorTitle: "\u81EA\u5B9A\u4E49\u989C\u8272",
|
|
@@ -2073,7 +2081,10 @@ var DICT2 = {
|
|
|
2073
2081
|
btnVariantTitle: "Variants (10)",
|
|
2074
2082
|
btnVariantHint: "Solid: primary / secondary / danger / success / warning / info; outlined: outline / danger-outline; flat: ghost / link",
|
|
2075
2083
|
btnSizeTitle: "Sizes / icons / block",
|
|
2076
|
-
btnSizeHint: "sm 24 \xB7 md 28 \xB7 lg 32, same height; icon
|
|
2084
|
+
btnSizeHint: "sm 24 \xB7 md 28 \xB7 lg 32, same height; icon takes any ReactNode \u2014 an official icon component, your own SVG, even a single character (not a name, not a class); iconRight trails, block fills the parent",
|
|
2085
|
+
btnIconOnly: "Icon-only",
|
|
2086
|
+
btnHintTitle: "Question-mark hint (FieldHint)",
|
|
2087
|
+
btnHintHint: "Standalone component, drop it anywhere: after a title, a button, a sentence, or an input; hover or keyboard-focus to reveal",
|
|
2077
2088
|
btnStateTitle: "States",
|
|
2078
2089
|
btnStateHint: "disabled is dimmed and unclickable; loading shows a same-color spinner and disables itself",
|
|
2079
2090
|
btnColorTitle: "Custom colors",
|
|
@@ -2205,6 +2216,18 @@ function iconOf(name, size = 14) {
|
|
|
2205
2216
|
const found = BUTTON_ICONS.find((item) => item.name === name);
|
|
2206
2217
|
return found === void 0 ? null : (0, import_react20.createElement)(found.Icon, { size });
|
|
2207
2218
|
}
|
|
2219
|
+
function StarSvg() {
|
|
2220
|
+
return (0, import_react20.createElement)(
|
|
2221
|
+
"svg",
|
|
2222
|
+
{ width: 14, height: 14, viewBox: "0 0 16 16", fill: "none", "aria-hidden": true },
|
|
2223
|
+
(0, import_react20.createElement)("path", {
|
|
2224
|
+
d: "M8 1.6l1.9 4 4.4.6-3.2 3 .8 4.3L8 11.4l-3.9 2.1.8-4.3-3.2-3 4.4-.6z",
|
|
2225
|
+
stroke: "currentColor",
|
|
2226
|
+
strokeWidth: 1.2,
|
|
2227
|
+
strokeLinejoin: "round"
|
|
2228
|
+
})
|
|
2229
|
+
);
|
|
2230
|
+
}
|
|
2208
2231
|
var ICON_SIZE = { sm: 12, md: 14, lg: 16 };
|
|
2209
2232
|
var VARIANTS = [
|
|
2210
2233
|
{ value: "primary", icon: "check" },
|
|
@@ -2300,12 +2323,13 @@ function ButtonsSection() {
|
|
|
2300
2323
|
{ label: "size" },
|
|
2301
2324
|
["sm", "md", "lg"].map((size) => (0, import_react20.createElement)(Button, { key: size, size, variant: "outline", icon: iconOf("plus", ICON_SIZE[size]) }, size))
|
|
2302
2325
|
),
|
|
2326
|
+
// icon 收的是 ReactNode:官方图标组件 / 自绘 SVG / 一个字符,三种来源各一颗
|
|
2303
2327
|
(0, import_react20.createElement)(
|
|
2304
2328
|
Labeled,
|
|
2305
2329
|
{ label: "icon" },
|
|
2306
|
-
(0, import_react20.createElement)(Button, { variant: "primary", icon: iconOf("send", ICON_SIZE.lg) }, "\
|
|
2307
|
-
(0, import_react20.createElement)(Button, { variant: "outline", icon:
|
|
2308
|
-
(0, import_react20.createElement)(Button, { variant: "ghost", icon:
|
|
2330
|
+
(0, import_react20.createElement)(Button, { variant: "primary", icon: iconOf("send", ICON_SIZE.lg) }, "\u5B98\u65B9\u56FE\u6807"),
|
|
2331
|
+
(0, import_react20.createElement)(Button, { variant: "outline", icon: (0, import_react20.createElement)(StarSvg, null) }, "\u81EA\u7ED8 SVG"),
|
|
2332
|
+
(0, import_react20.createElement)(Button, { variant: "ghost", icon: "+" }, "\u4E00\u4E2A\u5B57\u7B26")
|
|
2309
2333
|
),
|
|
2310
2334
|
(0, import_react20.createElement)(
|
|
2311
2335
|
Labeled,
|
|
@@ -2313,22 +2337,52 @@ function ButtonsSection() {
|
|
|
2313
2337
|
(0, import_react20.createElement)(Button, { variant: "outline", iconRight: iconOf("chevron", ICON_SIZE.lg) }, "\u66F4\u591A"),
|
|
2314
2338
|
(0, import_react20.createElement)(Button, { variant: "primary" }, "\u4E0B\u4E00\u6B65")
|
|
2315
2339
|
),
|
|
2340
|
+
// block + 前置图标:文字要在视觉中心,不能整组内容居中(那样文字会被图标推右)
|
|
2316
2341
|
(0, import_react20.createElement)(
|
|
2317
2342
|
Labeled,
|
|
2318
2343
|
{ label: "block" },
|
|
2319
2344
|
(0, import_react20.createElement)(
|
|
2320
2345
|
"div",
|
|
2321
|
-
{ style: { width: "
|
|
2322
|
-
(0, import_react20.createElement)(Button, { variant: "primary", block: true, icon: iconOf("check", ICON_SIZE.lg) }, "\u6491\u6EE1\u7236\u5BBD")
|
|
2346
|
+
{ style: { width: "260px" } },
|
|
2347
|
+
(0, import_react20.createElement)(Button, { variant: "primary", block: true, icon: iconOf("check", ICON_SIZE.lg) }, "\u6491\u6EE1\u7236\u5BBD"),
|
|
2348
|
+
(0, import_react20.createElement)("div", { style: { height: "8px" } }),
|
|
2349
|
+
(0, import_react20.createElement)(Button, { variant: "outline", block: true }, "\u65E0\u56FE\u6807\u5BF9\u7167")
|
|
2323
2350
|
)
|
|
2324
2351
|
),
|
|
2325
2352
|
(0, import_react20.createElement)(
|
|
2326
2353
|
Labeled,
|
|
2327
|
-
{ label: "
|
|
2354
|
+
{ label: t2("btnIconOnly") },
|
|
2328
2355
|
BUTTON_ICONS.slice(0, 6).map((item) => (0, import_react20.createElement)(IconButton, { key: item.name, icon: (0, import_react20.createElement)(item.Icon, { size: 16 }), label: item.name }))
|
|
2329
2356
|
)
|
|
2330
2357
|
)
|
|
2331
2358
|
),
|
|
2359
|
+
// ── 问号提示:证明它不属于 Input 家族,随处可挂 ──────────────────────
|
|
2360
|
+
(0, import_react20.createElement)(
|
|
2361
|
+
Demo,
|
|
2362
|
+
{ title: t2("btnHintTitle"), hint: t2("btnHintHint") },
|
|
2363
|
+
(0, import_react20.createElement)(
|
|
2364
|
+
"div",
|
|
2365
|
+
{ style: { display: "flex", flexDirection: "column", gap: "10px" } },
|
|
2366
|
+
(0, import_react20.createElement)(
|
|
2367
|
+
Row,
|
|
2368
|
+
null,
|
|
2369
|
+
(0, import_react20.createElement)("b", { style: { fontSize: "13px" } }, "\u4E00\u4E2A\u6807\u9898"),
|
|
2370
|
+
(0, import_react20.createElement)(FieldHint, { text: "\u6302\u5728\u6807\u9898\u540E\u9762\uFF1A\u8BF4\u660E\u8FD9\u4E00\u5757\u662F\u5E72\u4EC0\u4E48\u7684\u3002" })
|
|
2371
|
+
),
|
|
2372
|
+
(0, import_react20.createElement)(
|
|
2373
|
+
Row,
|
|
2374
|
+
null,
|
|
2375
|
+
(0, import_react20.createElement)(Button, { variant: "outline" }, "\u4E00\u4E2A\u6309\u94AE"),
|
|
2376
|
+
(0, import_react20.createElement)(FieldHint, { text: "\u6302\u5728\u6309\u94AE\u540E\u9762\uFF1A\u89E3\u91CA\u8FD9\u4E2A\u64CD\u4F5C\u4F1A\u53D1\u751F\u4EC0\u4E48\u3002" })
|
|
2377
|
+
),
|
|
2378
|
+
(0, import_react20.createElement)(
|
|
2379
|
+
Row,
|
|
2380
|
+
null,
|
|
2381
|
+
(0, import_react20.createElement)("span", { style: { fontSize: "13px" } }, "\u4E00\u6BB5\u666E\u901A\u6587\u5B57"),
|
|
2382
|
+
(0, import_react20.createElement)(FieldHint, { text: "\u6302\u5728\u4EFB\u4F55\u6587\u5B57\u540E\u9762\u90FD\u884C\uFF0C\u5B83\u53EA\u662F\u4E00\u4E2A 14px \u7684\u5185\u8054\u5143\u7D20\u3002" })
|
|
2383
|
+
)
|
|
2384
|
+
)
|
|
2385
|
+
),
|
|
2332
2386
|
// ── 状态 ───────────────────────────────────────────────────────────
|
|
2333
2387
|
(0, import_react20.createElement)(
|
|
2334
2388
|
Demo,
|
|
@@ -3311,13 +3365,15 @@ function DemoPage() {
|
|
|
3311
3365
|
const [active, setActive] = (0, import_react31.useState)(ALL_SECTIONS[0].id);
|
|
3312
3366
|
return (0, import_react31.createElement)(
|
|
3313
3367
|
"div",
|
|
3314
|
-
{ style: { display: "flex", alignItems: "
|
|
3368
|
+
{ style: { display: "flex", alignItems: "stretch", height: "100%", minHeight: 0, overflow: "hidden" } },
|
|
3315
3369
|
(0, import_react31.createElement)(
|
|
3316
3370
|
"aside",
|
|
3317
3371
|
{
|
|
3318
3372
|
style: {
|
|
3319
3373
|
width: "180px",
|
|
3320
3374
|
flex: "none",
|
|
3375
|
+
height: "100%",
|
|
3376
|
+
boxSizing: "border-box",
|
|
3321
3377
|
padding: "14px 10px",
|
|
3322
3378
|
overflowY: "auto",
|
|
3323
3379
|
borderRight: "1px solid var(--dshpc-border-faint)",
|
|
@@ -3353,7 +3409,7 @@ function DemoPage() {
|
|
|
3353
3409
|
),
|
|
3354
3410
|
(0, import_react31.createElement)(
|
|
3355
3411
|
"main",
|
|
3356
|
-
{ style: { flex: 1, minWidth: 0, overflowY: "auto", padding: "12px 22px 60px" } },
|
|
3412
|
+
{ style: { flex: 1, minWidth: 0, minHeight: 0, height: "100%", boxSizing: "border-box", overflowY: "auto", padding: "12px 22px 60px" } },
|
|
3357
3413
|
(0, import_react31.createElement)(Sections, { active, onNavigate: setActive })
|
|
3358
3414
|
)
|
|
3359
3415
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-core-demo",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "dsh-plugin-core 的组件预览插件:装进 DSH 宿主后,在真实宿主环境里预览控件与业务组件",
|
|
5
5
|
"keywords": ["deepseek", "harness", "dsh", "dsh-plugin", "dsh-plugin-core"],
|
|
6
6
|
"homepage": "https://github.com/cq-guojia/dsh-plugin-core/tree/main/packages/demo",
|