dsh-workbench-tasks 5.2.31 → 5.2.35

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.
Files changed (3) hide show
  1. package/lib/client.js +863 -325
  2. package/lib/index.js +6 -1
  3. package/package.json +4 -4
package/lib/client.js CHANGED
@@ -2316,11 +2316,262 @@ var require_charts = __commonJS({
2316
2316
  }
2317
2317
  });
2318
2318
 
2319
+ // packages/addons/lib/switch.cjs
2320
+ var require_switch = __commonJS({
2321
+ "packages/addons/lib/switch.cjs"(exports2, module2) {
2322
+ "use strict";
2323
+ var SWITCH_STYLES = [
2324
+ ".wbctl-switch{display:inline-flex;align-items:center;gap:7px;min-height:24px;padding:2px;border:0;background:transparent;font:inherit;font-size:12px;color:var(--wb-muted,#6b7280);cursor:pointer;user-select:none;border-radius:999px}",
2325
+ ".wbctl-switch-track{position:relative;display:inline-flex;align-items:center;box-sizing:border-box;width:34px;height:20px;padding:2px;border-radius:999px;background:color-mix(in oklab,currentColor 22%,transparent);transition:background .16s ease;flex:none}",
2326
+ ".wbctl-switch-knob{display:block;width:16px;height:16px;border-radius:50%;background:var(--wb-card,#fff);box-shadow:0 1px 2px rgba(0,0,0,.25);transition:transform .16s ease}",
2327
+ ".wbctl-switch[aria-checked=true]{color:var(--wb-accent,#2563eb)}",
2328
+ ".wbctl-switch[aria-checked=true] .wbctl-switch-track{background:var(--wb-accent,#2563eb)}",
2329
+ ".wbctl-switch[aria-checked=true] .wbctl-switch-knob{transform:translateX(14px)}",
2330
+ ".wbctl-switch:hover:not(:disabled) .wbctl-switch-track{outline:1px solid var(--wb-accent,#2563eb)}",
2331
+ ".wbctl-switch:focus-visible{outline:2px solid var(--wb-accent,#2563eb);outline-offset:2px}",
2332
+ ".wbctl-switch:disabled{opacity:.45;cursor:not-allowed}",
2333
+ ".wbctl-switch-text{white-space:nowrap}",
2334
+ "@media (prefers-reduced-motion:reduce){.wbctl-switch-track,.wbctl-switch-knob{transition:none}}"
2335
+ ];
2336
+ function Switch(props) {
2337
+ var h = props.h;
2338
+ var on = props.checked === true || props.checked === "true";
2339
+ var disabled = !!props.disabled;
2340
+ var text = props.label;
2341
+ if (props.showState) text = on ? props.onText || "\u5F00" : props.offText || "\u5173";
2342
+ return h(
2343
+ "button",
2344
+ {
2345
+ type: "button",
2346
+ role: "switch",
2347
+ "aria-checked": on ? "true" : "false",
2348
+ className: "wbctl-switch" + (props.className ? " " + props.className : ""),
2349
+ disabled,
2350
+ title: props.title,
2351
+ "aria-label": text ? void 0 : props.ariaLabel,
2352
+ onClick: function(e) {
2353
+ e.preventDefault();
2354
+ if (disabled) return;
2355
+ if (typeof props.onChange === "function") props.onChange(!on);
2356
+ }
2357
+ },
2358
+ h(
2359
+ "span",
2360
+ { className: "wbctl-switch-track", "aria-hidden": "true" },
2361
+ h("span", { className: "wbctl-switch-knob" })
2362
+ ),
2363
+ text ? h("span", { className: "wbctl-switch-text" }, text) : null
2364
+ );
2365
+ }
2366
+ module2.exports = { Switch, styles: SWITCH_STYLES };
2367
+ }
2368
+ });
2369
+
2370
+ // packages/addons/lib/number-field.cjs
2371
+ var require_number_field = __commonJS({
2372
+ "packages/addons/lib/number-field.cjs"(exports2, module2) {
2373
+ "use strict";
2374
+ var React = require("react");
2375
+ var NUM = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)$/;
2376
+ var TEXT = {
2377
+ zh: {
2378
+ required: "\u8BF7\u586B\u5199\u6570\u5B57",
2379
+ invalid: "\u8BF7\u8F93\u5165\u6570\u5B57",
2380
+ integer: "\u9700\u8981\u662F\u6574\u6570",
2381
+ min: "\u4E0D\u80FD\u5C0F\u4E8E {min}",
2382
+ max: "\u4E0D\u80FD\u5927\u4E8E {max}",
2383
+ range: "\u9700\u8981\u5728 {min}\u2013{max} \u4E4B\u95F4",
2384
+ step: "\u9700\u8981\u662F {step} \u7684\u500D\u6570",
2385
+ unit: "\u5355\u4F4D"
2386
+ },
2387
+ en: {
2388
+ required: "Please enter a number",
2389
+ invalid: "Please enter a number",
2390
+ integer: "Must be a whole number",
2391
+ min: "Must be at least {min}",
2392
+ max: "Must be at most {max}",
2393
+ range: "Must be between {min} and {max}",
2394
+ step: "Must be a multiple of {step}",
2395
+ unit: "unit"
2396
+ }
2397
+ };
2398
+ function messages(lang) {
2399
+ return lang === "en" ? TEXT.en : TEXT.zh;
2400
+ }
2401
+ function fill(text, vars) {
2402
+ return String(text).replace(/\{(\w+)\}/g, function(m, key) {
2403
+ return vars && vars[key] !== void 0 ? String(vars[key]) : m;
2404
+ });
2405
+ }
2406
+ function validateNumber(raw, opts) {
2407
+ var o = opts || {};
2408
+ var M = messages(o.lang);
2409
+ var text = raw === null || raw === void 0 ? "" : String(raw).trim();
2410
+ if (text === "") {
2411
+ return o.allowEmpty ? { ok: true, value: null, error: "" } : { ok: false, value: null, error: M.required };
2412
+ }
2413
+ if (!NUM.test(text)) return { ok: false, value: null, error: M.invalid };
2414
+ var n = Number(text);
2415
+ if (!isFinite(n)) return { ok: false, value: null, error: M.invalid };
2416
+ if (o.integer && Math.round(n) !== n) return { ok: false, value: null, error: M.integer };
2417
+ var hasMin = o.min !== void 0 && o.min !== null && o.min !== "";
2418
+ var hasMax = o.max !== void 0 && o.max !== null && o.max !== "";
2419
+ if (hasMin && hasMax && n >= o.min && n <= o.max) {
2420
+ } else if (hasMin && hasMax) {
2421
+ return { ok: false, value: null, error: fill(M.range, { min: o.min, max: o.max }) };
2422
+ } else if (hasMin && n < o.min) {
2423
+ return { ok: false, value: null, error: fill(M.min, { min: o.min }) };
2424
+ } else if (hasMax && n > o.max) {
2425
+ return { ok: false, value: null, error: fill(M.max, { max: o.max }) };
2426
+ }
2427
+ if (o.step && Number(o.step) > 0) {
2428
+ var q = n / Number(o.step);
2429
+ if (Math.abs(q - Math.round(q)) > 1e-9) {
2430
+ return { ok: false, value: null, error: fill(M.step, { step: o.step }) };
2431
+ }
2432
+ }
2433
+ return { ok: true, value: n, error: "" };
2434
+ }
2435
+ function rangeHint(opts, lang) {
2436
+ var o = opts || {};
2437
+ var M = messages(lang);
2438
+ var en = lang === "en";
2439
+ var hasMin = o.min !== void 0 && o.min !== null && o.min !== "";
2440
+ var hasMax = o.max !== void 0 && o.max !== null && o.max !== "";
2441
+ var parts = [];
2442
+ if (hasMin && hasMax) parts.push(String(o.min) + "\u2013" + String(o.max));
2443
+ else if (hasMin) parts.push((en ? "\u2265 " : "\u2265 ") + String(o.min));
2444
+ else if (hasMax) parts.push((en ? "\u2264 " : "\u2264 ") + String(o.max));
2445
+ if (o.integer) parts.push(en ? "whole numbers" : "\u6574\u6570");
2446
+ else if (o.step && Number(o.step) > 0) parts.push((en ? "step " : "\u6B65\u957F ") + String(o.step));
2447
+ return parts.join(en ? ", " : "\uFF0C");
2448
+ }
2449
+ function NumberField(props) {
2450
+ var h = props.h || React.createElement;
2451
+ var lang = props.lang;
2452
+ var M = messages(lang);
2453
+ var text = props.value === null || props.value === void 0 ? "" : String(props.value);
2454
+ var draftS = React.useState(text);
2455
+ var draft = draftS[0];
2456
+ var setDraft = draftS[1];
2457
+ var focusS = React.useState(false);
2458
+ var focused = focusS[0];
2459
+ var setFocused = focusS[1];
2460
+ var errS = React.useState("");
2461
+ var err = errS[0];
2462
+ var setErr = errS[1];
2463
+ var lastRef = React.useRef(text);
2464
+ var skipBlurRef = React.useRef(false);
2465
+ React.useEffect(
2466
+ function() {
2467
+ if (focused) return;
2468
+ if (lastRef.current === text) return;
2469
+ lastRef.current = text;
2470
+ setDraft(text);
2471
+ setErr("");
2472
+ },
2473
+ [text, focused]
2474
+ );
2475
+ function commit(raw) {
2476
+ var r = validateNumber(raw, props);
2477
+ if (!r.ok) {
2478
+ setErr(r.error);
2479
+ if (typeof props.onValidChange === "function") props.onValidChange(false, r.error);
2480
+ return false;
2481
+ }
2482
+ setErr("");
2483
+ if (typeof props.onValidChange === "function") props.onValidChange(true, "");
2484
+ var cur = props.value === null || props.value === void 0 ? null : Number(props.value);
2485
+ if (r.value !== cur) {
2486
+ lastRef.current = r.value === null ? "" : String(r.value);
2487
+ if (typeof props.onCommit === "function") props.onCommit(r.value);
2488
+ }
2489
+ return true;
2490
+ }
2491
+ var hint = props.hint !== void 0 ? props.hint : rangeHint(props, lang);
2492
+ var shown = props.hint === false ? "" : hint;
2493
+ return h(
2494
+ "span",
2495
+ { className: "wbctl-num" + (props.wide ? " is-wide" : "") + (props.className ? " " + props.className : "") },
2496
+ h(
2497
+ "span",
2498
+ { className: "wbctl-num-box" },
2499
+ h("input", {
2500
+ className: "wbctl-num-input" + (err ? " is-invalid" : ""),
2501
+ type: "text",
2502
+ inputMode: props.integer || Number(props.step) === 1 ? "numeric" : "decimal",
2503
+ value: draft,
2504
+ disabled: !!props.disabled,
2505
+ placeholder: props.placeholder,
2506
+ title: props.title,
2507
+ "aria-label": props.ariaLabel,
2508
+ "aria-invalid": err ? "true" : void 0,
2509
+ onFocus: function() {
2510
+ setFocused(true);
2511
+ },
2512
+ onChange: function(e) {
2513
+ setDraft(e.target.value);
2514
+ if (err) setErr("");
2515
+ if (typeof props.onDraft === "function") props.onDraft(e.target.value);
2516
+ },
2517
+ onBlur: function() {
2518
+ setFocused(false);
2519
+ if (skipBlurRef.current) {
2520
+ skipBlurRef.current = false;
2521
+ return;
2522
+ }
2523
+ commit(draft);
2524
+ },
2525
+ onKeyDown: function(e) {
2526
+ if (e.key === "Enter") {
2527
+ e.preventDefault();
2528
+ if (e.target && e.target.blur) e.target.blur();
2529
+ } else if (e.key === "Escape") {
2530
+ e.preventDefault();
2531
+ skipBlurRef.current = true;
2532
+ setDraft(text);
2533
+ setErr("");
2534
+ if (e.target && e.target.blur) e.target.blur();
2535
+ }
2536
+ }
2537
+ }),
2538
+ props.unit ? h("span", { className: "wbctl-num-unit" }, props.unit) : null
2539
+ ),
2540
+ err ? h("span", { className: "wbctl-num-err", role: "alert" }, err) : shown ? h("span", { className: "wbctl-num-hint" }, shown) : null
2541
+ );
2542
+ }
2543
+ var NUMBER_STYLES = [
2544
+ ".wbctl-num{display:inline-flex;flex-direction:column;gap:3px;min-width:0;max-width:100%}",
2545
+ ".wbctl-num.is-wide{display:flex;width:100%}",
2546
+ ".wbctl-num-box{display:inline-flex;align-items:center;gap:6px;min-width:0}",
2547
+ ".wbctl-num-input{box-sizing:border-box;width:96px;min-width:0;padding:6px 9px;border:1px solid var(--wb-line,rgba(127,127,127,.35));border-radius:6px;background:var(--wb-surface,var(--wb-card,transparent));color:inherit;font:inherit;font-size:13px;font-variant-numeric:tabular-nums;transition:border-color .14s ease,outline-color .14s ease}",
2548
+ ".wbctl-num-input:hover:not(:disabled){border-color:var(--wb-border,var(--wb-line))}",
2549
+ ".wbctl-num-input:focus{outline:2px solid color-mix(in oklab,var(--wb-accent,#2563eb) 55%,transparent);outline-offset:1px;border-color:var(--wb-accent,#2563eb)}",
2550
+ ".wbctl-num-input.is-invalid{border-color:var(--wb-danger,#dc2626)}",
2551
+ ".wbctl-num-input.is-invalid:focus{outline-color:color-mix(in oklab,var(--wb-danger,#dc2626) 55%,transparent)}",
2552
+ ".wbctl-num-input:disabled{opacity:.5;cursor:not-allowed}",
2553
+ ".wbctl-num-unit{color:var(--wb-muted,inherit);font-size:12px;white-space:nowrap}",
2554
+ ".wbctl-num-hint{color:var(--wb-muted,inherit);font-size:11px;line-height:1.4}",
2555
+ ".wbctl-num-err{color:var(--wb-danger,#dc2626);font-size:11px;line-height:1.4}",
2556
+ "@media (prefers-reduced-motion:reduce){.wbctl-num-input{transition:none}}"
2557
+ ];
2558
+ module2.exports = {
2559
+ NumberField,
2560
+ validateNumber,
2561
+ rangeHint,
2562
+ messages,
2563
+ styles: NUMBER_STYLES
2564
+ };
2565
+ }
2566
+ });
2567
+
2319
2568
  // packages/addons/tasks/client/views/config.cjs
