dsh-workbench-sites 1.12.1 → 1.12.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/client.js CHANGED
@@ -74,6 +74,8 @@ var require_filter_checklist = __commonJS({
74
74
  var onLoadMore = props.onLoadMore;
75
75
  var onClear = props.onClear || function() {
76
76
  };
77
+ var single = props.mode === "single";
78
+ var onPick = typeof props.onPick === "function" ? props.onPick : onToggle;
77
79
  function toggle(id) {
78
80
  if (disabled) return;
79
81
  onToggle(id);
@@ -86,8 +88,8 @@ var require_filter_checklist = __commonJS({
86
88
  "div",
87
89
  { className: "wbck-head" },
88
90
  h2("span", { className: "wbck-grow" }, title + (total ? " \xB7 " + total : "")),
89
- selected.length ? h2("span", { className: "wbck-sel" }, selectedText + " " + selected.length) : null,
90
- selected.length || query ? h2("button", {
91
+ !single && selected.length ? h2("span", { className: "wbck-sel" }, selectedText + " " + selected.length) : null,
92
+ !single && (selected.length || query) ? h2("button", {
91
93
  type: "button",
92
94
  className: "wbck-clear",
93
95
  title: clearText,
@@ -104,6 +106,25 @@ var require_filter_checklist = __commonJS({
104
106
  } else {
105
107
  body = items.map(function(x) {
106
108
  var on = selected.indexOf(String(x.id)) >= 0;
109
+ if (single) {
110
+ return h2(
111
+ "button",
112
+ {
113
+ key: x.id,
114
+ type: "button",
115
+ role: "radio",
116
+ "aria-checked": on ? "true" : "false",
117
+ className: "wbck-opt" + (on ? " is-on" : ""),
118
+ disabled,
119
+ onClick: function() {
120
+ if (disabled) return;
121
+ onPick(x.id);
122
+ }
123
+ },
124
+ h2("span", { className: "wbck-nm", title: x.name }, x.name),
125
+ x.meta ? h2("span", { className: "wbck-meta" }, x.meta) : null
126
+ );
127
+ }
107
128
  return h2(
108
129
  "label",
109
130
  { key: x.id, className: "wbck-opt" + (on ? " is-on" : "") },
@@ -146,6 +167,8 @@ var require_filter_checklist = __commonJS({
146
167
  h2("div", {
147
168
  className: "wbck-list",
148
169
  onScroll: scroll,
170
+ role: single ? "radiogroup" : void 0,
171
+ "aria-label": single ? props.groupLabel || searchPlaceholder : void 0,
149
172
  "aria-busy": loading ? "true" : "false"
150
173
  }, body)
151
174
  );
@@ -302,6 +325,419 @@ var require_tagfilter = __commonJS({
302
325
  }
303
326
  });
304
327
 
328
+ // packages/addons/lib/date-picker.cjs
329
+ var require_date_picker = __commonJS({
330
+ "packages/addons/lib/date-picker.cjs"(exports2, module2) {
331
+ "use strict";
332
+ var ReactDefault = require("react");
333
+ var MONTH_EN = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
334
+ function pad(n) {
335
+ return String(n).padStart(2, "0");
336
+ }
337
+ function todayISO() {
338
+ var d = /* @__PURE__ */ new Date();
339
+ return d.getFullYear() + "-" + pad(d.getMonth() + 1) + "-" + pad(d.getDate());
340
+ }
341
+ function validDate(value) {
342
+ if (!value) return false;
343
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) return false;
344
+ var d = /* @__PURE__ */ new Date(value + "T00:00:00Z");
345
+ return isFinite(d.getTime()) && d.toISOString().slice(0, 10) === value && value.slice(0, 4) !== "0000";
346
+ }
347
+ function toUTC(iso) {
348
+ return /* @__PURE__ */ new Date(iso + "T00:00:00Z");
349
+ }
350
+ function shiftDate(iso, days) {
351
+ var d = toUTC(iso);
352
+ d.setUTCDate(d.getUTCDate() + days);
353
+ return d.toISOString().slice(0, 10);
354
+ }
355
+ function shiftMonth(month, delta) {
356
+ var d = toUTC(month + "-01");
357
+ d.setUTCMonth(d.getUTCMonth() + delta);
358
+ return d.toISOString().slice(0, 7);
359
+ }
360
+ function monthKey(iso) {
361
+ return (iso || todayISO()).slice(0, 7);
362
+ }
363
+ function monthLabel(month, en) {
364
+ return en ? month.slice(0, 4) + "-" + month.slice(5) : month.slice(0, 4) + "\u5E74" + Number(month.slice(5)) + "\u6708";
365
+ }
366
+ function daysInMonth(month) {
367
+ return new Date(Date.UTC(Number(month.slice(0, 4)), Number(month.slice(5)), 0)).getUTCDate();
368
+ }
369
+ function normalizeRange(value) {
370
+ var from = value && validDate(value.from) ? value.from : "";
371
+ var to = value && validDate(value.to) ? value.to : "";
372
+ if (from && to && from > to) return { from: to, to: from, swapped: true };
373
+ return { from, to, swapped: false };
374
+ }
375
+ function clampDay(iso, min, max) {
376
+ if (min && iso < min) return false;
377
+ if (max && iso > max) return false;
378
+ return true;
379
+ }
380
+ function ctx(props) {
381
+ var R = props && props.React || ReactDefault;
382
+ return { R, h: props && props.h || R.createElement };
383
+ }
384
+ function usePopover(R, open, setOpen, root) {
385
+ R.useEffect(function() {
386
+ if (!open) return void 0;
387
+ function onDoc(ev) {
388
+ if (root.current && !root.current.contains(ev.target)) setOpen(false);
389
+ }
390
+ function onKey(ev) {
391
+ if (ev.key === "Escape") setOpen(false);
392
+ }
393
+ if (typeof document !== "undefined" && typeof document.addEventListener === "function") {
394
+ document.addEventListener("mousedown", onDoc);
395
+ document.addEventListener("keydown", onKey);
396
+ return function() {
397
+ document.removeEventListener("mousedown", onDoc);
398
+ document.removeEventListener("keydown", onKey);
399
+ };
400
+ }
401
+ return void 0;
402
+ }, [open]);
403
+ }
404
+ function Calendar(props) {
405
+ var h2 = props.h, p = props.prefix, en = props.lang === "en";
406
+ var month = props.month, cells = [];
407
+ var offset = toUTC(month + "-01").getUTCDay();
408
+ var count = daysInMonth(month);
409
+ var i;
410
+ for (i = 0; i < offset; i++) cells.push(h2("span", { key: "e" + i, "aria-hidden": "true" }));
411
+ for (i = 1; i <= count; i++) {
412
+ var day = month + "-" + pad(i);
413
+ var disabled = !clampDay(day, props.min, props.max);
414
+ var selected = props.isSelected ? props.isSelected(day) : false;
415
+ var between = props.isBetween ? props.isBetween(day) : false;
416
+ cells.push(h2("button", {
417
+ key: day,
418
+ type: "button",
419
+ disabled,
420
+ "data-day": day,
421
+ "aria-label": day,
422
+ "aria-pressed": selected,
423
+ "aria-current": day === todayISO() ? "date" : void 0,
424
+ className: p + "-dp-day" + (selected ? " is-on" : "") + (between ? " is-between" : "") + (day === todayISO() ? " is-today" : ""),
425
+ onClick: props.onPick.bind(null, day),
426
+ onKeyDown: function(ev) {
427
+ var delta = { ArrowLeft: -1, ArrowRight: 1, ArrowUp: -7, ArrowDown: 7 }[ev.key];
428
+ if (!delta) return;
429
+ ev.preventDefault();
430
+ var next = shiftDate(ev.currentTarget.getAttribute("data-day"), delta);
431
+ if (clampDay(next, props.min, props.max)) props.onMove(monthKey(next), next);
432
+ }
433
+ }, i));
434
+ }
435
+ return h2(
436
+ "div",
437
+ { className: p + "-dp-cal", role: "group", "aria-label": en ? "Calendar" : "\u65E5\u5386" },
438
+ h2(
439
+ "div",
440
+ { className: p + "-dp-head" },
441
+ h2("button", { type: "button", className: p + "-dp-nav", "aria-label": en ? "Previous month" : "\u4E0A\u4E2A\u6708", onClick: function() {
442
+ props.onMove(shiftMonth(month, -1), "");
443
+ } }, "\u2039"),
444
+ h2("strong", { className: p + "-dp-title", "aria-live": "polite" }, monthLabel(month, en)),
445
+ h2("button", { type: "button", className: p + "-dp-nav", "aria-label": en ? "Next month" : "\u4E0B\u4E2A\u6708", onClick: function() {
446
+ props.onMove(shiftMonth(month, 1), "");
447
+ } }, "\u203A")
448
+ ),
449
+ h2(
450
+ "div",
451
+ { className: p + "-dp-weekdays", "aria-hidden": "true" },
452
+ (en ? ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"] : ["\u65E5", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D"]).map(function(w) {
453
+ return h2("span", { key: w }, w);
454
+ })
455
+ ),
456
+ h2("div", { className: p + "-dp-grid" }, cells)
457
+ );
458
+ }
459
+ function DatePicker(props) {
460
+ var c = ctx(props), R = c.R, h2 = c.h;
461
+ var p = props.prefix, en = props.lang === "en";
462
+ var value = validDate(props.value) ? props.value : "";
463
+ var openS = R.useState(!!props.defaultOpen), open = openS[0], setOpen = openS[1];
464
+ var monthS = R.useState(monthKey(value || props.max || todayISO())), month = monthS[0], setMonth = monthS[1];
465
+ var root = R.useRef(null);
466
+ usePopover(R, open, setOpen, root);
467
+ function pick(day) {
468
+ if (props.onChange) props.onChange(day);
469
+ setOpen(false);
470
+ }
471
+ function toggle() {
472
+ setMonth(monthKey(validDate(props.value) ? props.value : props.max || todayISO()));
473
+ setOpen(!open);
474
+ }
475
+ return h2(
476
+ "div",
477
+ { className: p + "-dp" + (props.className ? " " + props.className : ""), ref: root },
478
+ h2(
479
+ "div",
480
+ { className: p + "-dp-field" },
481
+ h2(
482
+ "button",
483
+ {
484
+ type: "button",
485
+ className: p + "-dp-trigger",
486
+ disabled: !!props.disabled,
487
+ "aria-haspopup": "dialog",
488
+ "aria-expanded": open,
489
+ "aria-label": (props.label ? props.label + ": " : "") + (value || props.placeholder || (en ? "Pick a date" : "\u9009\u62E9\u65E5\u671F")),
490
+ onClick: toggle
491
+ },
492
+ h2("span", { className: p + "-dp-glyph", "aria-hidden": "true" }),
493
+ h2("span", { className: p + "-dp-value" + (value ? "" : " is-empty") }, value || props.placeholder || (en ? "Pick a date" : "\u9009\u62E9\u65E5\u671F"))
494
+ ),
495
+ value && !props.disabled && props.clearable !== false ? h2("button", { type: "button", className: p + "-dp-clear", "aria-label": en ? "Clear date" : "\u6E05\u9664\u65E5\u671F", onClick: function() {
496
+ if (props.onChange) props.onChange("");
497
+ } }, "\xD7") : null
498
+ ),
499
+ open ? h2(
500
+ "div",
501
+ { className: p + "-dp-pop", role: "dialog", "aria-modal": "false", "aria-label": props.label || (en ? "Pick a date" : "\u9009\u62E9\u65E5\u671F") },
502
+ h2(Calendar, { h: h2, prefix: p, lang: props.lang, month, min: props.min, max: props.max, onMove: function(m) {
503
+ setMonth(m);
504
+ }, isSelected: function(d) {
505
+ return d === value;
506
+ }, onPick: pick }),
507
+ h2(
508
+ "div",
509
+ { className: p + "-dp-foot" },
510
+ h2("button", { type: "button", className: p + "-dp-link", onClick: function() {
511
+ pick(todayISO());
512
+ } }, en ? "Today" : "\u4ECA\u5929"),
513
+ props.min || props.max ? h2("span", { className: p + "-dp-hint" }, [props.min, props.max].filter(Boolean).join(" \u2014 ")) : null
514
+ )
515
+ ) : null
516
+ );
517
+ }
518
+ function RangePicker(props) {
519
+ var c = ctx(props), R = c.R, h2 = c.h;
520
+ var p = props.prefix, en = props.lang === "en";
521
+ var range = normalizeRange(props.value);
522
+ var from = range.from, to = range.to;
523
+ var openS = R.useState(!!props.defaultOpen), open = openS[0], setOpen = openS[1];
524
+ var startS = R.useState(""), start = startS[0], setStart = startS[1];
525
+ var monthS = R.useState(monthKey(from || to || props.max || todayISO())), month = monthS[0], setMonth = monthS[1];
526
+ var root = R.useRef(null);
527
+ usePopover(R, open, setOpen, root);
528
+ function apply(next) {
529
+ if (typeof props.onChange === "function") props.onChange(normalizeRange(next));
530
+ setStart("");
531
+ setOpen(false);
532
+ }
533
+ function pick(day) {
534
+ if (!start) {
535
+ setStart(day);
536
+ return;
537
+ }
538
+ apply({ from: start, to: day });
539
+ }
540
+ function toggle() {
541
+ setStart("");
542
+ setMonth(monthKey(from || to || props.max || todayISO()));
543
+ setOpen(!open);
544
+ }
545
+ var summary = from && to ? from + " \u2014 " + to : from ? from + (en ? " onward" : " \u8D77") : to ? (en ? "Until " : "\u622A\u81F3 ") + to : props.placeholder || (en ? "Choose date range" : "\u9009\u62E9\u65E5\u671F\u8303\u56F4");
546
+ return h2(
547
+ "div",
548
+ { className: p + "-dr" + (props.className ? " " + props.className : ""), ref: root },
549
+ h2(
550
+ "div",
551
+ { className: p + "-dp-field" },
552
+ h2(
553
+ "button",
554
+ {
555
+ type: "button",
556
+ className: p + "-dp-trigger",
557
+ "aria-haspopup": "dialog",
558
+ "aria-expanded": open,
559
+ "aria-label": (props.label || (en ? "Date range" : "\u65E5\u671F\u8303\u56F4")) + ": " + summary,
560
+ onClick: toggle
561
+ },
562
+ h2("span", { className: p + "-dp-glyph", "aria-hidden": "true" }),
563
+ h2("span", { className: p + "-dp-value" + (from || to ? "" : " is-empty") }, summary)
564
+ ),
565
+ (from || to) && props.clearable !== false ? h2("button", { type: "button", className: p + "-dp-clear", "aria-label": en ? "Clear range" : "\u6E05\u9664\u8303\u56F4", onClick: function() {
566
+ apply({ from: "", to: "" });
567
+ } }, "\xD7") : null
568
+ ),
569
+ open ? h2(
570
+ "div",
571
+ { className: p + "-dp-pop", role: "dialog", "aria-modal": "false", "aria-label": props.label || (en ? "Date range" : "\u65E5\u671F\u8303\u56F4") },
572
+ h2(Calendar, {
573
+ h: h2,
574
+ prefix: p,
575
+ lang: props.lang,
576
+ month,
577
+ min: props.min,
578
+ max: props.max,
579
+ onMove: function(m) {
580
+ setMonth(m);
581
+ },
582
+ isSelected: function(d) {
583
+ return start ? d === start : d === from || d === to;
584
+ },
585
+ isBetween: function(d) {
586
+ return start ? start < d && d < (to || "") : !!(from && to && d > from && d < to);
587
+ },
588
+ onPick: pick
589
+ }),
590
+ h2(
591
+ "p",
592
+ { className: p + "-dp-hint", role: "status" },
593
+ start ? en ? "Start " + start + " \xB7 pick the end date" : "\u8D77\u59CB " + start + " \xB7 \u8BF7\u9009\u62E9\u7ED3\u675F\u65E5\u671F" : en ? "Pick start, then end date" : "\u5148\u9009\u5F00\u59CB\u65E5\u671F\uFF0C\u518D\u9009\u7ED3\u675F\u65E5\u671F"
594
+ ),
595
+ start ? h2(
596
+ "div",
597
+ { className: p + "-dp-acts" },
598
+ h2("button", { type: "button", className: p + "-dp-link", onClick: function() {
599
+ apply({ from: start, to: "" });
600
+ } }, en ? "Only start" : "\u4EC5\u8D77\u59CB\u65E5\u671F"),
601
+ h2("button", { type: "button", className: p + "-dp-link", onClick: function() {
602
+ apply({ from: "", to: start });
603
+ } }, en ? "Only end" : "\u4EC5\u622A\u6B62\u65E5\u671F")
604
+ ) : null,
605
+ h2(
606
+ "div",
607
+ { className: p + "-dp-foot" },
608
+ h2("button", { type: "button", className: p + "-dp-link", onClick: function() {
609
+ setOpen(false);
610
+ setStart("");
611
+ } }, en ? "Cancel" : "\u53D6\u6D88")
612
+ )
613
+ ) : null
614
+ );
615
+ }
616
+ function MonthPicker(props) {
617
+ var c = ctx(props), R = c.R, h2 = c.h;
618
+ var p = props.prefix, en = props.lang === "en";
619
+ var value = /^\d{4}-\d{2}$/.test(props.value || "") ? props.value : "";
620
+ var base = value || monthKey(props.max || todayISO());
621
+ var openS = R.useState(!!props.defaultOpen), open = openS[0], setOpen = openS[1];
622
+ var yearS = R.useState(Number(base.slice(0, 4))), year = yearS[0], setYear = yearS[1];
623
+ var root = R.useRef(null);
624
+ usePopover(R, open, setOpen, root);
625
+ function pick(month) {
626
+ if (props.onChange) props.onChange(month);
627
+ setOpen(false);
628
+ }
629
+ var months = [];
630
+ for (var m = 1; m <= 12; m++) {
631
+ var key = year + "-" + pad(m);
632
+ months.push(h2("button", {
633
+ key,
634
+ type: "button",
635
+ "data-month": key,
636
+ "aria-pressed": key === value,
637
+ className: p + "-dp-day" + (key === value ? " is-on" : "") + (key === monthKey(todayISO()) ? " is-today" : ""),
638
+ onClick: pick.bind(null, key)
639
+ }, en ? MONTH_EN[m - 1] : m + "\u6708"));
640
+ }
641
+ return h2(
642
+ "div",
643
+ { className: p + "-dp" + (props.className ? " " + props.className : ""), ref: root },
644
+ h2(
645
+ "div",
646
+ { className: p + "-dp-field" },
647
+ h2(
648
+ "button",
649
+ {
650
+ type: "button",
651
+ className: p + "-dp-trigger",
652
+ "aria-haspopup": "dialog",
653
+ "aria-expanded": open,
654
+ "aria-label": (props.label || (en ? "Pick a month" : "\u9009\u62E9\u6708\u4EFD")) + ": " + (value ? monthLabel(value, en) : ""),
655
+ onClick: function() {
656
+ setYear(Number((value || base).slice(0, 4)));
657
+ setOpen(!open);
658
+ }
659
+ },
660
+ h2("span", { className: p + "-dp-glyph", "aria-hidden": "true" }),
661
+ h2("span", { className: p + "-dp-value" + (value ? "" : " is-empty") }, value ? monthLabel(value, en) : props.placeholder || (en ? "Pick a month" : "\u9009\u62E9\u6708\u4EFD"))
662
+ ),
663
+ value && props.clearable !== false ? h2("button", { type: "button", className: p + "-dp-clear", "aria-label": en ? "Clear month" : "\u6E05\u9664\u6708\u4EFD", onClick: function() {
664
+ if (props.onChange) props.onChange("");
665
+ } }, "\xD7") : null
666
+ ),
667
+ open ? h2(
668
+ "div",
669
+ { className: p + "-dp-pop is-months", role: "dialog", "aria-modal": "false", "aria-label": props.label || (en ? "Pick a month" : "\u9009\u62E9\u6708\u4EFD") },
670
+ h2(
671
+ "div",
672
+ { className: p + "-dp-head" },
673
+ h2("button", { type: "button", className: p + "-dp-nav", "aria-label": en ? "Previous year" : "\u4E0A\u4E00\u5E74", onClick: function() {
674
+ setYear(year - 1);
675
+ } }, "\u2039"),
676
+ h2("strong", { className: p + "-dp-title", "aria-live": "polite" }, en ? String(year) : year + "\u5E74"),
677
+ h2("button", { type: "button", className: p + "-dp-nav", "aria-label": en ? "Next year" : "\u4E0B\u4E00\u5E74", onClick: function() {
678
+ setYear(year + 1);
679
+ } }, "\u203A")
680
+ ),
681
+ h2("div", { className: p + "-dp-months" }, months),
682
+ h2(
683
+ "div",
684
+ { className: p + "-dp-foot" },
685
+ h2("button", { type: "button", className: p + "-dp-link", onClick: function() {
686
+ pick(monthKey(todayISO()));
687
+ } }, en ? "This month" : "\u672C\u6708"),
688
+ h2("button", { type: "button", className: p + "-dp-link", onClick: function() {
689
+ setOpen(false);
690
+ } }, en ? "Cancel" : "\u53D6\u6D88")
691
+ )
692
+ ) : null
693
+ );
694
+ }
695
+ function InlineCalendar(props) {
696
+ var c = ctx(props), R = c.R, h2 = c.h;
697
+ var p = props.prefix;
698
+ var value = validDate(props.value) ? props.value : "";
699
+ var monthS = R.useState(monthKey(props.month || value || props.max || todayISO())), month = monthS[0], setMonth = monthS[1];
700
+ return h2(
701
+ "div",
702
+ { className: p + "-dp is-inline" },
703
+ h2(Calendar, {
704
+ h: h2,
705
+ prefix: p,
706
+ lang: props.lang,
707
+ month,
708
+ min: props.min,
709
+ max: props.max,
710
+ onMove: function(m) {
711
+ setMonth(m);
712
+ if (props.onMonthChange) props.onMonthChange(m);
713
+ },
714
+ isSelected: function(d) {
715
+ return d === value;
716
+ },
717
+ isBetween: props.isBetween,
718
+ onPick: function(d) {
719
+ if (props.onChange) props.onChange(d);
720
+ }
721
+ }),
722
+ props.footer ? h2("div", { className: p + "-dp-foot" }, props.footer) : null
723
+ );
724
+ }
725
+ module2.exports = {
726
+ DatePicker,
727
+ RangePicker,
728
+ MonthPicker,
729
+ InlineCalendar,
730
+ todayISO,
731
+ validDate,
732
+ shiftDate,
733
+ shiftMonth,
734
+ normalizeRange,
735
+ monthLabel,
736
+ daysInMonth
737
+ };
738
+ }
739
+ });
740
+
305
741
  // node_modules/.pnpm/lucide-react@1.70.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils/toKebabCase.mjs
306
742
  var toKebabCase;
307
743
  var init_toKebabCase = __esm({
@@ -870,11 +1306,60 @@ var init_plus = __esm({
870
1306
  }
871
1307
  });
872
1308
 
1309
+ // packages/addons/lib/date-picker-styles.cjs
1310
+ var require_date_picker_styles = __commonJS({
1311
+ "packages/addons/lib/date-picker-styles.cjs"(exports2, module2) {
1312
+ "use strict";
1313
+ module2.exports = function datePickerStyles(prefix) {
1314
+ var p = String(prefix || "wb");
1315
+ return [
1316
+ ".{p}-dp,.{p}-dr{position:relative;min-width:0}",
1317
+ ".{p}-dp-field{display:flex;align-items:center;gap:6px;min-width:0}",
1318
+ ".{p}-dp-trigger{display:flex;align-items:center;gap:8px;min-width:0;width:100%;padding:8px 10px;border:1px solid var(--wb-border);border-radius:8px;background:var(--wb-surface);color:var(--wb-text,inherit);font:inherit;text-align:left;cursor:pointer;transition:border-color .15s,box-shadow .15s}",
1319
+ ".{p}-dp-trigger:hover{border-color:var(--wb-accent)}",
1320
+ ".{p}-dp-trigger:focus-visible{outline:2px solid var(--wb-accent);outline-offset:1px}",
1321
+ ".{p}-dp-trigger[disabled]{opacity:.55;cursor:not-allowed}",
1322
+ ".{p}-dp-glyph{width:13px;height:13px;flex:none;border:1.5px solid currentColor;border-radius:3px;position:relative;opacity:.72}",
1323
+ '.{p}-dp-glyph::before{content:"";position:absolute;left:-1.5px;right:-1.5px;top:3px;border-top:1.5px solid currentColor}',
1324
+ '.{p}-dp-glyph::after{content:"";position:absolute;left:3px;top:-3px;width:1.5px;height:3px;background:currentColor;box-shadow:4px 0 currentColor}',
1325
+ ".{p}-dp-value{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-variant-numeric:tabular-nums}",
1326
+ ".{p}-dp-value.is-empty{color:var(--wb-muted)}",
1327
+ ".{p}-dp-clear{flex:none;width:22px;height:22px;padding:0;border:0;border-radius:50%;background:color-mix(in srgb,var(--wb-muted) 14%,transparent);color:var(--wb-muted);font:inherit;line-height:1;cursor:pointer}",
1328
+ ".{p}-dp-clear:hover{color:var(--wb-danger);background:color-mix(in srgb,var(--wb-danger) 16%,transparent)}",
1329
+ ".{p}-dp-pop{position:absolute;z-index:40;top:calc(100% + 6px);left:0;width:272px;padding:10px;border:1px solid var(--wb-border);border-radius:12px;background:var(--wb-card);box-shadow:0 16px 40px color-mix(in srgb,var(--wb-text,var(--wb-border)) 18%,transparent);animation:{p}-dp-in .14s ease-out}",
1330
+ ".{p}-dp-head{display:flex;align-items:center;gap:6px;margin-bottom:8px}",
1331
+ ".{p}-dp-title{flex:1;text-align:center;font-size:13px;font-weight:600;font-variant-numeric:tabular-nums}",
1332
+ ".{p}-dp-nav{width:26px;height:26px;padding:0;border:1px solid var(--wb-border);border-radius:7px;background:transparent;color:inherit;font:inherit;line-height:1;cursor:pointer}",
1333
+ ".{p}-dp-nav:hover{border-color:var(--wb-accent);color:var(--wb-accent)}",
1334
+ ".{p}-dp-weekdays,.{p}-dp-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:2px}",
1335
+ ".{p}-dp-weekdays{margin-bottom:4px;font-size:11px;color:var(--wb-muted);text-align:center}",
1336
+ ".{p}-dp-day{min-width:0;height:30px;padding:0;border:0;border-radius:7px;background:transparent;color:inherit;font:inherit;font-variant-numeric:tabular-nums;cursor:pointer}",
1337
+ ".{p}-dp-day:hover{background:color-mix(in srgb,var(--wb-accent) 12%,transparent)}",
1338
+ ".{p}-dp-day.is-between{background:color-mix(in srgb,var(--wb-accent) 16%,transparent);border-radius:0}",
1339
+ ".{p}-dp-day.is-today{box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--wb-accent) 55%,transparent)}",
1340
+ ".{p}-dp-day.is-on{background:var(--wb-accent);color:var(--wb-on-accent,inherit);font-weight:600}",
1341
+ ".{p}-dp-day:disabled{opacity:.35;cursor:not-allowed}",
1342
+ ".{p}-dp-day:focus-visible{outline:2px solid var(--wb-accent);outline-offset:-2px}",
1343
+ ".{p}-dp-foot{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:8px;padding-top:8px;border-top:1px solid var(--wb-line)}",
1344
+ ".{p}-dp-acts{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px}",
1345
+ ".{p}-dp-link{padding:4px 8px;border:0;border-radius:6px;background:color-mix(in srgb,var(--wb-muted) 12%,transparent);color:inherit;font:inherit;font-size:12px;cursor:pointer}",
1346
+ ".{p}-dp-link:hover{background:color-mix(in srgb,var(--wb-accent) 16%,transparent);color:var(--wb-accent)}",
1347
+ ".{p}-dp-hint{margin:6px 0 0;font-size:11px;color:var(--wb-muted)}",
1348
+ ".{p}-dp-pop.is-months{width:248px}",
1349
+ ".{p}-dp-months{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;margin-bottom:6px}",
1350
+ ".{p}-dp-months .{p}-dp-day{height:34px}",
1351
+ "@keyframes {p}-dp-in{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}"
1352
+ ].join("\n").replace(/\{p\}/g, p);
1353
+ };
1354
+ }
1355
+ });
1356
+
873
1357
  // packages/addons/sites/client/stats/charts.cjs
874
1358
  var require_charts = __commonJS({
875
1359
  "packages/addons/sites/client/stats/charts.cjs"(exports2, module2) {
876
1360
  var React2 = require("react");
877
1361
  var h2 = React2.createElement;
1362
+ var DP = require_date_picker();
878
1363
  var ICONS = {
879
1364
  "refresh": (init_refresh_cw(), __toCommonJS(refresh_cw_exports)).default,
880
1365
  "globe": (init_globe(), __toCommonJS(globe_exports)).default,
@@ -901,8 +1386,7 @@ var require_charts = __commonJS({
901
1386
  ".@-seg{display:inline-flex;border:1px solid var(--dsw-alias-border-l2,#e5e6eb);border-radius:9px;overflow:hidden;background:var(--dsw-alias-bg-layer-1,#fff)}",
902
1387
  ".@-seg button{appearance:none;border:0;background:transparent;color:var(--dsw-alias-label-secondary,#646a73);font-size:12px;padding:6px 10px;cursor:pointer;white-space:nowrap}",
903
1388
  ".@-seg button.@-on{background:var(--dsw-alias-brand-primary,#4f6ef7);color:var(--dsw-alias-label-primary-inverted,#fff)}",
904
- ".@-range{display:inline-flex;align-items:center;gap:4px;border:1px solid var(--dsw-alias-border-l2,#e5e6eb);border-radius:9px;padding:2px 6px;background:var(--dsw-alias-bg-layer-1,#fff)}",
905
- ".@-range:focus-within{border-color:var(--dsw-alias-brand-primary,#4f6ef7)}",
1389
+ ".@-range{display:inline-flex;align-items:center;gap:4px}",
906
1390
  ".@-date{appearance:none;border:0;background:transparent;color:var(--dsw-alias-label-secondary,#646a73);font-family:inherit;font-size:12px;padding:4px 2px;width:116px;outline:none}",
907
1391
  ".@-date::-webkit-calendar-picker-indicator{opacity:.55;cursor:pointer}",
908
1392
  ".@-dash{color:var(--dsw-alias-label-tertiary,#8f959e);font-size:12px}",
@@ -966,7 +1450,8 @@ var require_charts = __commonJS({
966
1450
  "@keyframes @-pulse{0%,100%{opacity:.55}50%{opacity:1}}",
967
1451
  "@media (max-width:900px){.@-scard{grid-column:span 12}.@-span-3,.@-span-4,.@-span-6,.@-span-8{grid-column:span 12}.@-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}}",
968
1452
  "@media (max-width:600px){.@-stats{padding-bottom:16px}.@-hist{height:130px}.@-kpi-v{font-size:22px}}",
969
- "@media (prefers-reduced-motion:reduce){.@-sk{animation:none}}"
1453
+ "@media (prefers-reduced-motion:reduce){.@-sk{animation:none}}",
1454
+ require_date_picker_styles()(prefix)
970
1455
  ].join("\n").replace(/@-/g, prefix + "-");
971
1456
  }
972
1457
  function makeCharts(prefix) {
@@ -1273,28 +1758,18 @@ var require_charts = __commonJS({
1273
1758
  h2(
1274
1759
  "div",
1275
1760
  { className: prefix + "-range", role: "group", "aria-label": props.customAria || "\u81EA\u5B9A\u4E49\u65E5\u671F\u8303\u56F4" },
1276
- h2("input", {
1277
- type: "date",
1278
- className: prefix + "-date",
1279
- value: from,
1280
- max: props.today || void 0,
1281
- "aria-label": props.fromLabel || "\u8D77\u59CB\u65E5\u671F",
1282
- title: props.fromLabel || "\u8D77\u59CB\u65E5\u671F",
1283
- onChange: function(e) {
1284
- setDate("from", e.target.value);
1285
- }
1286
- }),
1287
- h2("span", { className: prefix + "-dash", "aria-hidden": "true" }, "\u2013"),
1288
- h2("input", {
1289
- type: "date",
1290
- className: prefix + "-date",
1291
- value: to,
1292
- min: from || void 0,
1761
+ h2(DP.RangePicker, {
1762
+ React: React2,
1763
+ h: h2,
1764
+ prefix,
1765
+ lang: props.lang,
1766
+ label: props.customAria || "\u81EA\u5B9A\u4E49\u65E5\u671F\u8303\u56F4",
1767
+ value: { from, to },
1293
1768
  max: props.today || void 0,
1294
- "aria-label": props.toLabel || "\u7EC8\u6B62\u65E5\u671F",
1295
- title: props.toLabel || "\u7EC8\u6B62\u65E5\u671F",
1296
- onChange: function(e) {
1297
- setDate("to", e.target.value);
1769
+ clearable: false,
1770
+ onChange: function(next) {
1771
+ if (typeof props.onCustomChange !== "function") return;
1772
+ props.onCustomChange({ from: next.from, to: next.to });
1298
1773
  }
1299
1774
  }),
1300
1775
  from || to ? h2("button", {
@@ -4189,7 +4664,9 @@ var require_copy = __commonJS({
4189
4664
  passphrase: "\u8F93\u5165\u53E3\u4EE4\uFF08\u81F3\u5C11 8 \u4F4D\uFF09",
4190
4665
  passphraseAgain: "\u518D\u8F93\u4E00\u6B21\u53E3\u4EE4",
4191
4666
  passTooShort: "\u53E3\u4EE4\u81F3\u5C11 8 \u4F4D",
4192
- passMismatch: "\u4E24\u6B21\u53E3\u4EE4\u4E0D\u4E00\u81F4"
4667
+ passMismatch: "\u4E24\u6B21\u53E3\u4EE4\u4E0D\u4E00\u81F4",
4668
+ showPlain: "\u663E\u793A\u660E\u6587",
4669
+ hidePlain: "\u9690\u85CF\u660E\u6587"
4193
4670
  },
4194
4671
  en: {
4195
4672
  title: "Sites",
@@ -4301,7 +4778,9 @@ var require_copy = __commonJS({
4301
4778
  passphrase: "Passphrase (8+ characters)",
4302
4779
  passphraseAgain: "Repeat passphrase",
4303
4780
  passTooShort: "Passphrase must be at least 8 characters",
4304
- passMismatch: "Passphrases do not match"
4781
+ passMismatch: "Passphrases do not match",
4782
+ showPlain: "Show plain text",
4783
+ hidePlain: "Hide plain text"
4305
4784
  }
4306
4785
  };
4307
4786
  }
@@ -4329,6 +4808,10 @@ var require_filter_checklist_styles = __commonJS({
4329
4808
  ".wbck-opt:hover{background:color-mix(in srgb, currentColor 7%, transparent)}",
4330
4809
  ".wbck-opt.is-on{background:color-mix(in srgb, var(--wb-accent) 10%, transparent)}",
4331
4810
  ".wbck-opt input{margin:0;flex:none;accent-color:var(--wb-accent)}",
4811
+ // 单选变体用 button 渲染(role="radio"),这里把浏览器默认按钮样式清掉,视觉与多选行一致。
4812
+ '.wbck-opt[role="radio"]{appearance:none;width:100%;box-sizing:border-box;border:0;background:transparent;color:inherit;font:inherit;text-align:left}',
4813
+ '.wbck-opt[role="radio"]:disabled{opacity:.55;cursor:not-allowed}',
4814
+ '.wbck-opt[role="radio"]:focus-visible{outline:2px solid var(--wb-accent);outline-offset:-2px}',
4332
4815
  ".wbck-nm{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}",
4333
4816
  ".wbck-meta{margin-left:auto;flex:none;font-size:11.5px;color:var(--wb-muted)}",
4334
4817
  ".wbck-note{font-size:12px;color:var(--wb-muted);padding:8px 6px}",
@@ -4338,6 +4821,52 @@ var require_filter_checklist_styles = __commonJS({
4338
4821
  }
4339
4822
  });
4340
4823
 
4824
+ // packages/addons/lib/client-base-styles.cjs
4825
+ var require_client_base_styles = __commonJS({
4826
+ "packages/addons/lib/client-base-styles.cjs"(exports2, module2) {
4827
+ "use strict";
4828
+ var SECRET_FIELD = [
4829
+ ".wb-secret-field{position:relative;display:flex;align-items:center;min-width:0}",
4830
+ ".wb-secret-field input{flex:1 1 auto;min-width:0;padding-right:34px}",
4831
+ ".wb-eye{position:absolute;right:4px;display:inline-flex;align-items:center;justify-content:center;background:transparent;border:0;border-radius:6px;padding:4px;color:var(--wb-muted,#6b7280);cursor:pointer}",
4832
+ ".wb-eye:hover:not(:disabled){color:var(--wb-accent,#2563eb);background:color-mix(in srgb, var(--wb-accent,#2563eb) 12%, transparent)}",
4833
+ ".wb-eye:focus-visible{outline:2px solid var(--wb-accent,#2563eb);outline-offset:1px}",
4834
+ ".wb-eye:disabled{opacity:.45;cursor:not-allowed}"
4835
+ ];
4836
+ module2.exports = function baseStyles(prefix) {
4837
+ var p = String(prefix || "wb");
4838
+ var s = "." + p;
4839
+ return SECRET_FIELD.concat([
4840
+ s + "-wrap{display:flex;flex-direction:column;gap:12px;padding:16px;overflow:auto;height:100%;box-sizing:border-box}",
4841
+ s + "-head{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}",
4842
+ s + "-title{font-size:16px;font-weight:650;margin:0}",
4843
+ s + "-sub{font-size:12px;color:var(--wb-muted,#6b7280);margin:2px 0 0}",
4844
+ s + "-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}",
4845
+ s + "-card{border:1px solid var(--wb-border,#e5e7eb);border-radius:10px;background:var(--wb-surface,#fff);padding:12px}",
4846
+ s + "-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:10px}",
4847
+ s + "-kpi{font-size:22px;font-weight:700;line-height:1.2}" + s + "-kpi-label{font-size:12px;color:var(--wb-muted,#6b7280)}",
4848
+ s + "-table{width:100%;border-collapse:collapse;font-size:12px}" + s + "-table th," + s + "-table td{padding:7px 8px;border-bottom:1px solid var(--wb-border,#eef0f3);text-align:left;vertical-align:top}",
4849
+ s + "-table th{font-weight:600;color:var(--wb-muted,#6b7280);white-space:nowrap}",
4850
+ s + "-btn{border:1px solid var(--wb-border,#d1d5db);background:var(--wb-surface,#fff);color:inherit;border-radius:7px;padding:5px 10px;font-size:12px;cursor:pointer}",
4851
+ s + "-btn:hover:not(:disabled){border-color:var(--wb-accent,#2563eb)}" + s + "-btn:disabled{opacity:.5;cursor:default}",
4852
+ s + "-btn.primary{background:var(--wb-accent,#2563eb);border-color:var(--wb-accent,#2563eb);color:#fff}",
4853
+ s + "-btn.danger{color:#b91c1c;border-color:#fecaca}",
4854
+ s + "-field{display:flex;flex-direction:column;gap:4px;font-size:12px}" + s + "-label{font-weight:600}",
4855
+ s + "-field input," + s + "-field select," + s + "-field textarea{border:1px solid var(--wb-border,#d1d5db);border-radius:7px;padding:6px 8px;font:inherit;background:var(--wb-surface,#fff);color:inherit;min-width:0}",
4856
+ s + "-hint{color:var(--wb-muted,#6b7280);font-size:11px}" + s + "-notice{padding:8px 10px;border-radius:8px;font-size:12px;background:#eff6ff;color:#1e40af}",
4857
+ s + "-notice.error{background:#fef2f2;color:#b91c1c}" + s + "-notice.ok{background:#ecfdf5;color:#047857}",
4858
+ s + "-empty{padding:18px;text-align:center;color:var(--wb-muted,#6b7280);font-size:12px;border:1px dashed var(--wb-border,#e5e7eb);border-radius:8px}",
4859
+ s + "-pill{display:inline-block;padding:1px 7px;border-radius:999px;font-size:11px;background:#f3f4f6;color:#374151}",
4860
+ s + "-pill.ok{background:#ecfdf5;color:#047857}" + s + "-pill.error{background:#fef2f2;color:#b91c1c}" + s + "-pill.warn{background:#fffbeb;color:#b45309}",
4861
+ s + "-json{margin:0;padding:8px;background:#f8fafc;border-radius:8px;font-size:11px;max-height:240px;overflow:auto}",
4862
+ s + "-muted{color:var(--wb-muted,#6b7280)}" + s + "-link{color:var(--wb-accent,#2563eb);cursor:pointer;text-decoration:none}",
4863
+ s + "-form{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:10px}"
4864
+ ]);
4865
+ };
4866
+ module2.exports.secretFieldStyles = SECRET_FIELD;
4867
+ }
4868
+ });
4869
+
4341
4870
  // packages/addons/sites/client/ui/styles.cjs
4342
4871
  var require_styles = __commonJS({
4343
4872
  "packages/addons/sites/client/ui/styles.cjs"(exports2, module2) {
@@ -4494,7 +5023,69 @@ var require_styles = __commonJS({
4494
5023
  ".wbs-note{font-size:11px;color:var(--wbs-muted);line-height:1.6}",
4495
5024
  "@media(max-width:860px){.wbs-body{flex-direction:column}.wbs-tree{width:100%;max-height:220px}.wbs-table{min-width:760px}.wbs-root{min-height:0}}",
4496
5025
  "@media(max-width:600px){.wbs-head h2{font-size:18px}.wbs-linkrow{grid-template-columns:1fr 1fr}.wbs-modal{padding:14px}}"
4497
- ].concat(require_filter_checklist_styles()).join("\n");
5026
+ ].concat(require_filter_checklist_styles()).concat(require_client_base_styles().secretFieldStyles).concat([require_date_picker_styles()("wbs")]).join("\n");
5027
+ }
5028
+ });
5029
+
5030
+ // packages/addons/lib/secret-field.cjs
5031
+ var require_secret_field = __commonJS({
5032
+ "packages/addons/lib/secret-field.cjs"(exports2, module2) {
5033
+ "use strict";
5034
+ var Eye2 = (init_eye(), __toCommonJS(eye_exports)).default;
5035
+ var EyeOff2 = (init_eye_off(), __toCommonJS(eye_off_exports)).default;
5036
+ function SecretField(props) {
5037
+ var h2 = props.h;
5038
+ var show = Boolean(props.show);
5039
+ var label = show ? props.hideLabel || "\u9690\u85CF\u660E\u6587" : props.showLabel || "\u663E\u793A\u660E\u6587";
5040
+ var Ico = show ? EyeOff2 : Eye2;
5041
+ function toggle(e) {
5042
+ e.preventDefault();
5043
+ e.stopPropagation();
5044
+ var box = e.currentTarget && e.currentTarget.parentNode;
5045
+ if (props.onToggle) props.onToggle();
5046
+ var input = box && box.querySelector ? box.querySelector("input") : null;
5047
+ if (!input || !input.focus) return;
5048
+ input.focus();
5049
+ var end = String(input.value == null ? "" : input.value).length;
5050
+ if (input.setSelectionRange) {
5051
+ try {
5052
+ input.setSelectionRange(end, end);
5053
+ } catch (err) {
5054
+ }
5055
+ }
5056
+ }
5057
+ return h2(
5058
+ "div",
5059
+ { className: "wb-secret-field" + (props.className ? " " + props.className : "") },
5060
+ h2("input", {
5061
+ type: show ? "text" : "password",
5062
+ className: props.inputClassName || void 0,
5063
+ id: props.id || void 0,
5064
+ name: props.name || void 0,
5065
+ autoComplete: props.autoComplete || "new-password",
5066
+ autoFocus: props.autoFocus ? true : void 0,
5067
+ spellCheck: false,
5068
+ disabled: props.disabled ? true : void 0,
5069
+ "aria-label": props.ariaLabel || void 0,
5070
+ value: props.value == null ? "" : props.value,
5071
+ placeholder: props.placeholder || void 0,
5072
+ onChange: function(e) {
5073
+ if (props.onChange) props.onChange(e.target.value);
5074
+ },
5075
+ onKeyDown: props.onKeyDown || void 0
5076
+ }),
5077
+ h2("button", {
5078
+ type: "button",
5079
+ className: "wb-eye",
5080
+ title: label,
5081
+ "aria-label": label,
5082
+ "aria-pressed": show ? "true" : "false",
5083
+ tabIndex: props.disabled ? -1 : void 0,
5084
+ onClick: toggle
5085
+ }, h2(Ico, { size: 15, strokeWidth: 2, "aria-hidden": "true" }))
5086
+ );
5087
+ }
5088
+ module2.exports = SecretField;
4498
5089
  }
4499
5090
  });
4500
5091
 
@@ -4512,6 +5103,7 @@ var require_accounts_modal = __commonJS({
4512
5103
  var text = deps.text;
4513
5104
  var callApi = deps.callApi;
4514
5105
  var errText = deps.errText;
5106
+ var SecretField = require_secret_field();
4515
5107
  function AccountModal(props) {
4516
5108
  var api = props.api;
4517
5109
  var lang = props.lang || "zh";
@@ -4529,6 +5121,9 @@ var require_accounts_modal = __commonJS({
4529
5121
  var [pendingDelete, setPendingDelete] = useState("");
4530
5122
  var [shown, setShown] = useState({});
4531
5123
  var [binding, setBinding] = useState(null);
5124
+ var [vaultPassShow, setVaultPassShow] = useState(false);
5125
+ var [vaultPass2Show, setVaultPass2Show] = useState(false);
5126
+ var [draftPassShow, setDraftPassShow] = useState(false);
4532
5127
  function mapVault(st) {
4533
5128
  var r = st || {};
4534
5129
  var idle = Number(r.idleTimeoutSec) > 0 ? Math.round(Number(r.idleTimeoutSec) / 60) : 15;
@@ -4710,12 +5305,36 @@ var require_accounts_modal = __commonJS({
4710
5305
  h2(
4711
5306
  "div",
4712
5307
  { className: "wbs-vault-form" },
4713
- h2("input", { className: "wbs-input", type: "password", placeholder: text(lang, "passphrase"), value: pass, onChange: function(e) {
4714
- setPass(e.target.value);
4715
- } }),
4716
- h2("input", { className: "wbs-input", type: "password", placeholder: text(lang, "passphraseAgain"), value: pass2, onChange: function(e) {
4717
- setPass2(e.target.value);
4718
- } }),
5308
+ h2(SecretField, {
5309
+ h: h2,
5310
+ inputClassName: "wbs-input",
5311
+ autoComplete: "new-password",
5312
+ ariaLabel: text(lang, "passphrase"),
5313
+ placeholder: text(lang, "passphrase"),
5314
+ showLabel: text(lang, "showPlain"),
5315
+ hideLabel: text(lang, "hidePlain"),
5316
+ value: pass,
5317
+ show: vaultPassShow,
5318
+ onChange: setPass,
5319
+ onToggle: function() {
5320
+ setVaultPassShow(!vaultPassShow);
5321
+ }
5322
+ }),
5323
+ h2(SecretField, {
5324
+ h: h2,
5325
+ inputClassName: "wbs-input",
5326
+ autoComplete: "new-password",
5327
+ ariaLabel: text(lang, "passphraseAgain"),
5328
+ placeholder: text(lang, "passphraseAgain"),
5329
+ showLabel: text(lang, "showPlain"),
5330
+ hideLabel: text(lang, "hidePlain"),
5331
+ value: pass2,
5332
+ show: vaultPass2Show,
5333
+ onChange: setPass2,
5334
+ onToggle: function() {
5335
+ setVaultPass2Show(!vaultPass2Show);
5336
+ }
5337
+ }),
4719
5338
  h2("button", { className: "wbs-btn", disabled: busy, onClick: submitVault }, text(lang, "vaultSetup"))
4720
5339
  )
4721
5340
  );
@@ -4728,9 +5347,21 @@ var require_accounts_modal = __commonJS({
4728
5347
  h2(
4729
5348
  "div",
4730
5349
  { className: "wbs-vault-form" },
4731
- h2("input", { className: "wbs-input", type: "password", placeholder: text(lang, "passphrase"), value: pass, onChange: function(e) {
4732
- setPass(e.target.value);
4733
- } }),
5350
+ h2(SecretField, {
5351
+ h: h2,
5352
+ inputClassName: "wbs-input",
5353
+ autoComplete: "current-password",
5354
+ ariaLabel: text(lang, "passphrase"),
5355
+ placeholder: text(lang, "passphrase"),
5356
+ showLabel: text(lang, "showPlain"),
5357
+ hideLabel: text(lang, "hidePlain"),
5358
+ value: pass,
5359
+ show: vaultPassShow,
5360
+ onChange: setPass,
5361
+ onToggle: function() {
5362
+ setVaultPassShow(!vaultPassShow);
5363
+ }
5364
+ }),
4734
5365
  h2("button", { className: "wbs-btn", disabled: busy, onClick: submitVault }, text(lang, "vaultUnlock"))
4735
5366
  )
4736
5367
  );
@@ -4751,25 +5382,44 @@ var require_accounts_modal = __commonJS({
4751
5382
  }
4752
5383
  function renderDraft() {
4753
5384
  var d = draft;
5385
+ function setField(key, v) {
5386
+ setDraft(function(prev) {
5387
+ var next = Object.assign({}, prev);
5388
+ next[key] = v;
5389
+ return next;
5390
+ });
5391
+ }
4754
5392
  function field(key, label, type, ph) {
5393
+ var input = type === "password" ? h2(SecretField, {
5394
+ h: h2,
5395
+ inputClassName: "wbs-input",
5396
+ autoComplete: "new-password",
5397
+ ariaLabel: label,
5398
+ placeholder: ph || "",
5399
+ showLabel: text(lang, "showPlain"),
5400
+ hideLabel: text(lang, "hidePlain"),
5401
+ value: d[key] || "",
5402
+ show: draftPassShow,
5403
+ onChange: function(v) {
5404
+ setField(key, v);
5405
+ },
5406
+ onToggle: function() {
5407
+ setDraftPassShow(!draftPassShow);
5408
+ }
5409
+ }) : h2("input", {
5410
+ className: "wbs-input",
5411
+ type: type || "text",
5412
+ placeholder: ph || "",
5413
+ value: d[key] || "",
5414
+ onChange: function(e) {
5415
+ setField(key, e.target.value);
5416
+ }
5417
+ });
4755
5418
  return h2(
4756
5419
  React2.Fragment,
4757
5420
  null,
4758
5421
  h2("label", { className: "wbs-label" }, label),
4759
- h2("input", {
4760
- className: "wbs-input",
4761
- type: type || "text",
4762
- placeholder: ph || "",
4763
- value: d[key] || "",
4764
- onChange: function(e) {
4765
- var v = e.target.value;
4766
- setDraft(function(prev) {
4767
- var next = Object.assign({}, prev);
4768
- next[key] = v;
4769
- return next;
4770
- });
4771
- }
4772
- })
5422
+ input
4773
5423
  );
4774
5424
  }
4775
5425
  return h2(
@@ -4979,8 +5629,21 @@ var require_action_schema_style = __commonJS({
4979
5629
  "." + P + " select:focus-visible{outline:2px solid var(--dsw-alias-brand-primary,#4f6ef7);outline-offset:1px}",
4980
5630
  "." + P + "-list{display:flex;flex-direction:column;gap:8px}",
4981
5631
  "." + P + "-card{border:1px solid var(--wb-border,#e3e5e9);border-radius:10px;padding:10px 12px;background:var(--wb-surface,var(--dsw-alias-bg-layer-1,transparent));display:flex;flex-direction:column;gap:8px;min-width:0}",
4982
- "." + P + "-cardhead{display:flex;align-items:center;gap:8px;flex-wrap:wrap}",
4983
- "." + P + "-cardhead code{font-weight:640}",
5632
+ "." + P + "-cardhead{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:8px}",
5633
+ "." + P + "-cardmeta{display:flex;align-items:center;flex-wrap:wrap;gap:8px;min-width:0;min-height:24px}",
5634
+ "." + P + "-cardhead code{font-weight:640;overflow-wrap:anywhere;min-width:0}",
5635
+ "." + P + "-hintline{margin:0;color:var(--dsw-alias-label-tertiary,inherit);font-size:11.5px;line-height:1.5}",
5636
+ "." + 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}",
5637
+ "." + 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)}",
5638
+ "." + P + "-track::before{content:'';width:12px;height:12px;border-radius:50%;background:currentColor;transition:transform .15s ease}",
5639
+ "." + P + "-toggle[aria-checked=true] ." + P + "-track{background:var(--wb-accent);border-color:var(--wb-accent);color:var(--wb-card)}",
5640
+ "." + P + "-toggle[aria-checked=true] ." + P + "-track::before{transform:translateX(12px)}",
5641
+ "." + P + "-toggle:hover:not(:disabled) ." + P + "-track{outline:1px solid var(--wb-accent)}",
5642
+ "." + P + "-toggle:focus-visible{outline:2px solid var(--wb-accent);outline-offset:2px}",
5643
+ "." + P + "-toggle:disabled{opacity:.6;cursor:progress}",
5644
+ "@media(prefers-reduced-motion:reduce){." + P + "-track::before{transition:none}}",
5645
+ // 安全约束(不可放开):用警示色描边,和可切换的开关区分开。
5646
+ "." + P + "-locked{border-color:var(--wb-warn,#b7791f);color:var(--wb-warn,#b7791f)}",
4984
5647
  "." + P + "-desc{margin:0;color:var(--dsw-alias-label-secondary,inherit);line-height:1.55;font-size:12.5px}",
4985
5648
  // 搜索命中:用品牌色透明度叠加而不是写死浅色,深浅主题都可读;继承文字颜色、不覆盖 ::selection。
4986
5649
  "." + P + " mark." + P + "-hit{background:color-mix(in oklab,var(--dsw-alias-brand-primary,#4f6ef7) 22%,transparent);color:inherit;border-radius:2px;padding:0;font:inherit;box-decoration-break:clone;-webkit-box-decoration-break:clone}",
@@ -5032,6 +5695,15 @@ var require_action_schema_view = __commonJS({
5032
5695
  zh: {
5033
5696
  title: "Action",
5034
5697
  hint: "\u8FD0\u884C\u65F6\u6CE8\u518C \xB7 \u53EA\u8BFB",
5698
+ switchHint: "agent \u5F00\u5173\u843D\u672C\u673A\u3001\u5373\u6539\u5373\u751F\u6548\uFF1B\u754C\u9762\u64CD\u4F5C\u4E0D\u53D7\u5F71\u54CD\u3002",
5699
+ 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",
5700
+ agentSwitch: "agent \u53EF\u7528",
5701
+ agentLocked: "\u4EC5\u754C\u9762 \xB7 \u5B89\u5168\u7EA6\u675F",
5702
+ agentLockedHint: "\u8BE5 action \u53EA\u80FD\u5728\u754C\u9762\u6267\u884C\uFF08\u5B89\u5168\u7EA6\u675F\uFF09\uFF0Cagent \u5F00\u5173\u4E0D\u53EF\u653E\u5F00",
5703
+ agentSaving: "\u4FDD\u5B58\u4E2D\u2026",
5704
+ agentOnToast: "\u5DF2\u5141\u8BB8 agent \u8C03\u7528",
5705
+ agentOffToast: "\u5DF2\u7981\u6B62 agent \u8C03\u7528",
5706
+ agentFail: "\u5207\u6362 agent \u5F00\u5173\u5931\u8D25",
5035
5707
  domain: "\u57DF",
5036
5708
  versionLabel: "\u7248\u672C",
5037
5709
  shell: "\u5BBF\u4E3B",
@@ -5077,6 +5749,15 @@ var require_action_schema_view = __commonJS({
5077
5749
  en: {
5078
5750
  title: "Actions",
5079
5751
  hint: "runtime registry \xB7 read-only",
5752
+ switchHint: "The agent switch is stored locally and applies immediately; UI actions are unaffected.",
5753
+ hostHint: "Agent switch for host actions; items marked UI-only (security) cannot be opened up.",
5754
+ agentSwitch: "Agent callable",
5755
+ agentLocked: "UI only \xB7 security",
5756
+ agentLockedHint: "This action can only run from the UI (security constraint); the agent switch cannot be opened",
5757
+ agentSaving: "Saving\u2026",
5758
+ agentOnToast: "Agent calls allowed",
5759
+ agentOffToast: "Agent calls blocked",
5760
+ agentFail: "Failed to change the agent switch",
5080
5761
  domain: "Domain",
5081
5762
  versionLabel: "Version",
5082
5763
  shell: "Host",
@@ -5189,7 +5870,9 @@ var require_action_schema_view = __commonJS({
5189
5870
  }
5190
5871
  module2.exports = function createActionSchemaView(options) {
5191
5872
  var raw = String(options.domain || "");
5192
- var DOMAIN = raw.indexOf("wb-addon-") === 0 ? raw : "wb-addon-" + raw;
5873
+ var SOURCE = options.source === "actions.list" ? "actions.list" : "actionSchema";
5874
+ var DOMAIN = SOURCE === "actions.list" ? raw : raw.indexOf("wb-addon-") === 0 ? raw : "wb-addon-" + raw;
5875
+ var LIST_DOMAIN = options.listDomain ? String(options.listDomain) : DOMAIN;
5193
5876
  var prefix = options.prefix;
5194
5877
  var P = prefix + "-as";
5195
5878
  var Icon2 = options.Icon || null;
@@ -5233,6 +5916,8 @@ var require_action_schema_view = __commonJS({
5233
5916
  var typePick = typeState[0], setTypePick = typeState[1];
5234
5917
  var toastState = React2.useState("");
5235
5918
  var toast = toastState[0], setToast = toastState[1];
5919
+ var savingState = React2.useState("");
5920
+ var saving = savingState[0], setSaving = savingState[1];
5236
5921
  React2.useEffect(function() {
5237
5922
  injectCss();
5238
5923
  }, []);
@@ -5241,9 +5926,10 @@ var require_action_schema_view = __commonJS({
5241
5926
  setLoading(true);
5242
5927
  setErr("");
5243
5928
  var pending;
5244
- var actionName = DOMAIN.replace(/^wb-addon-/, "") + ".actionSchema";
5929
+ var actionName = SOURCE === "actions.list" ? "actions.list" : DOMAIN.replace(/^wb-addon-/, "") + ".actionSchema";
5930
+ var callArgs = SOURCE === "actions.list" ? { detail: true, domain: LIST_DOMAIN } : void 0;
5245
5931
  if (api && typeof api.call === "function") {
5246
- pending = Promise.resolve(api.call(actionName)).then(function(r) {
5932
+ pending = Promise.resolve(api.call(actionName, callArgs)).then(function(r) {
5247
5933
  if (r && r.ok === false) return r;
5248
5934
  return r && r.result || r;
5249
5935
  });
@@ -5283,6 +5969,39 @@ var require_action_schema_view = __commonJS({
5283
5969
  plainCopy(text);
5284
5970
  done();
5285
5971
  }
5972
+ function setAgent(action, next) {
5973
+ var name = action.name;
5974
+ setSaving(name);
5975
+ setToast("");
5976
+ var fail = function(e) {
5977
+ setSaving("");
5978
+ setToast(t.agentFail + "\uFF1A" + String(e && e.message || e || ""));
5979
+ };
5980
+ var done = function(r) {
5981
+ setSaving("");
5982
+ var payload = r && typeof r === "object" && Object.prototype.hasOwnProperty.call(r, "result") ? r.result : r;
5983
+ if (r && r.ok === false) {
5984
+ setToast(t.agentFail + "\uFF1A" + String(r.error || r.text || ""));
5985
+ return;
5986
+ }
5987
+ var value = payload && typeof payload.agentEnabled === "boolean" ? payload.agentEnabled : next;
5988
+ setSnap(function(prev) {
5989
+ if (!prev || !Array.isArray(prev.actions)) return prev;
5990
+ return Object.assign({}, prev, {
5991
+ actions: prev.actions.map(function(a) {
5992
+ if (!a || a.name !== name) return a;
5993
+ return Object.assign({}, a, { agentEnabled: value });
5994
+ })
5995
+ });
5996
+ });
5997
+ setToast(value ? t.agentOnToast : t.agentOffToast);
5998
+ };
5999
+ if (!api || typeof api.call !== "function") {
6000
+ fail(new Error("no call api"));
6001
+ return;
6002
+ }
6003
+ Promise.resolve(api.call("actions.setAgentAccess", { action: name, agentEnabled: next })).then(done, fail);
6004
+ }
5286
6005
  var all = snap && Array.isArray(snap.actions) ? snap.actions.filter(function(a) {
5287
6006
  return a && a.domain === DOMAIN;
5288
6007
  }) : [];
@@ -5331,6 +6050,35 @@ var require_action_schema_view = __commonJS({
5331
6050
  h2("td", null, Highlight.hit(row.description, kw))
5332
6051
  );
5333
6052
  }
6053
+ function agentSwitch(action) {
6054
+ if (action.agentLocked === true) {
6055
+ return h2("span", {
6056
+ className: P + "-badge " + P + "-locked",
6057
+ title: t.agentLockedHint,
6058
+ "data-agent-locked": action.name
6059
+ }, t.agentLocked);
6060
+ }
6061
+ if (typeof action.agentEnabled !== "boolean") return null;
6062
+ var busy = saving === action.name;
6063
+ return h2(
6064
+ "button",
6065
+ {
6066
+ className: P + "-toggle",
6067
+ "data-agent-row": action.name,
6068
+ type: "button",
6069
+ role: "switch",
6070
+ "aria-checked": action.agentEnabled,
6071
+ disabled: busy,
6072
+ "data-agent-toggle": action.name,
6073
+ "aria-label": t.agentSwitch + " \xB7 " + action.name,
6074
+ onClick: function() {
6075
+ setAgent(action, !action.agentEnabled);
6076
+ }
6077
+ },
6078
+ h2("span", { className: P + "-track", "aria-hidden": true }),
6079
+ h2("span", null, busy ? t.agentSaving : t.agentSwitch)
6080
+ );
6081
+ }
5334
6082
  function card(action) {
5335
6083
  var rows = paramRows(action);
5336
6084
  var examples = Array.isArray(action.examples) ? action.examples : [];
@@ -5340,12 +6088,16 @@ var require_action_schema_view = __commonJS({
5340
6088
  h2(
5341
6089
  "div",
5342
6090
  { className: P + "-cardhead" },
5343
- h2("code", { className: P + "-mono" }, Highlight.hit(action.name, kw)),
5344
- // 域名在页头已展示一次,卡片内不再重复(所有条目必然同域,见 visible 过滤)。
5345
- h2("span", { className: P + "-badge" }, rows.length ? t.paramCount(rows.length) : t.noParams),
5346
- rows.some(function(row) {
5347
- return row.required;
5348
- }) ? h2("span", { className: P + "-badge " + P + "-req" }, t.required) : null
6091
+ h2(
6092
+ "div",
6093
+ { className: P + "-cardmeta" },
6094
+ h2("code", { className: P + "-mono" }, Highlight.hit(action.name, kw)),
6095
+ h2("span", { className: P + "-badge" }, rows.length ? t.paramCount(rows.length) : t.noParams),
6096
+ rows.some(function(row) {
6097
+ return row.required;
6098
+ }) ? h2("span", { className: P + "-badge " + P + "-req" }, t.required) : null
6099
+ ),
6100
+ agentSwitch(action)
5349
6101
  ),
5350
6102
  action.description ? h2("p", { className: P + "-desc" }, Highlight.hit(action.description, kw)) : null,
5351
6103
  rows.length ? h2(
@@ -5422,6 +6174,7 @@ var require_action_schema_view = __commonJS({
5422
6174
  h2("span", { className: P + "-badge" }, t.count(visible.length, all.length)),
5423
6175
  h2("span", { className: P + "-none" }, t.hint)
5424
6176
  ),
6177
+ h2("p", { className: P + "-hintline" }, SOURCE === "actions.list" ? t.hostHint : t.switchHint),
5425
6178
  snap ? h2(
5426
6179
  "div",
5427
6180
  { className: P + "-toolbar" },
@@ -6720,7 +7473,7 @@ var TagFilter = require_tagfilter();
6720
7473
  injectCss();
6721
7474
  host.registerAddon({
6722
7475
  id: "wb-addon-sites",
6723
- version: "1.12.1",
7476
+ version: "1.12.4",
6724
7477
  icon: (init_globe(), __toCommonJS(globe_exports)).default,
6725
7478
  views: [
6726
7479
  { id: "stats", icon: tabIcon("chart"), title: { zh: "\u7EDF\u8BA1", en: "Stats" }, component: statsView.SitesStatsView },
package/lib/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * 站点业务插件(DSH 原生插件)。
3
3
  * 业务全部本地;云端只备份数据。标签能力通过 host.hasDomain 探测。
4
+ * 1.12.3:统计页自定义日期范围改用共享 DatePicker(lib/date-picker.cjs),删除插件内复制的区间控件。
5
+ * 1.12.2:账号弹窗的口令/确认口令改用共享明文切换控件(lib/secret-field.cjs),与保险箱同一套小眼睛。
4
6
  * 1.12.1:站点标签筛选列表体改用共享 filter-checklist。
5
7
  */
6
8
 
@@ -98,7 +100,7 @@ export function apply(ctx) {
98
100
  id: "wb-addon-sites",
99
101
  title: "站点",
100
102
  description: "站点收藏:目录树、链接与标签(标签需安装标签插件);含统计/记录/配置/数据四个视图",
101
- version: "1.12.1",
103
+ version: "1.12.4",
102
104
  tables: ["site", "site_node", "site_node_mapping", "tag_mapping", "site_account", "site_account_external"],
103
105
  sync: siteSync,
104
106
  views: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-workbench-sites",
3
- "version": "1.12.1",
3
+ "version": "1.12.4",
4
4
  "type": "module",
5
5
  "description": "个人工作台站点插件:目录树、链接与标签",
6
6
  "main": "lib/index.js",
@@ -9,8 +9,8 @@
9
9
  "id": "wb-addon-sites",
10
10
  "title": "站点",
11
11
  "description": "站点 + 统计/记录/配置/数据四个视图:目录树、链接与标签,附表数据浏览",
12
- "version": "1.12.1",
13
- "minShell": "0.5.0",
12
+ "version": "1.12.4",
13
+ "minShell": "0.8.0",
14
14
  "tables": [
15
15
  "site",
16
16
  "site_node",
@@ -60,7 +60,7 @@
60
60
  "./package.json": "./package.json"
61
61
  },
62
62
  "dependencies": {
63
- "dsh-workbench-host": "^0.7.0"
63
+ "dsh-workbench-host": "^0.8.0"
64
64
  },
65
65
  "dsh": {
66
66
  "bundle": {