2320
2569
  var require_config = __commonJS({
2321
2570
  "packages/addons/tasks/client/views/config.cjs"(exports2, module2) {
2322
2571
  var React = require("react");
2323
2572
  var h = React.createElement;
2573
+ var SW = require_switch();
2574
+ var NF = require_number_field();
2324
2575
  var DOMAIN = "tasks";
2325
2576
  var PREFIX = "wbt";
2326
2577
  var COPY = {
@@ -2395,13 +2646,6 @@ var require_config = __commonJS({
2395
2646
  ".__P__-cfg-select:focus,.__P__-cfg-input:focus{border-color:var(--dsw-alias-brand-primary,currentColor);box-shadow:0 0 0 3px color-mix(in oklab,var(--dsw-alias-brand-primary,currentColor) 14%,transparent)}",
2396
2647
  ".__P__-cfg-select{min-width:152px;padding-right:10px}",
2397
2648
  ".__P__-cfg-input{width:132px}",
2398
- ".__P__-cfg-switch{position:relative;display:inline-flex;align-items:center;gap:9px;cursor:pointer;font-size:12.5px;color:var(--cfg-muted);user-select:none}",
2399
- ".__P__-cfg-switch input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}",
2400
- ".__P__-cfg-track{position:relative;width:38px;height:22px;border-radius:999px;background:color-mix(in oklab,currentColor 18%,transparent);transition:background .16s ease;flex:none}",
2401
- ".__P__-cfg-track::after{content:'';position:absolute;top:2px;left:2px;width:18px;height:18px;border-radius:50%;background:var(--dsw-alias-label-primary,currentColor);transition:transform .16s ease,background .16s ease}",
2402
- ".__P__-cfg-switch input:checked+.__P__-cfg-track{background:var(--dsw-alias-brand-primary,currentColor)}",
2403
- ".__P__-cfg-switch input:checked+.__P__-cfg-track::after{transform:translateX(16px);background:var(--dsw-alias-label-primary-inverted,var(--dsw-alias-bg-base))}",
2404
- ".__P__-cfg-switch input:focus-visible+.__P__-cfg-track{outline:2px solid var(--dsw-alias-brand-primary,currentColor);outline-offset:2px}",
2405
2649
  ".__P__-cfg-multi{display:flex;flex-wrap:wrap;gap:6px;justify-content:flex-end;max-width:100%}",
2406
2650
  ".__P__-cfg-multi label{position:relative;display:inline-flex;align-items:center;padding:5px 11px;border:1px solid var(--cfg-line);border-radius:999px;font-size:12px;color:var(--cfg-muted);cursor:pointer;line-height:1.4;transition:color .12s ease,border-color .12s ease,background .12s ease}",
2407
2651
  ".__P__-cfg-multi label:hover{background:var(--cfg-hover);color:var(--dsw-alias-label-primary,inherit)}",
@@ -2426,8 +2670,8 @@ var require_config = __commonJS({
2426
2670
  ".__P__-cfg-empty{border:1px dashed var(--cfg-line);border-radius:14px;padding:40px 16px;text-align:center;font-size:12.5px;color:var(--cfg-muted)}",
2427
2671
  ".__P__-cfg-error{display:flex;align-items:center;gap:10px;flex-wrap:wrap;border:1px solid color-mix(in oklab,var(--dsw-alias-state-error-primary,currentColor) 32%,var(--cfg-line));border-radius:10px;padding:10px 13px;color:var(--dsw-alias-state-error-primary,inherit);font-size:12.5px;line-height:1.5}",
2428
2672
  "@media (max-width:820px){.__P__-cfg-row{grid-template-columns:1fr;gap:10px;padding:13px 16px}.__P__-cfg-control{justify-content:flex-start}.__P__-cfg-multi{justify-content:flex-start}.__P__-cfg-gtitle{padding:11px 16px}}",
2429
- "@media (prefers-reduced-motion:reduce){.__P__-cfg-track,.__P__-cfg-track::after,.__P__-cfg-sk{animation:none;transition:none}}"
2430
- ].join("\n").split("__P__").join(PREFIX);
2673
+ "@media (prefers-reduced-motion:reduce){.__P__-cfg-sk{animation:none;transition:none}}"
2674
+ ].concat(SW.styles).concat(NF.styles).join("\n").split("__P__").join(PREFIX);
2431
2675
  function injectCss() {
2432
2676
  if (typeof document === "undefined") return;
2433
2677
  var old = document.getElementById("wb-addon-" + DOMAIN + "-config-css");
@@ -2510,8 +2754,6 @@ var require_config = __commonJS({
2510
2754
  var notice = noticeS[0], setNotice = noticeS[1];
2511
2755
  var savingS = React.useState("");
2512
2756
  var savingId = savingS[0], setSavingId = savingS[1];
2513
- var draftsS = React.useState({});
2514
- var drafts = draftsS[0], setDrafts = draftsS[1];
2515
2757
  var busyS = React.useState(false);
2516
2758
  var busy = busyS[0], setBusy = busyS[1];
2517
2759
  var requestLock = React.useRef(false), mounted = React.useRef(true);
@@ -2626,40 +2868,21 @@ var require_config = __commonJS({
2626
2868
  setNotice({ id: "", text: String(e && e.message || e), error: true });
2627
2869
  }).finally(release);
2628
2870
  }
2629
- function commitDraft(item) {
2630
- if (requestLock.current) return;
2631
- var raw = drafts[item.id];
2632
- if (raw === void 0) return;
2633
- var next = String(raw).trim();
2634
- setDrafts(function(prev) {
2635
- var copy = Object.assign({}, prev);
2636
- delete copy[item.id];
2637
- return copy;
2638
- });
2639
- if (next === "") return;
2640
- var value = Number(next);
2641
- if (!Number.isFinite(value)) return;
2642
- if (sameValue(value, state.values[item.id])) return;
2643
- save(item.id, value);
2644
- }
2645
2871
  function renderControl(item) {
2646
2872
  var value = state.values[item.id];
2647
2873
  var label = lang === "en" ? item.en : item.zh;
2648
2874
  if (item.type === "bool") {
2649
- return h(
2650
- "label",
2651
- { className: PREFIX + "-cfg-switch" },
2652
- h("input", {
2653
- type: "checkbox",
2654
- disabled: locked,
2655
- checked: value === true,
2656
- onChange: function(e) {
2657
- save(item.id, e.target.checked);
2658
- }
2659
- }),
2660
- h("span", { className: PREFIX + "-cfg-track", "aria-hidden": "true" }),
2661
- h("span", { className: PREFIX + "-cfg-switchstate" }, value === true ? t.on : t.off)
2662
- );
2875
+ return h(SW.Switch, {
2876
+ h,
2877
+ checked: value === true,
2878
+ disabled: locked,
2879
+ showState: true,
2880
+ onText: t.on,
2881
+ offText: t.off,
2882
+ onChange: function(next) {
2883
+ save(item.id, next);
2884
+ }
2885
+ });
2663
2886
  }
2664
2887
  if (item.type === "enum") {
2665
2888
  return h("select", {
@@ -2677,31 +2900,17 @@ var require_config = __commonJS({
2677
2900
  }));
2678
2901
  }
2679
2902
  if (item.type === "int") {
2680
- var draft = drafts[item.id] !== void 0 ? drafts[item.id] : String(value);
2681
- return h("input", {
2682
- className: PREFIX + "-cfg-input",
2683
- disabled: locked,
2684
- type: "number",
2685
- value: draft,
2903
+ return h(NF.NumberField, {
2904
+ h,
2905
+ lang,
2906
+ value: value === void 0 ? "" : value,
2686
2907
  min: item.min,
2687
2908
  max: item.max,
2688
- "aria-label": label,
2689
- onChange: function(e) {
2690
- var v = e.target.value;
2691
- setDrafts(function(prev) {
2692
- var c = Object.assign({}, prev);
2693
- c[item.id] = v;
2694
- return c;
2695
- });
2696
- },
2697
- onBlur: function() {
2698
- commitDraft(item);
2699
- },
2700
- onKeyDown: function(e) {
2701
- if (e.key === "Enter") {
2702
- e.preventDefault();
2703
- commitDraft(item);
2704
- }
2909
+ integer: true,
2910
+ disabled: locked,
2911
+ ariaLabel: label,
2912
+ onCommit: function(next) {
2913
+ save(item.id, next);
2705
2914
  }
2706
2915
  });
2707
2916
  }
@@ -4514,13 +4723,6 @@ var require_data_style = __commonJS({
4514
4723
  "." + P + "-search input:focus{border-color:var(--dsw-alias-brand-primary,currentColor);box-shadow:0 0 0 3px color-mix(in oklab,var(--dsw-alias-brand-primary,currentColor) 14%,transparent)}",
4515
4724
  "." + P + "-select{border:1px solid var(--cfg-line);background:var(--dsw-alias-bg-base,transparent);color:inherit;border-radius:9px;padding:7px 10px;font:inherit;font-size:12px;outline:none}",
4516
4725
  "." + P + "-select:focus{border-color:var(--dsw-alias-brand-primary,currentColor);box-shadow:0 0 0 3px color-mix(in oklab,var(--dsw-alias-brand-primary,currentColor) 14%,transparent)}",
4517
- "." + P + "-switch{position:relative;display:inline-flex;align-items:center;gap:7px;cursor:pointer;font-size:12px;color:var(--cfg-muted);user-select:none;padding:4px 2px}",
4518
- "." + P + "-switch input{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}",
4519
- "." + P + "-track{position:relative;width:34px;height:20px;border-radius:999px;background:color-mix(in oklab,currentColor 18%,transparent);transition:background .16s ease;flex:none}",
4520
- "." + P + "-track::after{content:'';position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:50%;background:var(--dsw-alias-label-primary,currentColor);transition:transform .16s ease,background .16s ease}",
4521
- "." + P + "-switch input:checked+." + P + "-track{background:var(--dsw-alias-brand-primary,currentColor)}",
4522
- "." + P + "-switch input:checked+." + P + "-track::after{transform:translateX(14px);background:var(--dsw-alias-label-primary-inverted,var(--dsw-alias-bg-base))}",
4523
- "." + P + "-switch input:focus-visible+." + P + "-track{outline:2px solid var(--dsw-alias-brand-primary,currentColor);outline-offset:2px}",
4524
4726
  "." + P + "-btn{display:inline-flex;align-items:center;gap:5px;border:1px solid var(--cfg-line);background:transparent;color:var(--cfg-muted);border-radius:8px;padding:6px 10px;font:inherit;font-size:11.5px;cursor:pointer;white-space:nowrap;transition:background .12s ease,color .12s ease}",
4525
4727
  "." + P + "-btn:hover{background:var(--cfg-hover);color:var(--dsw-alias-label-primary,inherit)}",
4526
4728
  "." + P + "-btn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,currentColor);outline-offset:2px}",
@@ -4549,8 +4751,8 @@ var require_data_style = __commonJS({
4549
4751
  "." + P + "-foot{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding-top:2px;font-size:11.5px;color:var(--cfg-muted)}",
4550
4752
  "." + P + "-grow{flex:1}",
4551
4753
  "." + P + "-pageinfo{font-variant-numeric:tabular-nums}",
4552
- "." + P + "-jump{width:56px;border:1px solid var(--cfg-line);background:var(--dsw-alias-bg-base,transparent);color:inherit;border-radius:7px;padding:4px 7px;font:inherit;font-size:11.5px;text-align:right;outline:none}",
4553
- "." + P + "-jump:focus{border-color:var(--dsw-alias-brand-primary,currentColor)}",
4754
+ "." + P + "-jump .wbctl-num-input{width:56px;padding:4px 7px;font-size:11.5px;text-align:right}",
4755
+ "." + P + "-jump .wbctl-num-hint{display:none}",
4554
4756
  "." + P + "-empty{border:1px dashed var(--cfg-line);border-radius:11px;padding:44px 16px;text-align:center;font-size:12.5px;color:var(--cfg-muted)}",
4555
4757
  "." + P + "-err{display:flex;align-items:center;gap:10px;flex-wrap:wrap;border:1px solid color-mix(in oklab,var(--dsw-alias-state-error-primary,currentColor) 32%,var(--cfg-line));border-radius:10px;padding:9px 12px;color:var(--dsw-alias-state-error-primary,inherit);font-size:12px;line-height:1.5}",
4556
4758
  "." + P + "-skwrap{display:flex;flex-direction:column;gap:1px;padding:2px}",
@@ -4588,7 +4790,7 @@ var require_data_style = __commonJS({
4588
4790
  "." + P + "-images img{width:36px;height:36px;object-fit:cover;border-radius:5px}",
4589
4791
  "." + P + "-gallery{display:flex;flex-direction:column;gap:12px;overflow:auto;flex:1}",
4590
4792
  "." + P + "-gallery img{width:100%;height:auto;object-fit:contain;border-radius:8px}"
4591
- ].join("\n");
4793
+ ].concat(require_switch().styles).concat(require_number_field().styles).join("\n");
4592
4794
  if (DOMAIN === "storage") {
4593
4795
  var buttons = "." + P + " :is(button)";
4594
4796
  CSS += buttons + "{border:none;background:var(--wb-btn-bg);min-height:var(--wb-btn-size-sm);min-width:var(--wb-btn-size-sm)}" + buttons + ":enabled:hover{background:var(--wb-btn-hover-bg)}" + buttons + ":enabled:active{background:var(--wb-btn-active-bg)}" + buttons + ":disabled{background:var(--wb-btn-bg);color:var(--cfg-muted)}" + buttons + ":focus-visible{outline:var(--wb-btn-focus);outline-offset:var(--wb-btn-focus-offset)}." + P + "-fcell:has(button) input{padding-right:34px}";
@@ -4616,8 +4818,10 @@ var require_data_view = __commonJS({
4616
4818
  "packages/addons/lib/data-view.cjs"(exports2, module2) {
4617
4819
  "use strict";
4618
4820
  var React = require("react");
4821
+ var NF = require_number_field();
4619
4822
  var h = React.createElement;
4620
4823
  var COPY = require_data_copy();
4824
+ var SW = require_switch();
4621
4825
  module2.exports = function createDataView(options) {
4622
4826
  var DOMAIN = options.domain;
4623
4827
  function icon(name) {
@@ -5171,17 +5375,18 @@ var require_data_view = __commonJS({
5171
5375
  h("button", { type: "button", className: P + "-btn", disabled: !data || page >= pages, onClick: function() {
5172
5376
  setPage(Math.min(pages, page + 1));
5173
5377
  } }, t.next + " \u203A"),
5174
- h("input", {
5378
+ h(NF.NumberField, {
5379
+ h,
5380
+ lang,
5175
5381
  className: P + "-jump",
5176
- type: "number",
5382
+ value: page,
5177
5383
  min: 1,
5178
5384
  max: pages,
5179
- "aria-label": t.jump,
5180
- onKeyDown: function(e) {
5181
- if (e.key === "Enter") {
5182
- var n = Math.floor(Number(e.target.value));
5183
- if (n >= 1) setPage(Math.min(pages, n));
5184
- }
5385
+ integer: true,
5386
+ ariaLabel: t.jump,
5387
+ hint: false,
5388
+ onCommit: function(next) {
5389
+ if (next !== null) setPage(next);
5185
5390
  }
5186
5391
  }),
5187
5392
  data && data.queryMs !== void 0 ? h("span", null, fmt(t.queryTime, { n: data.queryMs })) : null
@@ -5278,25 +5483,23 @@ var require_data_view = __commonJS({
5278
5483
  }
5279
5484
  })
5280
5485
  ),
5281
- h(
5282
- "label",
5283
- { className: P + "-switch" },
5284
- h("input", { type: "checkbox", checked: includeDeleted, onChange: function(e) {
5285
- setIncludeDeleted(e.target.checked);
5486
+ h(SW.Switch, {
5487
+ h,
5488
+ checked: includeDeleted,
5489
+ label: t.includeDeleted,
5490
+ onChange: function(next) {
5491
+ setIncludeDeleted(next);
5286
5492
  setPage(1);
5287
- } }),
5288
- h("span", { className: P + "-track" }),
5289
- h("span", null, t.includeDeleted)
5290
- ),
5291
- h(
5292
- "label",
5293
- { className: P + "-switch" },
5294
- h("input", { type: "checkbox", checked: showSystem, onChange: function(e) {
5295
- setShowSystem(e.target.checked);
5296
- } }),
5297
- h("span", { className: P + "-track" }),
5298
- h("span", null, t.showSystem)
5299
- ),
5493
+ }
5494
+ }),
5495
+ h(SW.Switch, {
5496
+ h,
5497
+ checked: showSystem,
5498
+ label: t.showSystem,
5499
+ onChange: function(next) {
5500
+ setShowSystem(next);
5501
+ }
5502
+ }),
5300
5503
  h("span", { className: P + "-grow" }),
5301
5504
  h(
5302
5505
  "label",
@@ -5449,16 +5652,13 @@ var require_action_schema_style = __commonJS({
5449
5652
  "." + P + "-cardmeta{display:flex;align-items:center;flex-wrap:wrap;gap:8px;min-width:0;min-height:24px}",
5450
5653
  "." + P + "-cardhead code{font-weight:640;overflow-wrap:anywhere;min-width:0}",
5451
5654
  "." + P + "-hintline{margin:0;color:var(--dsw-alias-label-tertiary,inherit);font-size:11.5px;line-height:1.5}",
5452
- "." + P + "-toggle{display:inline-flex;align-items:center;gap:6px;min-height:24px;padding:0 2px;border:0;background:transparent;font:inherit;font-size:11.5px;color:var(--wb-muted);cursor:pointer}",
5453
- "." + P + "-track{display:inline-flex;align-items:center;box-sizing:border-box;width:30px;height:18px;padding:2px;border:1px solid var(--wb-muted);border-radius:999px;background:var(--wb-surface);color:var(--wb-muted)}",
5454
- "." + P + "-track::before{content:'';width:12px;height:12px;border-radius:50%;background:currentColor;transition:transform .15s ease}",
5455
- "." + P + "-toggle[aria-checked=true] ." + P + "-track{background:var(--wb-accent);border-color:var(--wb-accent);color:var(--wb-card)}",
5456
- "." + P + "-toggle[aria-checked=true] ." + P + "-track::before{transform:translateX(12px)}",
5457
- "." + P + "-toggle:hover:not(:disabled) ." + P + "-track{outline:1px solid var(--wb-accent)}",
5458
- "." + P + "-toggle:focus-visible{outline:2px solid var(--wb-accent);outline-offset:2px}",
5459
- "." + P + "-toggle:disabled{opacity:.6;cursor:progress}",
5460
- "@media(prefers-reduced-motion:reduce){." + P + "-track::before{transition:none}}",
5461
- // 安全约束(不可放开):用警示色描边,和可切换的开关区分开。
5655
+ "." + P + "-origins{display:inline-flex;align-items:center;gap:10px;flex-wrap:wrap;justify-content:flex-end}",
5656
+ "." + P + "-origins-label{font-size:11px;color:var(--wb-muted);white-space:nowrap}",
5657
+ "." + P + "-origin{display:inline-flex;align-items:center;gap:4px;font-size:11.5px;color:var(--wb-muted);cursor:pointer;user-select:none}",
5658
+ // 该 action 本身不支持的来源:整项置灰、不可点,示意「不是没开,是开不了」。
5659
+ "." + P + "-origin-off{opacity:.55;cursor:not-allowed}",
5660
+ "." + P + "-origin input[type=checkbox]{width:13px;height:13px;margin:0;accent-color:var(--wb-accent);cursor:inherit}",
5661
+ "." + P + "-origin input[type=checkbox]:focus-visible{outline:2px solid var(--wb-accent);outline-offset:2px}",
5462
5662
  "." + P + "-locked{border-color:var(--wb-warn,#b7791f);color:var(--wb-warn,#b7791f)}",
5463
5663
  "." + P + "-desc{margin:0;color:var(--dsw-alias-label-secondary,inherit);line-height:1.55;font-size:12.5px}",
5464
5664
  // 搜索命中:用品牌色透明度叠加而不是写死浅色,深浅主题都可读;继承文字颜色、不覆盖 ::selection。
@@ -5511,15 +5711,20 @@ var require_action_schema_view = __commonJS({
5511
5711
  zh: {
5512
5712
  title: "Action",
5513
5713
  hint: "\u8FD0\u884C\u65F6\u6CE8\u518C \xB7 \u53EA\u8BFB",
5514
- switchHint: "agent \u5F00\u5173\u843D\u672C\u673A\u3001\u5373\u6539\u5373\u751F\u6548\uFF1B\u754C\u9762\u64CD\u4F5C\u4E0D\u53D7\u5F71\u54CD\u3002",
5515
- hostHint: "\u5BBF\u4E3B action \u7684 agent \u5F00\u5173\uFF1B\u6807\u300C\u4EC5\u754C\u9762 \xB7 \u5B89\u5168\u7EA6\u675F\u300D\u7684\u4E0D\u53EF\u653E\u5F00\u3002",
5516
- agentSwitch: "agent \u53EF\u7528",
5517
- agentLocked: "\u4EC5\u754C\u9762 \xB7 \u5B89\u5168\u7EA6\u675F",
5518
- agentLockedHint: "\u8BE5 action \u53EA\u80FD\u5728\u754C\u9762\u6267\u884C\uFF08\u5B89\u5168\u7EA6\u675F\uFF09\uFF0Cagent \u5F00\u5173\u4E0D\u53EF\u653E\u5F00",
5519
- agentSaving: "\u4FDD\u5B58\u4E2D\u2026",
5520
- agentOnToast: "\u5DF2\u5141\u8BB8 agent \u8C03\u7528",
5521
- agentOffToast: "\u5DF2\u7981\u6B62 agent \u8C03\u7528",
5522
- agentFail: "\u5207\u6362 agent \u5F00\u5173\u5931\u8D25",
5714
+ switchHint: "\u5141\u8BB8\u6765\u6E90\u843D\u672C\u673A\u3001\u5373\u6539\u5373\u751F\u6548\uFF1A\u52FE\u4E0A\u7684\u6765\u6E90\u624D\u80FD\u8C03\u7528\u8BE5 action\uFF0C\u5176\u4F59\u4F1A\u88AB ACTION_ORIGIN_DENIED \u62E6\u4E0B\u3002",
5715
+ hostHint: "\u5BBF\u4E3B action \u7684\u5141\u8BB8\u6765\u6E90\uFF1B\u6807\u300C\u6765\u6E90\u56FA\u5B9A\u300D\u7684\u4E0D\u53EF\u4FEE\u6539\u3002",
5716
+ originsLabel: "\u5141\u8BB8\u6765\u6E90",
5717
+ originUi: "\u754C\u9762",
5718
+ originPlugin: "\u63D2\u4EF6",
5719
+ originAgent: "agent",
5720
+ originSync: "\u540C\u6B65",
5721
+ originsSaving: "\u4FDD\u5B58\u4E2D\u2026",
5722
+ originsToast: "\u5DF2\u66F4\u65B0\u5141\u8BB8\u6765\u6E90",
5723
+ originsFail: "\u66F4\u65B0\u5141\u8BB8\u6765\u6E90\u5931\u8D25",
5724
+ originsEmpty: "\u81F3\u5C11\u8981\u4FDD\u7559\u4E00\u4E2A\u6765\u6E90",
5725
+ originsUnsupported: "\u8BE5 action \u672C\u8EAB\u4E0D\u652F\u6301\u8FD9\u4E2A\u6765\u6E90",
5726
+ originsPinned: "\u6765\u6E90\u56FA\u5B9A",
5727
+ originsPinnedHint: "\u8BE5 action \u7684\u5141\u8BB8\u6765\u6E90\u88AB\u56FA\u5B9A\uFF08\u5B89\u5168\u7EA6\u675F\uFF09\uFF0C\u4E0D\u80FD\u4FEE\u6539",
5523
5728
  domain: "\u57DF",
5524
5729
  versionLabel: "\u7248\u672C",
5525
5730
  shell: "\u5BBF\u4E3B",
@@ -5533,6 +5738,8 @@ var require_action_schema_view = __commonJS({
5533
5738
  onlyOptional: "\u65E0\u5FC5\u586B\u9879",
5534
5739
  filterType: "\u53C2\u6570\u7C7B\u578B",
5535
5740
  allTypes: "\u5168\u90E8\u7C7B\u578B",
5741
+ filterOrigin: "\u5141\u8BB8\u6765\u6E90",
5742
+ allOrigins: "\u5168\u90E8\u6765\u6E90",
5536
5743
  colName: "\u53C2\u6570",
5537
5744
  colType: "\u7C7B\u578B",
5538
5745
  colReq: "\u5FC5\u586B",
@@ -5565,15 +5772,22 @@ var require_action_schema_view = __commonJS({
5565
5772
  en: {
5566
5773
  title: "Actions",
5567
5774
  hint: "runtime registry \xB7 read-only",
5568
- switchHint: "The agent switch is stored locally and applies immediately; UI actions are unaffected.",
5569
- hostHint: "Agent switch for host actions; items marked UI-only (security) cannot be opened up.",
5570
- agentSwitch: "Agent callable",
5571
- agentLocked: "UI only \xB7 security",
5572
- agentLockedHint: "This action can only run from the UI (security constraint); the agent switch cannot be opened",
5573
- agentSaving: "Saving\u2026",
5574
- agentOnToast: "Agent calls allowed",
5575
- agentOffToast: "Agent calls blocked",
5576
- agentFail: "Failed to change the agent switch",
5775
+ switchHint: "Allowed origins are stored locally and apply immediately: only checked origins may call the action; others get ACTION_ORIGIN_DENIED.",
5776
+ hostHint: "Allowed origins for host actions; items marked pinned cannot be changed.",
5777
+ originsLabel: "Origins",
5778
+ originUi: "UI",
5779
+ originPlugin: "Plugin",
5780
+ originAgent: "Agent",
5781
+ originSync: "Sync",
5782
+ originsSaving: "Saving\u2026",
5783
+ originsToast: "Allowed origins updated",
5784
+ originsFail: "Failed to update allowed origins",
5785
+ originsEmpty: "Keep at least one origin",
5786
+ originsUnsupported: "This action does not support this origin",
5787
+ originsPinned: "Pinned",
5788
+ originsPinnedHint: "Allowed origins are pinned for this action (security constraint) and cannot be changed",
5789
+ originsDefaultOn: "Allowed by default",
5790
+ originsDefaultOff: "Off by default, can be enabled",
5577
5791
  domain: "Domain",
5578
5792
  versionLabel: "Version",
5579
5793
  shell: "Host",
@@ -5587,6 +5801,8 @@ var require_action_schema_view = __commonJS({
5587
5801
  onlyOptional: "No required",
5588
5802
  filterType: "Param type",
5589
5803
  allTypes: "All types",
5804
+ filterOrigin: "Origins",
5805
+ allOrigins: "All origins",
5590
5806
  colName: "Param",
5591
5807
  colType: "Type",
5592
5808
  colReq: "Required",
@@ -5730,6 +5946,8 @@ var require_action_schema_view = __commonJS({
5730
5946
  var reqMode = reqState[0], setReqMode = reqState[1];
5731
5947
  var typeState = React.useState("");
5732
5948
  var typePick = typeState[0], setTypePick = typeState[1];
5949
+ var originFilterState = React.useState("");
5950
+ var originPick = originFilterState[0], setOriginPick = originFilterState[1];
5733
5951
  var toastState = React.useState("");
5734
5952
  var toast = toastState[0], setToast = toastState[1];
5735
5953
  var savingState = React.useState("");
@@ -5785,38 +6003,53 @@ var require_action_schema_view = __commonJS({
5785
6003
  plainCopy(text);
5786
6004
  done();
5787
6005
  }
5788
- function setAgent(action, next) {
6006
+ var ORIGINS = ["ui", "plugin", "agent", "sync"];
6007
+ var originText = { ui: t.originUi, plugin: t.originPlugin, agent: t.originAgent, sync: t.originSync };
6008
+ function setOrigins(action, origin) {
5789
6009
  var name = action.name;
6010
+ var current = Array.isArray(action.origins) ? action.origins.slice() : [];
6011
+ var index = current.indexOf(origin);
6012
+ var next = index >= 0 ? current.filter(function(o) {
6013
+ return o !== origin;
6014
+ }) : current.concat([origin]);
6015
+ if (next.length === 0) {
6016
+ setToast(t.originsEmpty);
6017
+ return;
6018
+ }
6019
+ next = ORIGINS.filter(function(o) {
6020
+ return next.indexOf(o) >= 0;
6021
+ });
5790
6022
  setSaving(name);
5791
6023
  setToast("");
5792
6024
  var fail = function(e) {
5793
6025
  setSaving("");
5794
- setToast(t.agentFail + "\uFF1A" + String(e && e.message || e || ""));
6026
+ setToast(t.originsFail + "\uFF1A" + String(e && e.message || e || ""));
5795
6027
  };
5796
6028
  var done = function(r) {
5797
6029
  setSaving("");
5798
6030
  var payload = r && typeof r === "object" && Object.prototype.hasOwnProperty.call(r, "result") ? r.result : r;
5799
6031
  if (r && r.ok === false) {
5800
- setToast(t.agentFail + "\uFF1A" + String(r.error || r.text || ""));
6032
+ setToast(t.originsFail + "\uFF1A" + String(r.error || r.text || ""));
5801
6033
  return;
5802
6034
  }
5803
- var value = payload && typeof payload.agentEnabled === "boolean" ? payload.agentEnabled : next;
6035
+ var value = payload && Array.isArray(payload.origins) ? payload.origins : next;
6036
+ var source = payload && typeof payload.source === "string" ? payload.source : action.originsSource;
5804
6037
  setSnap(function(prev) {
5805
6038
  if (!prev || !Array.isArray(prev.actions)) return prev;
5806
6039
  return Object.assign({}, prev, {
5807
6040
  actions: prev.actions.map(function(a) {
5808
6041
  if (!a || a.name !== name) return a;
5809
- return Object.assign({}, a, { agentEnabled: value });
6042
+ return Object.assign({}, a, { origins: value, originsSource: source });
5810
6043
  })
5811
6044
  });
5812
6045
  });
5813
- setToast(value ? t.agentOnToast : t.agentOffToast);
6046
+ setToast(t.originsToast);
5814
6047
  };
5815
6048
  if (!api || typeof api.call !== "function") {
5816
6049
  fail(new Error("no call api"));
5817
6050
  return;
5818
6051
  }
5819
- Promise.resolve(api.call("actions.setAgentAccess", { action: name, agentEnabled: next })).then(done, fail);
6052
+ Promise.resolve(api.call("actions.setActionOrigins", { action: name, origins: next })).then(done, fail);
5820
6053
  }
5821
6054
  var all = snap && Array.isArray(snap.actions) ? snap.actions.filter(function(a) {
5822
6055
  return a && a.domain === DOMAIN;
@@ -5851,6 +6084,7 @@ var require_action_schema_view = __commonJS({
5851
6084
  if (typePick && !rows.some(function(row) {
5852
6085
  return row.types.indexOf(typePick) >= 0;
5853
6086
  })) return false;
6087
+ if (originPick && (!Array.isArray(a.origins) || a.origins.indexOf(originPick) < 0)) return false;
5854
6088
  return true;
5855
6089
  });
5856
6090
  function paramRow(row) {
@@ -5866,33 +6100,45 @@ var require_action_schema_view = __commonJS({
5866
6100
  h("td", null, Highlight.hit(row.description, kw))
5867
6101
  );
5868
6102
  }
5869
- function agentSwitch(action) {
5870
- if (action.agentLocked === true) {
5871
- return h("span", {
5872
- className: P + "-badge " + P + "-locked",
5873
- title: t.agentLockedHint,
5874
- "data-agent-locked": action.name
5875
- }, t.agentLocked);
6103
+ function originsChips(action) {
6104
+ if (!Array.isArray(action.origins)) return null;
6105
+ if (action.originsSource === "invalid") {
6106
+ return h("span", { className: P + "-badge " + P + "-locked", title: t.originsPinnedHint, "data-origins-invalid": action.name }, t.originsPinned);
5876
6107
  }
5877
- if (typeof action.agentEnabled !== "boolean") return null;
5878
6108
  var busy = saving === action.name;
6109
+ var pinned = action.name === "actions.setActionOrigins";
6110
+ var supported = Array.isArray(action.originsDeclared) ? action.originsDeclared : action.origins;
5879
6111
  return h(
5880
- "button",
5881
- {
5882
- className: P + "-toggle",
5883
- "data-agent-row": action.name,
5884
- type: "button",
5885
- role: "switch",
5886
- "aria-checked": action.agentEnabled,
5887
- disabled: busy,
5888
- "data-agent-toggle": action.name,
5889
- "aria-label": t.agentSwitch + " \xB7 " + action.name,
5890
- onClick: function() {
5891
- setAgent(action, !action.agentEnabled);
5892
- }
5893
- },
5894
- h("span", { className: P + "-track", "aria-hidden": true }),
5895
- h("span", null, busy ? t.agentSaving : t.agentSwitch)
6112
+ "div",
6113
+ { className: P + "-origins", "data-origins-row": action.name },
6114
+ h("span", { className: P + "-origins-label" }, t.originsLabel),
6115
+ ORIGINS.map(function(origin) {
6116
+ var on = action.origins.indexOf(origin) >= 0;
6117
+ var allowed = supported.indexOf(origin) >= 0;
6118
+ var preset = Array.isArray(action.originsDefault) ? action.originsDefault : supported;
6119
+ var byDefault = preset.indexOf(origin) >= 0;
6120
+ return h(
6121
+ "label",
6122
+ {
6123
+ key: origin,
6124
+ className: P + "-origin" + (allowed ? "" : " " + P + "-origin-off"),
6125
+ title: pinned ? t.originsPinnedHint : !allowed ? t.originsUnsupported : originText[origin] + " \xB7 " + action.name + " \xB7 " + (byDefault ? t.originsDefaultOn : t.originsDefaultOff)
6126
+ },
6127
+ h("input", {
6128
+ type: "checkbox",
6129
+ checked: on,
6130
+ disabled: busy || pinned || !allowed,
6131
+ "data-origin": origin,
6132
+ "data-origin-row": action.name,
6133
+ "data-origin-supported": allowed ? "1" : "0",
6134
+ onChange: function() {
6135
+ setOrigins(action, origin);
6136
+ }
6137
+ }),
6138
+ h("span", null, originText[origin])
6139
+ );
6140
+ }),
6141
+ busy ? h("span", { className: P + "-origins-label" }, t.originsSaving) : null
5896
6142
  );
5897
6143
  }
5898
6144
  function card(action) {
@@ -5913,7 +6159,7 @@ var require_action_schema_view = __commonJS({
5913
6159
  return row.required;
5914
6160
  }) ? h("span", { className: P + "-badge " + P + "-req" }, t.required) : null
5915
6161
  ),
5916
- agentSwitch(action)
6162
+ originsChips(action)
5917
6163
  ),
5918
6164
  action.description ? h("p", { className: P + "-desc" }, Highlight.hit(action.description, kw)) : null,
5919
6165
  rows.length ? h(
@@ -6036,6 +6282,21 @@ var require_action_schema_view = __commonJS({
6036
6282
  return h("option", { value: name, key: name }, name);
6037
6283
  })
6038
6284
  )
6285
+ ),
6286
+ h(
6287
+ "label",
6288
+ { className: P + "-none" },
6289
+ t.filterOrigin + " ",
6290
+ h(
6291
+ "select",
6292
+ { value: originPick, "aria-label": t.filterOrigin, "data-origin-filter": "", onChange: function(e) {
6293
+ setOriginPick(e.target.value);
6294
+ } },
6295
+ h("option", { value: "" }, t.allOrigins),
6296
+ ORIGINS.map(function(origin) {
6297
+ return h("option", { value: origin, key: origin }, originText[origin]);
6298
+ })
6299
+ )
6039
6300
  )
6040
6301
  ) : null,
6041
6302
  body,
@@ -6129,7 +6390,6 @@ var require_copy = __commonJS({
6129
6390
  nodeDescPh: "\u5199\u6E05\u8FD9\u5F20\u8868\u662F\u505A\u4EC0\u4E48\u7684\uFF0C\u4EE5\u540E\u53EF\u6309\u63CF\u8FF0\u5173\u952E\u8BCD\u68C0\u7D22\u5B9A\u4F4D",
6130
6391
  needName: "\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A",
6131
6392
  nodeDescSave: "\u63CF\u8FF0\u5DF2\u4FDD\u5B58",
6132
- editTitle: "\u7F16\u8F91\u4EFB\u52A1",
6133
6393
  deleteConfirm: "\u786E\u5B9A\u5220\u9664\u8FD9\u4E2A\u8282\u70B9\u53CA\u5176\u5B50\u6811\uFF1F\u5B50\u6811\u4E2D\u7684\u4EFB\u52A1\u4F1A\u88AB\u8F6F\u5220\u9664\u3002",
6134
6394
  deleteTaskConfirm: "\u786E\u5B9A\u5220\u9664\u8FD9\u6761\u4EFB\u52A1\u5417\uFF1F\u5220\u9664\u540E\u4E0D\u53EF\u6062\u590D\u3002",
6135
6395
  batchDelete: "\u6279\u91CF\u5220\u9664",
@@ -6296,7 +6556,6 @@ var require_copy = __commonJS({
6296
6556
  nodeDescPh: "Say what this table is for; agents can find it by description keywords",
6297
6557
  needName: "Name is required",
6298
6558
  nodeDescSave: "Description saved",
6299
- editTitle: "Edit task",
6300
6559
  deleteConfirm: "Delete this node and its subtree? Tasks under it will be soft-deleted.",
6301
6560
  deleteTaskConfirm: "Delete this task? This cannot be undone.",
6302
6561
  batchDelete: "Delete",
@@ -7652,6 +7911,7 @@ var require_icons2 = __commonJS({
7652
7911
  tag: (init_tag(), __toCommonJS(tag_exports)).default,
7653
7912
  clock: (init_clock(), __toCommonJS(clock_exports)).default,
7654
7913
  refresh: (init_refresh_cw(), __toCommonJS(refresh_cw_exports)).default
7914
+ // 「原邮件」回链:从邮件建出来的任务要能跳回去看一眼原文。
7655
7915
  }, {});
7656
7916
  module2.exports = { ICONS: set.ICONS, Icon: set.Icon };
7657
7917
  }
@@ -8796,7 +9056,7 @@ var require_styles = __commonJS({
8796
9056
  ".wbt-body{display:flex;gap:14px;align-items:stretch;min-height:0;flex:1;overflow:hidden}",
8797
9057
  ".wbt-filter-panel{flex:0 0 248px;width:248px;min-width:0;max-height:100%;overflow-y:auto;overscroll-behavior:contain;border:1px solid var(--wbt-line);border-radius:10px;background:var(--wbt-bg);box-sizing:border-box;padding:12px}",
8798
9058
  ".wbt-filter-content{display:flex;flex-direction:column;gap:12px}.wbt-filter-toggle{display:none}.wbt-filter-group{display:flex;flex-direction:column;gap:8px;min-width:0;margin:0;padding:10px 0;border:0;border-bottom:1px solid var(--wbt-line)}.wbt-filter-group legend{font-weight:600;padding:0}.wbt-filter-search{display:flex;gap:4px}.wbt-filter-search input{width:100%;min-width:0}.wbt-filter-panel .wbt-check{white-space:normal}.wbt-filter-panel .wbt-tagmenu{position:static;width:100%;box-sizing:border-box;max-height:240px}.wbt-filter-panel .wbt-tagfilter{flex-wrap:wrap}.wbt-filter-panel input:disabled{opacity:.45;cursor:not-allowed}.wbt-filter-panel .wbt-mhint{margin:0;line-height:1.6}.wbt-filter-panel .wbt-field input{width:100%;box-sizing:border-box}",
8799
- ".wbt-limit-row{display:flex;flex-direction:column;gap:4px;min-width:0}.wbt-limit-head{display:flex;align-items:baseline;gap:6px;flex-wrap:wrap;min-width:0}.wbt-limit-hint{margin:0;font-size:11.5px;line-height:1.6;opacity:.65;overflow-wrap:anywhere}.wbt-limit-head>strong{font-weight:560;font-size:12.5px;flex:none}.wbt-limit-fields{display:flex;align-items:center;gap:4px;min-width:0}.wbt-limit-fields input{flex:1 1 0;width:0;min-width:0;box-sizing:border-box;text-align:center;padding-left:6px;padding-right:6px}.wbt-limit-fields .wbt-limit-input{background-color:var(--wbt-surface);border:1px solid var(--wbt-line);border-radius:8px;padding:6px 4px;font-size:13px;color:inherit;font-variant-numeric:tabular-nums;-moz-appearance:textfield;appearance:textfield}.wbt-limit-fields .wbt-limit-input:focus{border-color:var(--wbt-accent);outline:none;box-shadow:0 0 0 3px color-mix(in oklab,var(--wbt-accent) 18%,transparent)}.wbt-limit-fields .wbt-limit-input::-webkit-outer-spin-button,.wbt-limit-fields .wbt-limit-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.wbt-limit-fields>span{flex:none;opacity:.55;font-size:11.5px}.wbt-limit-clear{flex:none;padding:2px 6px;line-height:1.2}.wbt-limit-unit{font-size:11px;opacity:.55;overflow-wrap:anywhere;min-width:0}",
9059
+ ".wbt-limit-row{display:flex;flex-direction:column;gap:4px;min-width:0}.wbt-limit-head{display:flex;align-items:baseline;gap:6px;flex-wrap:wrap;min-width:0}.wbt-limit-hint{margin:0;font-size:11.5px;line-height:1.6;opacity:.65;overflow-wrap:anywhere}.wbt-limit-head>strong{font-weight:560;font-size:12.5px;flex:none}.wbt-limit-fields{display:flex;align-items:flex-start;gap:4px;min-width:0}.wbt-limit-fields .wbctl-num{flex:1 1 0;min-width:0;width:0}.wbt-limit-fields .wbctl-num-box{width:100%}.wbt-limit-fields .wbctl-num-input{width:100%;box-sizing:border-box;text-align:center;padding:6px 4px;border-radius:8px;border-color:var(--wbt-line);background-color:var(--wbt-surface)}.wbt-limit-fields>span{flex:none;opacity:.55;font-size:11.5px}.wbt-limit-fields .wbt-limit-join{padding-top:7px}.wbt-limit-fields .wbt-limit-clear{margin-top:1px}.wbt-limit-clear{flex:none;padding:2px 6px;line-height:1.2}.wbt-limit-fields .wbctl-num-err{overflow-wrap:anywhere}.wbt-limit-unit{font-size:11px;opacity:.55;overflow-wrap:anywhere;min-width:0}",
8800
9060
  ".wbt-presets{gap:6px}.wbt-preset-list{display:flex;flex-wrap:wrap;gap:6px}.wbt-preset{padding:4px 9px;border:1px solid var(--wbt-line);border-radius:999px;background:var(--wbt-surface);color:inherit;font-size:12px;line-height:1.5;white-space:normal}.wbt-preset:hover{border-color:var(--wbt-accent)}.wbt-preset.active{background:var(--wbt-accent);border-color:var(--wbt-accent);color:#fff}.wbt-preset:focus-visible{outline:2px solid var(--wbt-accent);outline-offset:2px}.wbt-target-group{gap:8px}",
8801
9061
  ".wbt-status-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px 8px}.wbt-status-grid .wbt-check{min-width:0;overflow-wrap:anywhere}.wbt-pathrow>.wbt-sum{flex:none;white-space:nowrap}",
8802
9062
  ".wbt-nav{display:flex;flex-direction:column;gap:2px;flex:0 0 138px;width:138px;padding:3px 0;border-right:1px solid var(--wbt-line)}",
@@ -8964,7 +9224,14 @@ var require_styles = __commonJS({
8964
9224
  ".wbt-form{display:grid;grid-template-columns:1fr 1fr;gap:9px}",
8965
9225
  ".wbt-field{display:flex;flex-direction:column;gap:4px;font-size:12px;min-width:0}",
8966
9226
  ".wbt-field.full{grid-column:1 / -1}",
8967
- ".wbt-field>span{opacity:.62;font-size:11.5px}",
9227
+ ".wbt-create-tl{grid-column:1 / -1;display:flex;flex-direction:column;gap:6px;min-width:0;padding:9px 10px;border:1px solid var(--wbt-line);border-radius:10px;background:color-mix(in oklab,var(--wbt-accent) 4%,transparent);box-sizing:border-box}",
9228
+ ".wbt-create-tl-head{display:flex;align-items:baseline;gap:8px;min-width:0;font-size:12px}",
9229
+ ".wbt-create-tl-head>span:first-child{font-weight:600}",
9230
+ ".wbt-create-tl-hint{font-size:11px;opacity:.55;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
9231
+ ".wbt-create-tl .wbt-timeline-picker{display:flex;flex-direction:column;gap:6px;min-width:0}",
9232
+ ".wbt-create-tl .wbt-picker-list{max-height:180px;scrollbar-gutter:stable}",
9233
+ ".wbt-create-tl .wbt-timeline-pager{margin-top:4px;font-size:11.5px}",
9234
+ ".wbt-field>span{opacity:.62;font-size:11.5px}.wbt-field>span.wbctl-num{opacity:1;font-size:12px;align-self:stretch}.wbt-field .wbt-difficulty-num{width:110px}",
8968
9235
  ".wbt-modal-foot{display:flex;gap:8px;justify-content:flex-end;align-items:center;margin-top:2px}",
8969
9236
  // 预览面板:只让内容区滚动,头部标题与右上角 × 固定不动(滚动壳限定在 .wbt-preview,不影响其它弹窗)。
8970
9237
  ".wbt-preview{overflow:hidden}",
@@ -9023,8 +9290,80 @@ var require_styles = __commonJS({
9023
9290
  ".wbt-countdown.overdue{color:var(--dsw-alias-label-primary-inverted,#fff);background:var(--dsw-alias-state-error-primary,#e5484d);border-color:transparent}",
9024
9291
  "@media (max-width:760px){.wbt-body{flex-direction:column;gap:8px}.wbt-nav{flex-direction:row;width:100%;flex:0 0 auto;overflow-x:auto;border-right:none;border-bottom:1px solid var(--wbt-line);padding:0 0 6px}.wbt-tab{width:auto;white-space:nowrap;padding:6px 9px}.wbt-tab.on{box-shadow:inset 0 -2px 0 var(--wbt-accent)}.wbt-nav-sep{width:1px;height:18px;flex:none;margin:auto 4px}.wbt-tree-slot{flex:0 0 auto;width:auto;margin-right:0}.wbt-pathrow .wbt-search{flex:1 1 160px;max-width:none}}",
9025
9292
  "@media (max-width:760px){.wbt-filter-panel{width:100%;flex:0 0 auto;padding:8px;max-height:40%}.wbt-filter-toggle{display:inline-flex}.wbt-filter-panel:not(.expanded) .wbt-filter-content{display:none}.wbt-filter-panel.expanded .wbt-filter-content{padding-top:10px}.wbt-content{width:100%;box-sizing:border-box}}",
9026
- "@media (max-width:640px){.wbt-form{grid-template-columns:1fr}.wbt-drawer{width:94vw}.wbt-search{width:100%}.wbt-item{padding:9px}.wbt-ops{width:100%;justify-content:flex-end}}"
9027
- ].concat(require_filter_checklist_styles(), require_date_picker_styles()("wbt")).join("\n");
9293
+ "@media (max-width:640px){.wbt-form{grid-template-columns:1fr}.wbt-drawer{width:94vw}.wbt-search{width:100%}.wbt-item{padding:9px}.wbt-ops{width:100%;justify-content:flex-end}}",
9294
+ // ── 插槽贡献:渲染在别的插件的界面里(如邮件详情动作条) ──
9295
+ // 那里没有 .wbt-root,--wbt-* 变量不存在,所以每个变量都带主题变量兜底。
9296
+ ".wbt-metazone:empty{display:none}",
9297
+ ".wbtx-slot{position:relative;display:inline-flex;align-items:center;gap:6px}",
9298
+ ".wbtx-slot-btn{font-size:12.5px;white-space:nowrap}",
9299
+ ".wbtx-slot-btn[aria-expanded=true]{border-color:var(--wbt-accent,var(--wb-accent));color:var(--wbt-accent,var(--wb-accent))}",
9300
+ ".wbtx-slot-panel{position:absolute;top:calc(100% + 6px);right:0;z-index:40;display:flex;flex-direction:column;gap:8px;width:264px;padding:10px;border-radius:10px;border:1px solid var(--wbt-line,var(--wb-border));background:var(--dsw-alias-bg-layer-1,var(--wb-card,transparent));box-shadow:0 12px 28px color-mix(in oklab,var(--wbt-line,var(--wb-border)) 60%,transparent);text-align:left}",
9301
+ ".wbtx-slot-row{display:flex;flex-direction:column;gap:4px;font-size:11.5px;color:var(--wbt-muted,var(--wb-muted))}",
9302
+ ".wbtx-slot-input{width:100%;box-sizing:border-box;font-size:12.5px}",
9303
+ ".wbtx-slot-muted{font-size:12px;color:var(--wbt-muted,var(--wb-muted))}",
9304
+ ".wbtx-slot-foot{display:flex;justify-content:flex-end;gap:8px}",
9305
+ ".wbtx-slot-done{display:inline-flex;align-items:center;gap:8px;font-size:12px}",
9306
+ ".wbtx-slot-note{color:var(--wbt-muted,var(--wb-muted))}",
9307
+ ".wbtx-slot-link{border:0;background:transparent;padding:0;font:inherit;font-size:12px;color:var(--wbt-accent,var(--wb-accent));cursor:pointer;text-decoration:underline}",
9308
+ ".wbt-mailback{font-size:11.5px;padding:2px 7px}"
9309
+ ].concat(require_filter_checklist_styles(), require_date_picker_styles()("wbt"), require_switch().styles, require_number_field().styles).join("\n");
9310
+ }
9311
+ });
9312
+
9313
+ // packages/addons/tasks/client/timeline/timeline-styles.cjs
9314
+ var require_timeline_styles = __commonJS({
9315
+ "packages/addons/tasks/client/timeline/timeline-styles.cjs"(exports2, module2) {
9316
+ "use strict";
9317
+ module2.exports = [
9318
+ ".wbt-timeline-view{padding:0;color:inherit;box-sizing:border-box;overflow:auto}",
9319
+ ".wbt-timeline-toolbar,.wbt-timeline-search,.wbt-timeline-pager,.wbt-timeline-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
9320
+ ".wbt-timeline-toolbar{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;margin-bottom:12px}",
9321
+ ".wbt-timeline-toolbar-main{display:flex;align-items:center;gap:8px;flex:1 1 320px;min-width:0;flex-wrap:wrap}",
9322
+ ".wbt-timeline-toolbar-main .wbt-timeline-search{flex:1 1 220px;min-width:0}",
9323
+ ".wbt-timeline-toolbar-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-left:auto}",
9324
+ ".wbt-timeline-columns{display:grid;grid-template-columns:minmax(240px,32%) minmax(0,1fr);gap:12px;align-items:start}",
9325
+ ".wbt-timeline-left,.wbt-timeline-right{min-width:0;border:1px solid var(--wbt-line);border-radius:var(--wb-radius-card,10px);padding:12px}",
9326
+ ".wbt-timeline-search input{min-width:0;flex:1}",
9327
+ ".wbt-timeline-list{max-height:840px;overflow:auto;overscroll-behavior:contain}.wbt-timeline-left>.wbt-timeline-list,.wbt-timeline-left>.wbt-err{margin-top:2px}.wbt-timeline-view .wbt-timeline-option{position:relative;box-sizing:border-box;min-height:56px;padding:10px 12px;border:0;border-bottom:1px solid var(--wbt-line);border-radius:var(--wb-radius-sm,6px);display:flex;flex-direction:column;gap:4px;cursor:pointer;color:inherit;background:transparent;background-image:none}",
9328
+ ".wbt-timeline-option-title{display:flex;gap:8px;align-items:center;min-width:0}.wbt-timeline-option-title strong{font-size:13px;font-weight:560;line-height:1.4;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}.wbt-timeline-option>span{font-size:11.5px;opacity:.6;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}",
9329
+ ".wbt-timeline-option>.wbt-timeline-excerpt{display:block;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}",
9330
+ ".wbt-timeline-view .wbt-timeline-option.current{box-shadow:inset 3px 0 var(--wbt-accent),inset 0 0 0 1px var(--wbt-line);background:color-mix(in oklab,var(--wbt-accent) 8%,transparent);background-image:none}.wbt-timeline-view .wbt-timeline-option:hover{background:color-mix(in oklab,var(--wbt-accent) 12%,transparent)}",
9331
+ ".wbt-timeline-option:focus-visible,.wbt-timeline-view button:focus-visible,.wbt-timeline-modal button:focus-visible{outline:2px solid var(--wbt-accent);outline-offset:2px}.wbt-timeline-option input[type=checkbox]{appearance:auto;width:15px;height:15px;flex:none;accent-color:var(--wbt-accent)}",
9332
+ ".wbt-timeline-pager{justify-content:space-between;font-size:12px;margin-top:12px}.wbt-timeline-right h3,.wbt-timeline-summary h4{font-size:15px;font-weight:600;margin:0 0 8px;overflow-wrap:anywhere}.wbt-timeline-eyebrow{font-size:11.5px;opacity:.55;margin-bottom:4px;overflow-wrap:anywhere}",
9333
+ ".wbt-timeline-summary{min-width:0}.wbt-timeline-desc{max-height:64px;overflow:hidden;margin:0 0 8px;white-space:pre-wrap;overflow-wrap:anywhere}.wbt-timeline-actions{margin:8px 0}.wbt-timeline-actions>.wbt-act-del{margin-left:auto}",
9334
+ ".wbt-timeline-right>.wbt-timeline-members{min-height:0;max-height:65vh;overflow-y:auto;overscroll-behavior-y:contain;scrollbar-gutter:stable}",
9335
+ // Scoped reset defeats ordinary host button surfaces without touching unrelated task controls.
9336
+ ":is(.wbt-timeline-view,.wbt-timeline-modal) button:is(.wbt-timeline-member,.wbt-timeline-remove,.wbt-timeline-id){appearance:none;background:transparent;background-image:none;color:inherit;border:0;box-shadow:none;border-radius:var(--wb-radius-sm,6px);font:inherit;cursor:pointer;min-width:0;min-height:0;width:auto;margin:0}",
9337
+ ":is(.wbt-timeline-view,.wbt-timeline-modal) .wbt-timeline-id{display:inline-flex;align-items:center;gap:4px;padding:4px;max-width:180px}.wbt-timeline-id code{font-size:11.5px;opacity:.5;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
9338
+ ":is(.wbt-timeline-view,.wbt-timeline-modal) .wbt-act-del{color:var(--dsw-alias-state-error-primary,var(--wbt-accent));background:transparent;border-color:var(--wbt-line)}",
9339
+ '.wbt-timeline-members{list-style:none;padding:0;margin:8px 0;min-width:0}.wbt-timeline-member-row{display:grid;grid-template-columns:92px 14px minmax(0,1fr) auto 28px;gap:8px;align-items:center;min-height:40px;position:relative;padding:0;margin:0}.wbt-timeline-date{font-size:11.5px;font-variant-numeric:tabular-nums;text-align:right;white-space:nowrap;opacity:.7}.wbt-timeline-node{align-self:stretch;position:relative}.wbt-timeline-node:before{content:"";position:absolute;width:1px;left:50%;top:0;bottom:0;background:var(--wbt-line)}.wbt-timeline-node:after{content:"";position:absolute;width:6px;height:6px;left:calc(50% - 2.5px);top:calc(50% - 3px);border-radius:50%;background:var(--wbt-accent)}',
9340
+ ":is(.wbt-timeline-view,.wbt-timeline-modal) button.wbt-timeline-member{padding:8px 0;text-align:left;font-size:13px;line-height:1.5;overflow-wrap:anywhere;white-space:normal}:is(.wbt-timeline-view,.wbt-timeline-modal) button.wbt-timeline-member:hover{text-decoration:underline;text-underline-offset:3px}:is(.wbt-timeline-view,.wbt-timeline-modal) button.wbt-timeline-remove{display:flex;justify-content:center;align-items:center;width:28px;height:28px;padding:4px;opacity:.35}:is(.wbt-timeline-view,.wbt-timeline-modal) button.wbt-timeline-remove:is(:hover,:focus-visible){opacity:.9;background:var(--wbt-surface)}.wbt-timeline-member-row>.wbt-badge{white-space:nowrap;margin:0}.wbt-timeline-remove:disabled{cursor:default}",
9341
+ ".wbt-timeline-member-footer{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;border-top:1px solid var(--wbt-line);padding-top:8px}.wbt-timeline-member-footer>span{font-size:11.5px;opacity:.65}.wbt-timeline-member-footer .wbt-timeline-pager{margin:0}",
9342
+ ".wbt-modal.wide.wbt-timeline-modal{display:flex;flex-direction:column;max-height:90vh;overflow:hidden}.wbt-timeline-modal-body{min-height:0;overflow:auto;flex:1;padding:12px}.wbt-timeline-member-section{min-width:0;margin-top:12px}.wbt-timeline-member-scroll{max-height:40vh;overflow:auto;overscroll-behavior:contain}.wbt-timeline-pick{border-top:1px solid var(--wbt-line);padding-top:12px;margin-top:12px}.wbt-timeline-empty{padding:12px 0}.wbt-picker-selected{font-size:12px;margin:6px 0;min-height:16px}.wbt-picker-list{max-height:220px;overflow:auto;overscroll-behavior:contain;border:1px solid var(--wbt-line);border-radius:var(--wb-radius-sm,6px);padding:4px;background:var(--wbt-surface)}.wbt-picker-note{margin:6px;font-size:12px;opacity:.7}.wbt-picker-opt{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;padding:6px 8px;border:0;border-radius:var(--wb-radius-sm,6px);background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer}.wbt-picker-opt:hover,.wbt-picker-opt:focus-visible{background:color-mix(in oklab,var(--wbt-accent) 12%,transparent)}.wbt-picker-opt:focus-visible{outline:2px solid var(--wbt-accent);outline-offset:-2px}.wbt-picker-opt.selected{background:color-mix(in oklab,var(--wbt-accent) 16%,transparent);font-weight:600}.wbt-picker-opt-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wbt-picker-opt-count{font-size:11px;opacity:.6;white-space:nowrap}.wbt-timeline-confirm{padding:12px;border:1px solid var(--wbt-line);border-radius:var(--wb-radius-card,10px);margin:8px 0;line-height:1.6;background:var(--wbt-surface)}.wbt-timeline-confirm .wbt-btn{margin:8px 8px 0 0}",
9343
+ ".wbt-timeline-desc.expanded{max-height:none}.wbt-timeline-selected{min-width:0;overflow-wrap:anywhere;flex:1}.wbt-modal-foot.wbt-timeline-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;flex:none}.wbt-timeline-modal .wbt-empty{padding:12px;margin:8px 0;border:1px solid var(--wbt-line);border-radius:var(--wb-radius-card,10px);background:var(--wbt-surface);line-height:1.6}",
9344
+ "@media(max-width:720px){.wbt-timeline-selected{flex:1 1 100%}.wbt-picker-list{max-height:180px}.wbt-timeline-columns{grid-template-columns:1fr}.wbt-timeline-toolbar-main{flex:1 1 100%}.wbt-timeline-toolbar-actions{flex:1 1 100%;justify-content:flex-end;margin-left:0}.wbt-timeline-list{max-height:320px}.wbt-timeline-toolbar{flex-wrap:wrap}.wbt-timeline-member-row{grid-template-columns:76px 8px minmax(0,1fr) auto 28px;gap:4px}.wbt-timeline-left,.wbt-timeline-right{padding:12px}.wbt-timeline-date{font-size:10.5px}.wbt-timeline-member-row>.wbt-badge{font-size:10.5px;padding:2px 4px}.wbt-timeline-actions>.wbt-act-del{margin-left:0}.wbt-timeline-id{max-width:140px}}"
9345
+ ].join("\n");
9346
+ }
9347
+ });
9348
+
9349
+ // packages/addons/tasks/client/ui/inject-css.cjs
9350
+ var require_inject_css = __commonJS({
9351
+ "packages/addons/tasks/client/ui/inject-css.cjs"(exports2, module2) {
9352
+ "use strict";
9353
+ var CSS = require_styles() + "\n" + require_timeline_styles();
9354
+ module2.exports = function injectTasksCss() {
9355
+ if (typeof document === "undefined") return;
9356
+ var old = document.getElementById("wb-addon-tasks-v2-css");
9357
+ if (old) {
9358
+ old.textContent = CSS;
9359
+ return;
9360
+ }
9361
+ var s = document.createElement("style");
9362
+ s.id = "wb-addon-tasks-v2-css";
9363
+ s.setAttribute("data-wb-addon", "wb-addon-tasks");
9364
+ s.textContent = CSS;
9365
+ document.head.appendChild(s);
9366
+ };
9028
9367
  }
9029
9368
  });
9030
9369
 
@@ -9050,6 +9389,7 @@ var require_task_item = __commonJS({
9050
9389
  var statusInfo = deps.statusInfo, stars = deps.stars, pClass = deps.pClass;
9051
9390
  var today = deps.today, daysBetween = deps.daysBetween, cx = deps.cx;
9052
9391
  var Icon2 = deps.Icon, Countdown = deps.Countdown, PathCrumbs = deps.PathCrumbs;
9392
+ var Slot = deps.Slot;
9053
9393
  function TaskItem(props) {
9054
9394
  var t = props.t;
9055
9395
  var initialMode = props.bodyMode === "text" ? "text" : "markdown";
@@ -9165,13 +9505,25 @@ var require_task_item = __commonJS({
9165
9505
  );
9166
9506
  var opsNode = h("div", { className: "wbt-ops", key: "ops" }, ops);
9167
9507
  var tagBlock = tagNodes.length ? h("div", { className: "wbt-tags", key: "tags" }, tagNodes) : null;
9508
+ var sourceBlock = h(Slot, {
9509
+ slot: "item.actions",
9510
+ ownerId: "wb-addon-tasks",
9511
+ lang: props.lang,
9512
+ key: "source",
9513
+ item: {
9514
+ kind: "task",
9515
+ id: String(task.id || ""),
9516
+ title: String(task.title || ""),
9517
+ description: String(task.description || "")
9518
+ }
9519
+ });
9168
9520
  var wsList = Array.isArray(task.workspaces) ? task.workspaces : [];
9169
9521
  var wsBlock = wsList.length ? h("div", { className: "wbt-wschips", key: "workspaces" }, wsList.map(function(w) {
9170
9522
  return h("span", { className: "wbt-wschip wbt-wschip-ro", key: String(w.id), title: w.dir || "" }, (w.dir ? "" : "\u25E6 ") + (w.title || w.id));
9171
9523
  })) : null;
9172
9524
  var metaBlock = meta.length ? h("div", { className: "wbt-foot", key: "meta" }, h("div", { className: "wbt-meta" }, meta)) : null;
9173
9525
  var pathBlock = task.path && task.path.length ? h("div", { className: "wbt-taskpath", key: "path" }, h(PathCrumbs, { path: task.path, t, onPick: props.onPathPick })) : null;
9174
- var metaZone = tagBlock || wsBlock || metaBlock || pathBlock ? h("div", { className: "wbt-metazone", key: "metazone" }, tagBlock, wsBlock, metaBlock, pathBlock) : null;
9526
+ var metaZone = tagBlock || sourceBlock || wsBlock || metaBlock || pathBlock ? h("div", { className: "wbt-metazone", key: "metazone" }, tagBlock, sourceBlock, wsBlock, metaBlock, pathBlock) : null;
9175
9527
  var idNode = String(task.id || "") ? h("div", {
9176
9528
  className: "wbt-item-id",
9177
9529
  key: "taskid",
@@ -9629,32 +9981,37 @@ var require_workspace_select = __commonJS({
9629
9981
  var require_difficulty_field = __commonJS({
9630
9982
  "packages/addons/tasks/client/item/difficulty-field.cjs"(exports2, module2) {
9631
9983
  "use strict";
9984
+ var NF = require_number_field();
9632
9985
  module2.exports = function(React) {
9633
9986
  var h = React.createElement;
9634
- return function difficultyField(t, value, onChange, id) {
9987
+ return function difficultyField(t, value, onChange, id, lang) {
9635
9988
  var n = Number(value) || 0, full = Math.floor(n), half = n - full >= 0.5;
9636
9989
  var stars = "\u2605".repeat(full) + (half ? "\u2BEA" : "") + "\u2606".repeat(Math.max(0, 5 - full - (half ? 1 : 0)));
9637
9990
  return h(
9638
9991
  "div",
9639
9992
  { className: "wbt-field full" },
9640
- h("label", { htmlFor: id }, t.difficulty + " (0\u20135)"),
9993
+ h("span", { className: "wbt-field-label" }, t.difficulty + " (0\u20135)"),
9641
9994
  h(
9642
9995
  "div",
9643
9996
  { className: "wbt-row" },
9644
- h("input", {
9645
- id,
9646
- className: "wbt-input",
9647
- type: "number",
9997
+ h(NF.NumberField, {
9998
+ h,
9999
+ lang,
10000
+ value,
9648
10001
  min: 0,
9649
10002
  max: 5,
9650
10003
  step: 0.5,
9651
- "aria-label": t.difficulty,
9652
- "aria-describedby": id + "-hint",
10004
+ allowEmpty: true,
10005
+ ariaLabel: t.difficulty,
9653
10006
  placeholder: t.difficultyUnsetHint,
9654
- value,
9655
- onChange: function(e) {
9656
- var raw = e.target.value;
9657
- onChange(raw === "" ? "" : Math.max(0, Math.min(5, Number(raw) || 0)));
10007
+ hint: false,
10008
+ className: "wbt-difficulty-num",
10009
+ // 键入期同步草稿,让 ★ 预览即时更新;提交只在失焦/回车且合法时发生。
10010
+ onDraft: function(raw) {
10011
+ onChange(raw);
10012
+ },
10013
+ onCommit: function(next) {
10014
+ onChange(next === null ? "" : String(next));
9658
10015
  }
9659
10016
  }),
9660
10017
  h("span", { className: "wbt-stars", "aria-hidden": true }, n > 0 ? stars : t.difficultyUnset),
@@ -9885,6 +10242,7 @@ var require_ownership_fields = __commonJS({
9885
10242
  "use strict";
9886
10243
  var limits = require_limits();
9887
10244
  var ownership = require_ownership();
10245
+ var SW = require_switch();
9888
10246
  module2.exports = function(React) {
9889
10247
  var h = React.createElement;
9890
10248
  var Picker = require_table_picker()(React);
@@ -9938,14 +10296,14 @@ var require_ownership_fields = __commonJS({
9938
10296
  "div",
9939
10297
  { className: "wbt-field full" },
9940
10298
  h(Selection, { form, set, tree: props.tree, recommended: props.recommended, edit: props.edit, current: props.current, currentId: props.currentId }),
9941
- !props.edit ? h("label", { className: "wbt-check" }, h("input", {
9942
- type: "checkbox",
9943
- "aria-label": "\u6CA1\u6709\u5408\u9002\u7684\u8868\uFF1F\u65B0\u5EFA\u8282\u70B9",
10299
+ !props.edit ? h(SW.Switch, {
10300
+ h,
9944
10301
  checked: !!form.newPath,
9945
- onChange: function(e) {
9946
- props.setMany({ newPath: e.target.checked, tableId: "", confirmed: false });
10302
+ label: "\u6CA1\u6709\u5408\u9002\u7684\u8868\uFF1F\u65B0\u5EFA\u8282\u70B9",
10303
+ onChange: function(next) {
10304
+ props.setMany({ newPath: next, tableId: "", confirmed: false });
9947
10305
  }
9948
- }), "\u6CA1\u6709\u5408\u9002\u7684\u8868\uFF1F\u65B0\u5EFA\u8282\u70B9") : null,
10306
+ }) : null,
9949
10307
  form.newPath ? h(
9950
10308
  "div",
9951
10309
  null,
@@ -9978,15 +10336,15 @@ var require_ownership_fields = __commonJS({
9978
10336
  );
9979
10337
  }),
9980
10338
  plan.error ? h("div", { className: "wbt-err", role: "alert" }, plan.error) : null,
9981
- h("label", { className: "wbt-check" }, h("input", {
9982
- type: "checkbox",
9983
- "aria-label": "\u786E\u8BA4\u65B0\u5EFA\u8DEF\u5F84",
10339
+ h(SW.Switch, {
10340
+ h,
9984
10341
  checked: !!form.confirmed,
9985
10342
  disabled: !!plan.error,
9986
- onChange: function(e) {
9987
- set("confirmed", e.target.checked);
10343
+ label: "\u786E\u8BA4\u4EE5\u4E0A\u8DEF\u5F84\u4E0E\u804C\u8D23\uFF0C\u968F\u4EFB\u52A1\u4E00\u8D77\u63D0\u4EA4",
10344
+ onChange: function(next) {
10345
+ set("confirmed", next);
9988
10346
  }
9989
- }), "\u786E\u8BA4\u4EE5\u4E0A\u8DEF\u5F84\u4E0E\u804C\u8D23\uFF0C\u968F\u4EFB\u52A1\u4E00\u8D77\u63D0\u4EA4")
10347
+ })
9990
10348
  ) : null
9991
10349
  );
9992
10350
  };
@@ -9997,16 +10355,13 @@ var require_ownership_fields = __commonJS({
9997
10355
  // packages/addons/tasks/client/modals/create-modal.cjs
9998
10356
  var require_create_modal = __commonJS({
9999
10357
  "packages/addons/tasks/client/modals/create-modal.cjs"(exports2, module2) {
10358
+ var NF = require_number_field();
10000
10359
  function initialPriority(source, origin, fallback) {
10001
10360
  var original = Number(origin && origin.priority);
10002
10361
  if (source === "2" && Number.isInteger(original) && original >= 1 && original <= 10) return original;
10003
10362
  var n = Number(fallback);
10004
10363
  return Number.isFinite(n) ? Math.min(10, Math.max(1, Math.floor(n))) : 1;
10005
10364
  }
10006
- function clampInputPriority(value) {
10007
- if (String(value).trim() === "" || Number(value) === 0 || !Number.isFinite(Number(value))) return value;
10008
- return Math.min(10, Math.max(1, Math.floor(Number(value))));
10009
- }
10010
10365
  function validatePriority(value, source, t) {
10011
10366
  var n = Number(value);
10012
10367
  return String(value).trim() !== "" && Number.isInteger(n) && n >= 1 && n <= 10 ? "" : source === "2" ? t.restartPriorityError : t.activePriorityError;
@@ -10067,6 +10422,7 @@ var require_create_modal = __commonJS({
10067
10422
  }
10068
10423
  var active = source === "2" || form.status === "0";
10069
10424
  var priorityError = active ? validatePriority(form.priority, source, t) : "";
10425
+ var difficultyCheck = NF.validateNumber(form.difficulty, { min: 0, max: 5, step: 0.5, allowEmpty: true, lang: props.lang });
10070
10426
  var plan = ownership.preview(props.tree, form.tablePath, form.pathDescriptions);
10071
10427
  var targetValid = form.newPath ? !plan.error && form.confirmed : tables.some(function(x) {
10072
10428
  return x.id === form.tableId;
@@ -10088,7 +10444,7 @@ var require_create_modal = __commonJS({
10088
10444
  }
10089
10445
  function set(k, v) {
10090
10446
  var next = Object.assign({}, form);
10091
- next[k] = k === "priority" ? clampInputPriority(v) : v;
10447
+ next[k] = v;
10092
10448
  setForm(next);
10093
10449
  }
10094
10450
  function failed(message) {
@@ -10105,6 +10461,10 @@ var require_create_modal = __commonJS({
10105
10461
  }
10106
10462
  function submit() {
10107
10463
  if (priorityError || isBusy || submission.pending) return;
10464
+ if (!difficultyCheck.ok) {
10465
+ setError(difficultyCheck.error);
10466
+ return;
10467
+ }
10108
10468
  if (source === "2" && !(origin && origin.timelineId)) {
10109
10469
  setError(tr("\u8BF7\u5148\u624B\u52A8\u5EFA\u7ACB\u5E76\u5173\u8054\u65F6\u95F4\u7EBF\uFF0C\u518D\u91CD\u542F"));
10110
10470
  return;
@@ -10134,7 +10494,7 @@ var require_create_modal = __commonJS({
10134
10494
  tags: splitTags(form.tags),
10135
10495
  status: source === "2" ? "0" : String(form.status),
10136
10496
  priority: active ? Number(form.priority) : 0,
10137
- difficulty: Number(form.difficulty) || 0,
10497
+ difficulty: difficultyCheck.value || 0,
10138
10498
  publishDate: form.publishDate,
10139
10499
  targetDate: form.targetDate,
10140
10500
  source: source === "2" ? "2" : form.timelineId ? "1" : "0"
@@ -10166,6 +10526,19 @@ var require_create_modal = __commonJS({
10166
10526
  });
10167
10527
  }
10168
10528
  var title = source === "2" ? t.restartTitle : source === "1" ? tr("\u5411\u5DF2\u6709\u65F6\u95F4\u7EBF\u6DFB\u52A0\u4EFB\u52A1") : t.newTask;
10529
+ var timelineSection = source !== "2" ? h(
10530
+ "div",
10531
+ { className: "wbt-create-tl full" },
10532
+ h(
10533
+ "div",
10534
+ { className: "wbt-create-tl-head" },
10535
+ h("span", null, t.timeline),
10536
+ source === "1" ? h("span", { className: "wbt-create-tl-hint" }, tr("\u5411\u5DF2\u6709\u65F6\u95F4\u7EBF\u6DFB\u52A0\u4EFB\u52A1")) : null
10537
+ ),
10538
+ h(TimelinePicker, { api: props.api, t, value: form.timelineId, onChange: function(value) {
10539
+ set("timelineId", value);
10540
+ }, disabled: isBusy })
10541
+ ) : null;
10169
10542
  return h(
10170
10543
  "div",
10171
10544
  { className: "wbt-modal-mask", onKeyDownCapture: onModalKey, onMouseDown: function(e) {
@@ -10178,9 +10551,6 @@ var require_create_modal = __commonJS({
10178
10551
  source === "2" ? h("div", { className: "wbt-mhint" }, t.restartPriorityHint) : null,
10179
10552
  source !== "0" && origin ? h("div", { className: "wbt-mhint" }, "\u6765\u6E90\uFF1A" + (origin.title || origin.id) + (source === "2" ? tr(" \xB7 \u81EA\u52A8\u7EE7\u627F\u539F\u65F6\u95F4\u7EBF") : "")) : null,
10180
10553
  source === "2" && !(origin && origin.timelineId) ? h("p", { className: "wbt-err", role: "alert" }, tr("\u8BF7\u5148\u624B\u52A8\u5EFA\u7ACB\u5E76\u5173\u8054\u65F6\u95F4\u7EBF\uFF0C\u518D\u91CD\u542F")) : null,
10181
- source !== "2" ? h(TimelinePicker, { api: props.api, t, value: form.timelineId, onChange: function(value) {
10182
- set("timelineId", value);
10183
- }, disabled: isBusy }) : null,
10184
10554
  h(
10185
10555
  "div",
10186
10556
  { className: "wbt-form" },
@@ -10193,6 +10563,7 @@ var require_create_modal = __commonJS({
10193
10563
  hostHasAddon("wb-addon-tags") ? h("label", { className: "wbt-field full" }, h("span", null, t.tags), h("input", { className: "wbt-input", value: form.tags, placeholder: t.tagPlaceholder, onChange: function(e) {
10194
10564
  set("tags", e.target.value);
10195
10565
  } })) : null,
10566
+ timelineSection,
10196
10567
  h(WorkspaceSelect, { api: props.api, lang: props.lang, value: form.workspaceIds, onChange: function(ids) {
10197
10568
  set("workspaceIds", ids);
10198
10569
  } }),
@@ -10205,9 +10576,29 @@ var require_create_modal = __commonJS({
10205
10576
  h("option", { value: "2" }, "\u5DF2\u5B8C\u6210"),
10206
10577
  h("option", { value: "1" }, "\u5DF2\u5173\u95ED")
10207
10578
  )),
10208
- h("label", { className: "wbt-field" }, h("span", null, t.priority + "\uFF081\u201310\uFF09"), h("input", { className: "wbt-input", type: "number", min: 1, max: 10, step: 1, disabled: !active, "aria-invalid": !!priorityError, "aria-describedby": priorityError ? "wbt-create-priority-error" : void 0, value: form.priority, onChange: function(e) {
10209
- set("priority", e.target.value);
10210
- } })),
10579
+ h(
10580
+ "div",
10581
+ { className: "wbt-field" },
10582
+ h("span", { className: "wbt-field-label" }, t.priority + "\uFF081\u201310\uFF09"),
10583
+ h(NF.NumberField, {
10584
+ h,
10585
+ lang: props.lang,
10586
+ value: form.priority,
10587
+ min: 1,
10588
+ max: 10,
10589
+ integer: true,
10590
+ disabled: !active,
10591
+ hint: false,
10592
+ ariaLabel: t.priority,
10593
+ // 键入即写入草稿;合法性由下面的 priorityError 实时判定,绝不回写夹取后的值。
10594
+ onDraft: function(raw) {
10595
+ set("priority", raw);
10596
+ },
10597
+ onCommit: function(next) {
10598
+ set("priority", String(next));
10599
+ }
10600
+ })
10601
+ ),
10211
10602
  fields({ form, set, setMany, tree: props.tree, recommended: props.defaultTableId || origin && origin.tableId }),
10212
10603
  h("label", { className: "wbt-field" }, h("span", null, t.publishDate), h(DP.DatePicker, { React, h, prefix: "wbt", lang: props.lang, label: t.publishDate, value: form.publishDate, onChange: function(next) {
10213
10604
  set("publishDate", next);
@@ -10220,7 +10611,7 @@ var require_create_modal = __commonJS({
10220
10611
  } })) : null,
10221
10612
  difficultyField(t, form.difficulty, function(value) {
10222
10613
  set("difficulty", value);
10223
- }, "wbt-create-difficulty"),
10614
+ }, "wbt-create-difficulty", props.lang),
10224
10615
  source !== "2" && form.status === "1" ? h("label", { className: "wbt-field" }, h("span", null, t.shutdownDate), h(DP.DatePicker, { React, h, prefix: "wbt", lang: props.lang, label: t.shutdownDate, value: form.shutdownDate, onChange: function(next) {
10225
10616
  set("shutdownDate", next);
10226
10617
  } })) : null
@@ -10231,7 +10622,7 @@ var require_create_modal = __commonJS({
10231
10622
  "div",
10232
10623
  { className: "wbt-modal-foot" },
10233
10624
  h("button", { className: "wbt-btn ghost", disabled: isBusy, onClick: requestClose }, t.cancel),
10234
- h("button", { className: "wbt-btn primary", disabled: isBusy || !!priorityError || !targetValid || source === "2" && !(origin && origin.timelineId), onClick: submit }, isBusy ? "\u2026" : t.create)
10625
+ h("button", { className: "wbt-btn primary", disabled: isBusy || !!priorityError || !difficultyCheck.ok || !targetValid || source === "2" && !(origin && origin.timelineId), onClick: submit }, isBusy ? "\u2026" : t.create)
10235
10626
  )
10236
10627
  )
10237
10628
  );
@@ -10241,6 +10632,197 @@ var require_create_modal = __commonJS({
10241
10632
  }
10242
10633
  });
10243
10634
 
10635
+ // packages/addons/tasks/client/views/slot-task-from-message.cjs
10636
+ var require_slot_task_from_message = __commonJS({
10637
+ "packages/addons/tasks/client/views/slot-task-from-message.cjs"(exports2, module2) {
10638
+ "use strict";
10639
+ module2.exports = function(deps) {
10640
+ var React = deps.React;
10641
+ var h = React.createElement;
10642
+ var Icon2 = deps.Icon;
10643
+ var injectCss = deps.injectCss;
10644
+ var KIND = "mail.message";
10645
+ function flattenTables(nodes, out) {
10646
+ var list = out || [];
10647
+ (nodes || []).forEach(function(node) {
10648
+ if (!node) return;
10649
+ if (String(node.type) === "1") list.push({ id: String(node.id), name: String(node.name || node.path || node.id) });
10650
+ if (node.children && node.children.length) flattenTables(node.children, list);
10651
+ });
10652
+ return list;
10653
+ }
10654
+ function defaultTitle(item, en) {
10655
+ var subject = String(item && item.title || "").trim();
10656
+ if (subject) return subject;
10657
+ return en ? "Follow up: (no subject)" : "\u8DDF\u8FDB\uFF1A\uFF08\u65E0\u4E3B\u9898\uFF09";
10658
+ }
10659
+ function buildDescription(item, en) {
10660
+ var lines = [en ? "Created from a mail message." : "\u7531\u90AE\u4EF6\u521B\u5EFA\u3002"];
10661
+ if (item.subtitle) lines.push((en ? "From: " : "\u53D1\u4EF6\u4EBA\uFF1A") + item.subtitle);
10662
+ if (item.title) lines.push((en ? "Subject: " : "\u4E3B\u9898\uFF1A") + item.title);
10663
+ lines.push((en ? "Source mail: " : "\u6765\u6E90\u90AE\u4EF6\uFF1A") + "wb-mail:" + item.id);
10664
+ return lines.join("\n");
10665
+ }
10666
+ return function TaskFromMessage(props) {
10667
+ React.useEffect(function() {
10668
+ injectCss();
10669
+ }, []);
10670
+ var item = props.item;
10671
+ var en = props.lang === "en";
10672
+ var api = props.api;
10673
+ var open = React.useState(false);
10674
+ var tables = React.useState(null);
10675
+ var tableId = React.useState("");
10676
+ var title = React.useState("");
10677
+ var busy = React.useState(false);
10678
+ var error = React.useState("");
10679
+ var created = React.useState(null);
10680
+ if (!item || item.kind !== KIND || !item.id) return null;
10681
+ function loadTables() {
10682
+ if (tables[0] !== null) return;
10683
+ tables[1](void 0);
10684
+ api.call("taskNodes.tree").then(function(r) {
10685
+ if (!r || !r.ok) throw new Error(r && r.error || "tree load failed");
10686
+ var list = flattenTables(Array.isArray(r.result) ? r.result : []);
10687
+ tables[1](list);
10688
+ if (list.length === 1) tableId[1](list[0].id);
10689
+ }).catch(function(e) {
10690
+ tables[1]([]);
10691
+ error[1](String(e && e.message || e));
10692
+ });
10693
+ }
10694
+ function toggle() {
10695
+ if (!open[0]) {
10696
+ title[1](defaultTitle(item, en));
10697
+ loadTables();
10698
+ }
10699
+ open[1](!open[0]);
10700
+ }
10701
+ function submit() {
10702
+ if (busy[0]) return;
10703
+ var name = String(title[0] || "").trim();
10704
+ if (!name) {
10705
+ error[1](en ? "Title is required" : "\u6807\u9898\u4E0D\u80FD\u4E3A\u7A7A");
10706
+ return;
10707
+ }
10708
+ if (!tableId[0]) {
10709
+ error[1](en ? "Pick a target table" : "\u8BF7\u9009\u62E9\u76EE\u6807\u8868");
10710
+ return;
10711
+ }
10712
+ busy[1](true);
10713
+ error[1]("");
10714
+ api.call("tasks.create", {
10715
+ title: name,
10716
+ description: buildDescription(item, en),
10717
+ tableId: tableId[0],
10718
+ dedupeKey: KIND + ":" + item.id
10719
+ }).then(function(r) {
10720
+ if (!r || !r.ok) throw new Error(r && r.error || "create failed");
10721
+ created[1](r.result || {});
10722
+ open[1](false);
10723
+ }).catch(function(e) {
10724
+ error[1](String(e && e.message || e));
10725
+ }).finally(function() {
10726
+ busy[1](false);
10727
+ });
10728
+ }
10729
+ if (created[0]) {
10730
+ var task = created[0];
10731
+ var shortId = String(task.id || "").slice(0, 8);
10732
+ return h(
10733
+ "span",
10734
+ { className: "wbtx-slot-done" },
10735
+ h("span", { className: "wbtx-slot-note" }, (en ? "Task created" : "\u5DF2\u5EFA\u4EFB\u52A1") + (shortId ? " \xB7 " + shortId : "")),
10736
+ h("button", {
10737
+ type: "button",
10738
+ className: "wbtx-slot-link",
10739
+ onClick: function(e) {
10740
+ e.stopPropagation();
10741
+ props.onNavigate("tasks");
10742
+ }
10743
+ }, en ? "Open tasks" : "\u53BB\u4EFB\u52A1\u9875")
10744
+ );
10745
+ }
10746
+ var loading = tables[0] === void 0;
10747
+ var options = Array.isArray(tables[0]) ? tables[0] : [];
10748
+ return h(
10749
+ "span",
10750
+ { className: "wbtx-slot" },
10751
+ h("button", {
10752
+ type: "button",
10753
+ className: "wbt-btn wbtx-slot-btn",
10754
+ "aria-expanded": !!open[0],
10755
+ disabled: busy[0],
10756
+ title: en ? "Create a task from this message" : "\u628A\u8FD9\u5C01\u90AE\u4EF6\u53D8\u6210\u4EFB\u52A1",
10757
+ onClick: function(e) {
10758
+ e.stopPropagation();
10759
+ toggle();
10760
+ }
10761
+ }, h(Icon2, { name: "plus", size: 13 }), en ? "New task" : "\u5EFA\u4EFB\u52A1"),
10762
+ open[0] ? h(
10763
+ "span",
10764
+ { className: "wbtx-slot-panel" },
10765
+ h(
10766
+ "label",
10767
+ { className: "wbtx-slot-row" },
10768
+ h("span", null, en ? "Title" : "\u6807\u9898"),
10769
+ h("input", {
10770
+ className: "wbt-input wbtx-slot-input",
10771
+ value: title[0],
10772
+ autoFocus: true,
10773
+ onChange: function(e) {
10774
+ title[1](e.target.value);
10775
+ },
10776
+ onKeyDown: function(e) {
10777
+ if (e.key === "Enter") {
10778
+ e.preventDefault();
10779
+ submit();
10780
+ }
10781
+ if (e.key === "Escape") open[1](false);
10782
+ }
10783
+ })
10784
+ ),
10785
+ h(
10786
+ "label",
10787
+ { className: "wbtx-slot-row" },
10788
+ h("span", null, en ? "Table" : "\u76EE\u6807\u8868"),
10789
+ loading ? h("span", { className: "wbtx-slot-muted" }, en ? "Loading\u2026" : "\u8BFB\u53D6\u4E2D\u2026") : options.length ? h("select", {
10790
+ className: "wbt-input wbtx-slot-input",
10791
+ value: tableId[0],
10792
+ onChange: function(e) {
10793
+ tableId[1](e.target.value);
10794
+ }
10795
+ }, [h("option", { key: "", value: "" }, en ? "Pick a table" : "\u9009\u62E9\u76EE\u6807\u8868")].concat(
10796
+ options.map(function(o) {
10797
+ return h("option", { key: o.id, value: o.id }, o.name);
10798
+ })
10799
+ )) : h("span", { className: "wbtx-slot-muted" }, en ? "No task table yet" : "\u8FD8\u6CA1\u6709\u4EFB\u52A1\u8868")
10800
+ ),
10801
+ error[0] ? h("span", { className: "wbt-err", role: "alert" }, error[0]) : null,
10802
+ h(
10803
+ "span",
10804
+ { className: "wbtx-slot-foot" },
10805
+ h("button", { type: "button", className: "wbt-btn ghost", onClick: function(e) {
10806
+ e.stopPropagation();
10807
+ open[1](false);
10808
+ } }, en ? "Cancel" : "\u53D6\u6D88"),
10809
+ h("button", {
10810
+ type: "button",
10811
+ className: "wbt-btn primary",
10812
+ disabled: busy[0] || loading || !options.length,
10813
+ onClick: function(e) {
10814
+ e.stopPropagation();
10815
+ submit();
10816
+ }
10817
+ }, busy[0] ? "\u2026" : en ? "Create" : "\u521B\u5EFA")
10818
+ )
10819
+ ) : null
10820
+ );
10821
+ };
10822
+ };
10823
+ }
10824
+ });
10825
+
10244
10826
  // packages/addons/tasks/client/timeline/timeline-member-rows.cjs
10245
10827
  var require_timeline_member_rows = __commonJS({
10246
10828
  "packages/addons/tasks/client/timeline/timeline-member-rows.cjs"(exports2, module2) {
@@ -10283,42 +10865,6 @@ var require_timeline_title = __commonJS({
10283
10865
  }
10284
10866
  });
10285
10867
 
10286
- // packages/addons/tasks/client/timeline/timeline-styles.cjs
10287
- var require_timeline_styles = __commonJS({
10288
- "packages/addons/tasks/client/timeline/timeline-styles.cjs"(exports2, module2) {
10289
- "use strict";
10290
- module2.exports = [
10291
- ".wbt-timeline-view{padding:0;color:inherit;box-sizing:border-box;overflow:auto}",
10292
- ".wbt-timeline-toolbar,.wbt-timeline-search,.wbt-timeline-pager,.wbt-timeline-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
10293
- ".wbt-timeline-toolbar{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;margin-bottom:12px}",
10294
- ".wbt-timeline-toolbar-main{display:flex;align-items:center;gap:8px;flex:1 1 320px;min-width:0;flex-wrap:wrap}",
10295
- ".wbt-timeline-toolbar-main .wbt-timeline-search{flex:1 1 220px;min-width:0}",
10296
- ".wbt-timeline-toolbar-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-left:auto}",
10297
- ".wbt-timeline-columns{display:grid;grid-template-columns:minmax(240px,32%) minmax(0,1fr);gap:12px;align-items:start}",
10298
- ".wbt-timeline-left,.wbt-timeline-right{min-width:0;border:1px solid var(--wbt-line);border-radius:var(--wb-radius-card,10px);padding:12px}",
10299
- ".wbt-timeline-single{display:flex;align-items:center;gap:8px;margin:0;font-size:13px;white-space:nowrap}.wbt-timeline-search input{min-width:0;flex:1}",
10300
- ".wbt-timeline-list{max-height:840px;overflow:auto;overscroll-behavior:contain}.wbt-timeline-left>.wbt-timeline-list,.wbt-timeline-left>.wbt-err{margin-top:2px}.wbt-timeline-view .wbt-timeline-option{position:relative;box-sizing:border-box;min-height:56px;padding:10px 12px;border:0;border-bottom:1px solid var(--wbt-line);border-radius:var(--wb-radius-sm,6px);display:flex;flex-direction:column;gap:4px;cursor:pointer;color:inherit;background:transparent;background-image:none}",
10301
- ".wbt-timeline-option-title{display:flex;gap:8px;align-items:center;min-width:0}.wbt-timeline-option-title strong{font-size:13px;font-weight:560;line-height:1.4;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}.wbt-timeline-option>span{font-size:11.5px;opacity:.6;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}",
10302
- ".wbt-timeline-option>.wbt-timeline-excerpt{display:block;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}",
10303
- ".wbt-timeline-view .wbt-timeline-option.current{box-shadow:inset 3px 0 var(--wbt-accent),inset 0 0 0 1px var(--wbt-line);background:color-mix(in oklab,var(--wbt-accent) 8%,transparent);background-image:none}.wbt-timeline-view .wbt-timeline-option:hover{background:color-mix(in oklab,var(--wbt-accent) 12%,transparent)}",
10304
- ".wbt-timeline-option:focus-visible,.wbt-timeline-view button:focus-visible,.wbt-timeline-modal button:focus-visible{outline:2px solid var(--wbt-accent);outline-offset:2px}.wbt-timeline-option input[type=checkbox],.wbt-timeline-single input{appearance:auto;width:15px;height:15px;flex:none;accent-color:var(--wbt-accent)}",
10305
- ".wbt-timeline-pager{justify-content:space-between;font-size:12px;margin-top:12px}.wbt-timeline-right h3,.wbt-timeline-summary h4{font-size:15px;font-weight:600;margin:0 0 8px;overflow-wrap:anywhere}.wbt-timeline-eyebrow{font-size:11.5px;opacity:.55;margin-bottom:4px;overflow-wrap:anywhere}",
10306
- ".wbt-timeline-summary{min-width:0}.wbt-timeline-desc{max-height:64px;overflow:hidden;margin:0 0 8px;white-space:pre-wrap;overflow-wrap:anywhere}.wbt-timeline-actions{margin:8px 0}.wbt-timeline-actions>.wbt-act-del{margin-left:auto}",
10307
- ".wbt-timeline-right>.wbt-timeline-members{min-height:0;max-height:65vh;overflow-y:auto;overscroll-behavior-y:contain;scrollbar-gutter:stable}",
10308
- // Scoped reset defeats ordinary host button surfaces without touching unrelated task controls.
10309
- ":is(.wbt-timeline-view,.wbt-timeline-modal) button:is(.wbt-timeline-member,.wbt-timeline-remove,.wbt-timeline-id){appearance:none;background:transparent;background-image:none;color:inherit;border:0;box-shadow:none;border-radius:var(--wb-radius-sm,6px);font:inherit;cursor:pointer;min-width:0;min-height:0;width:auto;margin:0}",
10310
- ":is(.wbt-timeline-view,.wbt-timeline-modal) .wbt-timeline-id{display:inline-flex;align-items:center;gap:4px;padding:4px;max-width:180px}.wbt-timeline-id code{font-size:11.5px;opacity:.5;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
10311
- ":is(.wbt-timeline-view,.wbt-timeline-modal) .wbt-act-del{color:var(--dsw-alias-state-error-primary,var(--wbt-accent));background:transparent;border-color:var(--wbt-line)}",
10312
- '.wbt-timeline-members{list-style:none;padding:0;margin:8px 0;min-width:0}.wbt-timeline-member-row{display:grid;grid-template-columns:92px 14px minmax(0,1fr) auto 28px;gap:8px;align-items:center;min-height:40px;position:relative;padding:0;margin:0}.wbt-timeline-date{font-size:11.5px;font-variant-numeric:tabular-nums;text-align:right;white-space:nowrap;opacity:.7}.wbt-timeline-node{align-self:stretch;position:relative}.wbt-timeline-node:before{content:"";position:absolute;width:1px;left:50%;top:0;bottom:0;background:var(--wbt-line)}.wbt-timeline-node:after{content:"";position:absolute;width:6px;height:6px;left:calc(50% - 2.5px);top:calc(50% - 3px);border-radius:50%;background:var(--wbt-accent)}',
10313
- ":is(.wbt-timeline-view,.wbt-timeline-modal) button.wbt-timeline-member{padding:8px 0;text-align:left;font-size:13px;line-height:1.5;overflow-wrap:anywhere;white-space:normal}:is(.wbt-timeline-view,.wbt-timeline-modal) button.wbt-timeline-member:hover{text-decoration:underline;text-underline-offset:3px}:is(.wbt-timeline-view,.wbt-timeline-modal) button.wbt-timeline-remove{display:flex;justify-content:center;align-items:center;width:28px;height:28px;padding:4px;opacity:.35}:is(.wbt-timeline-view,.wbt-timeline-modal) button.wbt-timeline-remove:is(:hover,:focus-visible){opacity:.9;background:var(--wbt-surface)}.wbt-timeline-member-row>.wbt-badge{white-space:nowrap;margin:0}.wbt-timeline-remove:disabled{cursor:default}",
10314
- ".wbt-timeline-member-footer{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;border-top:1px solid var(--wbt-line);padding-top:8px}.wbt-timeline-member-footer>span{font-size:11.5px;opacity:.65}.wbt-timeline-member-footer .wbt-timeline-pager{margin:0}",
10315
- ".wbt-modal.wide.wbt-timeline-modal{display:flex;flex-direction:column;max-height:90vh;overflow:hidden}.wbt-timeline-modal-body{min-height:0;overflow:auto;flex:1;padding:12px}.wbt-timeline-member-section{min-width:0;margin-top:12px}.wbt-timeline-member-scroll{max-height:40vh;overflow:auto;overscroll-behavior:contain}.wbt-timeline-pick{border-top:1px solid var(--wbt-line);padding-top:12px;margin-top:12px}.wbt-timeline-empty{padding:12px 0}.wbt-picker-selected{font-size:12px;margin:6px 0;min-height:16px}.wbt-picker-list{max-height:220px;overflow:auto;overscroll-behavior:contain;border:1px solid var(--wbt-line);border-radius:var(--wb-radius-sm,6px);padding:4px;background:var(--wbt-surface)}.wbt-picker-note{margin:6px;font-size:12px;opacity:.7}.wbt-picker-opt{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;padding:6px 8px;border:0;border-radius:var(--wb-radius-sm,6px);background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer}.wbt-picker-opt:hover,.wbt-picker-opt:focus-visible{background:color-mix(in oklab,var(--wbt-accent) 12%,transparent)}.wbt-picker-opt:focus-visible{outline:2px solid var(--wbt-accent);outline-offset:-2px}.wbt-picker-opt.selected{background:color-mix(in oklab,var(--wbt-accent) 16%,transparent);font-weight:600}.wbt-picker-opt-title{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wbt-picker-opt-count{font-size:11px;opacity:.6;white-space:nowrap}.wbt-timeline-confirm{padding:12px;border:1px solid var(--wbt-line);border-radius:var(--wb-radius-card,10px);margin:8px 0;line-height:1.6;background:var(--wbt-surface)}.wbt-timeline-confirm .wbt-btn{margin:8px 8px 0 0}",
10316
- ".wbt-timeline-desc.expanded{max-height:none}.wbt-timeline-selected{min-width:0;overflow-wrap:anywhere;flex:1}.wbt-modal-foot.wbt-timeline-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;flex:none}.wbt-timeline-modal .wbt-empty{padding:12px;margin:8px 0;border:1px solid var(--wbt-line);border-radius:var(--wb-radius-card,10px);background:var(--wbt-surface);line-height:1.6}",
10317
- "@media(max-width:720px){.wbt-timeline-selected{flex:1 1 100%}.wbt-picker-list{max-height:180px}.wbt-timeline-columns{grid-template-columns:1fr}.wbt-timeline-toolbar-main{flex:1 1 100%}.wbt-timeline-toolbar-actions{flex:1 1 100%;justify-content:flex-end;margin-left:0}.wbt-timeline-list{max-height:320px}.wbt-timeline-toolbar{flex-wrap:wrap}.wbt-timeline-member-row{grid-template-columns:76px 8px minmax(0,1fr) auto 28px;gap:4px}.wbt-timeline-left,.wbt-timeline-right{padding:12px}.wbt-timeline-date{font-size:10.5px}.wbt-timeline-member-row>.wbt-badge{font-size:10.5px;padding:2px 4px}.wbt-timeline-actions>.wbt-act-del{margin-left:0}.wbt-timeline-id{max-width:140px}}"
10318
- ].join("\n");
10319
- }
10320
- });
10321
-
10322
10868
  // packages/addons/tasks/client/timeline/timeline-members.cjs
10323
10869
  var require_timeline_members = __commonJS({
10324
10870
  "packages/addons/tasks/client/timeline/timeline-members.cjs"(exports2, module2) {
@@ -10341,7 +10887,6 @@ var require_task_timeline_modal = __commonJS({
10341
10887
  var h = React.createElement, controls = require_timeline_controls()(React);
10342
10888
  var MemberRows = require_timeline_member_rows()(React, statusInfo);
10343
10889
  var splitTitle = require_timeline_title();
10344
- var CSS = require_timeline_styles();
10345
10890
  return function TaskTimelineModal(p) {
10346
10891
  var tr = require_timeline_copy()(p.t), lang = p.t && p.t.timeline === "Timeline" ? "en" : "zh";
10347
10892
  var ts = React.useState(p.task), task = ts[0], setTask = ts[1];
@@ -10513,7 +11058,6 @@ var require_task_timeline_modal = __commonJS({
10513
11058
  return h(
10514
11059
  "div",
10515
11060
  { className: "wbt-modal-mask", onKeyDown },
10516
- h("style", null, CSS),
10517
11061
  h(
10518
11062
  "div",
10519
11063
  { ref: dialog, tabIndex: -1, className: "wbt-modal wide wbt-timeline-modal", role: "dialog", "aria-modal": true, "aria-label": tr("\u4EFB\u52A1\u65F6\u95F4\u7EBF") },
@@ -10562,6 +11106,7 @@ var require_task_timeline_modal = __commonJS({
10562
11106
  var require_edit_modal = __commonJS({
10563
11107
  "packages/addons/tasks/client/modals/edit-modal.cjs"(exports2, module2) {
10564
11108
  "use strict";
11109
+ var NF = require_number_field();
10565
11110
  module2.exports = function createEditModal(React, statusInfo, stars) {
10566
11111
  var h = React.createElement;
10567
11112
  var difficultyField = require_difficulty_field()(React);
@@ -10625,12 +11170,22 @@ var require_edit_modal = __commonJS({
10625
11170
  });
10626
11171
  }
10627
11172
  var titleOk = String(form.title).trim().length > 0;
11173
+ var priorityCheck = canPriority ? NF.validateNumber(form.priority, { min: String(task.status) === "1" ? 0 : 1, max: 10, integer: true, lang: props.lang }) : { ok: true, value: 0, error: "" };
11174
+ var difficultyCheck = NF.validateNumber(form.difficulty, { min: 0, max: 5, step: 0.5, allowEmpty: true, lang: props.lang });
10628
11175
  function submit() {
10629
11176
  if (isBusy || submission.pending) return;
10630
11177
  if (!titleOk) {
10631
11178
  setErr(t.needTitle);
10632
11179
  return;
10633
11180
  }
11181
+ if (!priorityCheck.ok) {
11182
+ setErr(priorityCheck.error);
11183
+ return;
11184
+ }
11185
+ if (!difficultyCheck.ok) {
11186
+ setErr(difficultyCheck.error);
11187
+ return;
11188
+ }
10634
11189
  var patch = { id: task.id, title: String(form.title).trim(), description: String(form.description || "") };
10635
11190
  if (form.tableId && form.tableId !== String(task.tableId || "")) {
10636
11191
  if (!ownership.tables(props.tree).some(function(x) {
@@ -10642,13 +11197,10 @@ var require_edit_modal = __commonJS({
10642
11197
  patch.tableId = form.tableId;
10643
11198
  }
10644
11199
  if (canPriority) {
10645
- var p = Math.round(Number(form.priority));
10646
- if (!isFinite(p)) p = 1;
10647
- if (!Number.isFinite(p)) p = 0;
10648
- patch.priority = Math.max(1, Math.min(10, p));
11200
+ patch.priority = priorityCheck.value;
10649
11201
  if (String(form.targetDate || "").trim()) patch.targetDate = String(form.targetDate).trim();
10650
11202
  }
10651
- patch.difficulty = Math.max(0, Math.min(5, Number(form.difficulty) || 0));
11203
+ patch.difficulty = difficultyCheck.value || 0;
10652
11204
  patch.workspaceIds = (form.workspaceIds || []).slice();
10653
11205
  if (String(form.review) !== String(task.review || "")) patch.review = String(form.review);
10654
11206
  submission.pending = true;
@@ -10717,16 +11269,30 @@ var require_edit_modal = __commonJS({
10717
11269
  } })
10718
11270
  ) : null,
10719
11271
  canPriority ? h(
10720
- "label",
11272
+ "div",
10721
11273
  { className: "wbt-field" },
10722
- h("span", null, t.priority + "\uFF081\u201310\uFF09"),
10723
- h("input", { className: "wbt-input", type: "number", min: 1, max: 10, step: 1, value: form.priority, onChange: function(e) {
10724
- set("priority", e.target.value);
10725
- } })
11274
+ h("span", { className: "wbt-field-label" }, t.priority + "\uFF081\u201310\uFF09"),
11275
+ h(NF.NumberField, {
11276
+ h,
11277
+ lang: props.lang,
11278
+ value: form.priority,
11279
+ min: 1,
11280
+ max: 10,
11281
+ integer: true,
11282
+ hint: false,
11283
+ ariaLabel: t.priority,
11284
+ // 键入即写草稿,合法性交给 priorityCheck(保存按钮据此禁用),绝不夹取。
11285
+ onDraft: function(raw) {
11286
+ set("priority", raw);
11287
+ },
11288
+ onCommit: function(next) {
11289
+ set("priority", String(next));
11290
+ }
11291
+ })
10726
11292
  ) : null,
10727
11293
  difficultyField(t, form.difficulty, function(value) {
10728
11294
  set("difficulty", value);
10729
- }, "wbt-edit-difficulty"),
11295
+ }, "wbt-edit-difficulty", props.lang),
10730
11296
  h(WorkspaceSelect, { api: props.api, lang: props.lang, value: form.workspaceIds, onChange: function(ids) {
10731
11297
  set("workspaceIds", ids);
10732
11298
  } }),
@@ -10735,7 +11301,7 @@ var require_edit_modal = __commonJS({
10735
11301
  "div",
10736
11302
  { className: "wbt-modal-foot" },
10737
11303
  h("button", { className: "wbt-btn ghost", disabled: isBusy, onClick: requestClose }, t.cancel),
10738
- h("button", { className: "wbt-btn primary", disabled: isBusy || !titleOk, onClick: submit }, isBusy ? "\u2026" : t.save)
11304
+ h("button", { className: "wbt-btn primary", disabled: isBusy || !titleOk || !priorityCheck.ok || !difficultyCheck.ok, onClick: submit }, isBusy ? "\u2026" : t.save)
10739
11305
  )
10740
11306
  )
10741
11307
  );
@@ -11125,43 +11691,7 @@ var require_task_filter_panel = __commonJS({
11125
11691
  var model = require_task_filter_model();
11126
11692
  var DateFilter = require_date_filter().DateFilter;
11127
11693
  var WorkspaceFilter = require_workspacefilter();
11128
- function NumberInput(p) {
11129
- var React = p.React, draftState = React.useState(String(p.value)), draft = draftState[0], setDraft = draftState[1];
11130
- React.useEffect(function() {
11131
- setDraft(String(p.value));
11132
- }, [p.value]);
11133
- function commit(node) {
11134
- var result = p.commit(node.validity && node.validity.badInput ? "invalid" : draft);
11135
- setDraft(result === void 0 ? String(p.value) : result);
11136
- }
11137
- return React.createElement("input", {
11138
- type: "number",
11139
- className: "wbt-input wbt-limit-input",
11140
- min: p.min,
11141
- max: p.max,
11142
- step: p.step,
11143
- inputMode: p.step === 1 ? "numeric" : "decimal",
11144
- value: draft,
11145
- "aria-label": p.label,
11146
- placeholder: p.placeholder,
11147
- onChange: function(e) {
11148
- setDraft(e.target.value);
11149
- },
11150
- onBlur: function(e) {
11151
- commit(e.currentTarget);
11152
- },
11153
- onKeyDown: function(e) {
11154
- if (e.key === "Enter") {
11155
- e.preventDefault();
11156
- e.currentTarget.blur();
11157
- }
11158
- if (e.key === "Escape") {
11159
- e.preventDefault();
11160
- setDraft(String(p.value));
11161
- }
11162
- }
11163
- });
11164
- }
11694
+ var NF = require_number_field();
11165
11695
  module2.exports = function renderFilterPanel(React, p) {
11166
11696
  var h = React.createElement, en = p.lang === "en", value = p.value;
11167
11697
  var title = en ? "Filters" : "\u7B5B\u9009";
@@ -11191,7 +11721,8 @@ var require_task_filter_panel = __commonJS({
11191
11721
  p.onHint(hints.join(" \xB7 "));
11192
11722
  change(result.value);
11193
11723
  }
11194
- function setLimit(key, end, text) {
11724
+ function setLimit(key, end, next) {
11725
+ var text = next === null || next === void 0 ? "" : String(next);
11195
11726
  var result = model.limit(value, key, end, text);
11196
11727
  if (!result) {
11197
11728
  p.onHint(en ? key === "difficulty" ? "Difficulty takes 0.5 steps from 0 to 5" : "Priority takes whole numbers 0\u201310" : key === "difficulty" ? "\u96BE\u5EA6\u4EC5\u63A5\u53D7 0\u20135 \u4E4B\u95F4\u7684\u534A\u6863\u6570\u503C" : "\u4F18\u5148\u7EA7\u4EC5\u63A5\u53D7 0\u201310 \u7684\u6574\u6570");
@@ -11203,15 +11734,28 @@ var require_task_filter_panel = __commonJS({
11203
11734
  p.onHint(hints.join(" \xB7 "));
11204
11735
  if (result.clearsMissing && p.onMissingChange) p.onMissingChange(false);
11205
11736
  change(result.value);
11206
- return result.value[key][end];
11207
11737
  }
11208
11738
  function limitRow(key, label) {
11209
11739
  var box = value[key], spec = model.limits[key];
11210
11740
  function field(end) {
11211
11741
  var labelText = en ? (end === "min" ? "Minimum " : "Maximum ") + label : (end === "min" ? "\u6700\u4F4E" : "\u6700\u9AD8") + label;
11212
- return h(NumberInput, { React, value: box[end], min: spec.min, max: spec.max, step: spec.step, label: labelText, placeholder: String(end === "min" ? spec.min : spec.max), commit: function(text) {
11213
- return setLimit(key, end, text);
11214
- } });
11742
+ return h(NF.NumberField, {
11743
+ h,
11744
+ lang: p.lang,
11745
+ value: box[end],
11746
+ min: spec.min,
11747
+ max: spec.max,
11748
+ step: spec.step,
11749
+ integer: spec.step === 1,
11750
+ allowEmpty: true,
11751
+ hint: false,
11752
+ className: "wbt-limit-field",
11753
+ ariaLabel: labelText,
11754
+ placeholder: String(end === "min" ? spec.min : spec.max),
11755
+ onCommit: function(next) {
11756
+ setLimit(key, end, next);
11757
+ }
11758
+ });
11215
11759
  }
11216
11760
  function clear() {
11217
11761
  p.onHint("");
@@ -11419,6 +11963,7 @@ var require_tasks_view = __commonJS({
11419
11963
  var React = deps.React, configView = deps.configView, CFG_FALLBACK = deps.CFG_FALLBACK, COPY = deps.COPY, injectCss = deps.injectCss, allTables = deps.allTables, findFirstTable = deps.findFirstTable, treeWalk = deps.treeWalk, treeFlat = deps.treeFlat, cx = deps.cx, Icon2 = deps.Icon, TaskItem = deps.TaskItem, PathCrumbs = deps.PathCrumbs, TagFilter = deps.TagFilter, TreeNode = deps.TreeNode, CreateModal = deps.CreateModal, TimelineModal = deps.TimelineModal, NodeModal = deps.NodeModal, EditModal = deps.EditModal, DoneModal = deps.DoneModal, BatchModal = deps.BatchModal;
11420
11964
  var h = React.createElement, filters = require_task_filter_model(), renderFilters = require_task_filter_panel(), claimBatch = require_claim_batch(), renderSelectionBar = require_selection_bar();
11421
11965
  var TaskPreview = require_task_preview()(React, TaskItem);
11966
+ var SW = require_switch();
11422
11967
  function TasksView(props) {
11423
11968
  var lang = props.lang === "en" ? "en" : "zh";
11424
11969
  var cfg = configView.useConfig(props.api, CFG_FALLBACK);
@@ -12009,16 +12554,16 @@ var require_tasks_view = __commonJS({
12009
12554
  api,
12010
12555
  t,
12011
12556
  Icon: Icon2,
12012
- missing: h("label", { className: "wbt-check" }, h("input", {
12013
- type: "checkbox",
12014
- checked: difficultyMissing,
12015
- onChange: function(e) {
12016
- var next = e.target.checked;
12557
+ missing: h(SW.Switch, {
12558
+ h,
12559
+ checked: !!difficultyMissing,
12560
+ label: t.difficultyMissing,
12561
+ onChange: function(next) {
12017
12562
  setDifficultyMissing(next);
12018
12563
  if (next) setFilterValue(filters.clearDifficulty(filterValue));
12019
12564
  setPageNumber(1);
12020
12565
  }
12021
- }), t.difficultyMissing)
12566
+ })
12022
12567
  });
12023
12568
  var listBody = loading ? h("div", { className: "wbt-empty" }, t.loading) : error ? h("div", { className: "wbt-err" }, t.error + error) : data.records.length === 0 ? h("div", { className: "wbt-empty" }, t.empty) : h("div", { className: "wbt-list" }, data.records.map(function(task) {
12024
12569
  return h(TaskItem, {
@@ -12342,6 +12887,7 @@ var require_tasks_view = __commonJS({
12342
12887
  t,
12343
12888
  api,
12344
12889
  task: doneTask,
12890
+ lang: props.lang,
12345
12891
  onClose: function() {
12346
12892
  setDoneTask(null);
12347
12893
  },
@@ -12530,12 +13076,12 @@ var require_timeline_view = __commonJS({
12530
13076
  var React = deps.React, h = React.createElement, COPY = deps.COPY;
12531
13077
  var controls = require_timeline_controls()(React), AddMembers = require_timeline_add_members()(React);
12532
13078
  var Merge = require_timeline_merge()(React);
12533
- var CSS = require_timeline_styles();
12534
13079
  var MemberRows = require_timeline_member_rows()(React, deps.statusInfo);
12535
13080
  var TaskPreview = require_task_preview()(React, deps.TaskItem);
12536
13081
  var receipts = require_ownership();
12537
13082
  var splitTitle = require_timeline_title();
12538
13083
  var Highlight = require_highlight2()(React);
13084
+ var SW = require_switch();
12539
13085
  function result(r) {
12540
13086
  if (!r || !r.ok) throw new Error(r && r.error || "Request failed");
12541
13087
  return r.result;
@@ -12756,7 +13302,6 @@ var require_timeline_view = __commonJS({
12756
13302
  return h(
12757
13303
  "div",
12758
13304
  { className: "wbt-root wbt-timeline-view" },
12759
- h("style", null, CSS),
12760
13305
  h(
12761
13306
  "div",
12762
13307
  { className: "wbt-timeline-toolbar" },
@@ -12775,10 +13320,10 @@ var require_timeline_view = __commonJS({
12775
13320
  } }),
12776
13321
  h("button", { className: "wbt-btn", type: "submit" }, t.timelineSearchButton)
12777
13322
  ),
12778
- h("label", { className: "wbt-timeline-single" }, h("input", { type: "checkbox", "aria-label": t.timelineSingletons, checked: single, onChange: function(e) {
12779
- setSingle(e.target.checked);
13323
+ h(SW.Switch, { h, checked: !!single, label: t.timelineSingletons, onChange: function(next) {
13324
+ setSingle(next);
12780
13325
  setPage(1);
12781
- } }), t.timelineSingletons)
13326
+ } })
12782
13327
  ),
12783
13328
  h(
12784
13329
  "div",
@@ -13132,20 +13677,7 @@ var require_timeline_view = __commonJS({
13132
13677
  title: over ? "\u5DF2\u8D85\u8FC7\u8BA1\u5212\u5B8C\u6210\u65F6\u95F4" : "\u8DDD\u8BA1\u5212\u5B8C\u6210"
13133
13678
  }, h(Icon2, { name: "clock", size: 11 }), h("span", { className: "wbt-cd-num" }, text));
13134
13679
  }
13135
- var CSS = require_styles();
13136
- function injectCss() {
13137
- if (typeof document === "undefined") return;
13138
- var old = document.getElementById("wb-addon-tasks-v2-css");
13139
- if (old) {
13140
- old.textContent = CSS;
13141
- return;
13142
- }
13143
- var s = document.createElement("style");
13144
- s.id = "wb-addon-tasks-v2-css";
13145
- s.setAttribute("data-wb-addon", "wb-addon-tasks");
13146
- s.textContent = CSS;
13147
- document.head.appendChild(s);
13148
- }
13680
+ var injectCss = require_inject_css();
13149
13681
  function cx() {
13150
13682
  return Array.prototype.filter.call(arguments, Boolean).join(" ");
13151
13683
  }
@@ -13269,7 +13801,9 @@ var require_timeline_view = __commonJS({
13269
13801
  cx,
13270
13802
  Icon: Icon2,
13271
13803
  Countdown,
13272
- PathCrumbs
13804
+ PathCrumbs,
13805
+ // 任务详情也开 item.actions 落点:来源插件把「回到原处」挂进来。
13806
+ Slot: host.Slot
13273
13807
  });
13274
13808
  function TreeNode(props) {
13275
13809
  var node = props.node;
@@ -13461,6 +13995,7 @@ var require_timeline_view = __commonJS({
13461
13995
  );
13462
13996
  }
13463
13997
  var CreateModal = require_create_modal()({ React, allTables, tagNames, splitTags, today, addDays, hostHasAddon });
13998
+ var slotTaskFromMessage = require_slot_task_from_message()({ React, Icon: Icon2, injectCss });
13464
13999
  var TimelineModal = require_task_timeline_modal()(React, statusInfo);
13465
14000
  function DoneModal(props) {
13466
14001
  var t = props.t;
@@ -13480,7 +14015,7 @@ var require_timeline_view = __commonJS({
13480
14015
  { className: "wbt-modal", style: { width: "420px" } },
13481
14016
  h("div", { className: "wbt-modal-head" }, h("h3", null, t.complete + " \xB7 " + props.task.title), h("button", { className: "wbt-icon", onClick: props.onClose }, "\xD7")),
13482
14017
  h("div", { className: "wbt-mhint" }, t.difficultyHint),
13483
- require_difficulty_field()(React)(t, value, setValue, "wbt-done-difficulty"),
14018
+ require_difficulty_field()(React)(t, value, setValue, "wbt-done-difficulty", props.lang),
13484
14019
  h(
13485
14020
  "label",
13486
14021
  { className: "wbt-field", style: { marginTop: "12px" } },
@@ -13530,8 +14065,11 @@ var require_timeline_view = __commonJS({
13530
14065
  var TimelineView = require_timeline_view()({ React, COPY, injectCss, statusInfo, configView, CFG_FALLBACK, TaskItem, EditModal, DoneModal, TimelineModal, CreateModal });
13531
14066
  host.registerAddon({
13532
14067
  id: "wb-addon-tasks",
13533
- version: "5.2.31",
14068
+ version: "5.2.35",
13534
14069
  icon: ICONS["list-checks"],
14070
+ // 贡献声明写在 registerAddon 里:卸载任务插件时宿主按 addonId 一起撤销,
14071
+ // 不会在邮件里留一个渲染即报错的孤儿按钮。
14072
+ slots: [{ slot: "item.actions", id: "tasks.create-from-mail", order: 100, component: slotTaskFromMessage }],
13535
14073
  views: [
13536
14074
  { id: "stats", icon: tabIcon("chart"), title: { zh: "\u7EDF\u8BA1", en: "Stats" }, component: statsView.TasksStatsView, keepAlive: true },
13537
14075
  { id: "tasks", icon: tabIcon("list"), title: { zh: "\u8BB0\u5F55", en: "Records" }, component: TasksView },