@iquji-web/web-component 0.1.11 → 0.1.12

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.
@@ -32,11 +32,13 @@ export type IqujiDiagnosticPanelProps = {
32
32
  logsError?: ReactNode | undefined;
33
33
  /** 刷新日志回调 */
34
34
  onRefreshLogs?: (() => void) | undefined;
35
- /** 最大高度,默认 360px */
35
+ /** 最大高度,默认 380px */
36
36
  maxHeight?: number | string | undefined;
37
+ /** 是否隐藏顶部元信息(当在已具备头部的 Dialog 内部展示时) */
38
+ hideMeta?: boolean | undefined;
37
39
  className?: string | undefined;
38
40
  };
39
- export declare function IqujiDiagnosticPanel({ action, className, errorCode, errorMessage, errorTitle, logs, logsError, logsLoading, maxHeight, onRefreshLogs, status, taskId, }: IqujiDiagnosticPanelProps): import("react/jsx-runtime").JSX.Element;
41
+ export declare function IqujiDiagnosticPanel({ action, className, errorCode, errorMessage, errorTitle, hideMeta, logs, logsError, logsLoading, maxHeight, onRefreshLogs, status, taskId, }: IqujiDiagnosticPanelProps): import("react/jsx-runtime").JSX.Element;
40
42
  export type IqujiDiagnosticDialogProps = Omit<IqujiDialogProps, "actions" | "children"> & {
41
43
  action?: string | undefined;
42
44
  taskId?: string | undefined;
package/dist/index.js CHANGED
@@ -5160,7 +5160,7 @@ function IqujiLogViewer({
5160
5160
  // src/diagnostic.tsx
5161
5161
  import { useMemo as useMemo10, useState as useState18 } from "react";
5162
5162
  import { IqujiIcon as IqujiIcon17 } from "@iquji-web/web-icons";
5163
- import { jsx as jsx37, jsxs as jsxs33, Fragment as Fragment9 } from "react/jsx-runtime";
5163
+ import { jsx as jsx37, jsxs as jsxs33 } from "react/jsx-runtime";
5164
5164
  function IqujiDiagnosticBanner({
5165
5165
  action,
5166
5166
  className,
@@ -5194,7 +5194,7 @@ function IqujiDiagnosticBanner({
5194
5194
  children: /* @__PURE__ */ jsx37(IqujiIcon17, {
5195
5195
  decorative: true,
5196
5196
  name: iconName,
5197
- size: 16
5197
+ size: 15
5198
5198
  })
5199
5199
  }),
5200
5200
  /* @__PURE__ */ jsx37("h4", {
@@ -5222,7 +5222,7 @@ function IqujiDiagnosticBanner({
5222
5222
  }) : null
5223
5223
  ]
5224
5224
  }),
5225
- description ? /* @__PURE__ */ jsx37("p", {
5225
+ description ? /* @__PURE__ */ jsx37("div", {
5226
5226
  className: "iquji-diagnostic-banner__desc",
5227
5227
  children: description
5228
5228
  }) : null,
@@ -5239,10 +5239,11 @@ function IqujiDiagnosticPanel({
5239
5239
  errorCode,
5240
5240
  errorMessage,
5241
5241
  errorTitle = "操作未完成",
5242
+ hideMeta = false,
5242
5243
  logs = [],
5243
5244
  logsError,
5244
5245
  logsLoading = false,
5245
- maxHeight = 360,
5246
+ maxHeight = 380,
5246
5247
  onRefreshLogs,
5247
5248
  status,
5248
5249
  taskId
@@ -5259,7 +5260,7 @@ function IqujiDiagnosticPanel({
5259
5260
  return /* @__PURE__ */ jsxs33("div", {
5260
5261
  className: classNames("iquji-diagnostic-dialog-body", className),
5261
5262
  children: [
5262
- action || taskId || status ? /* @__PURE__ */ jsxs33("div", {
5263
+ !hideMeta && (action || taskId || status) ? /* @__PURE__ */ jsxs33("div", {
5263
5264
  className: "iquji-diagnostic-meta",
5264
5265
  children: [
5265
5266
  action ? /* @__PURE__ */ jsx37("span", {
@@ -5290,7 +5291,7 @@ function IqujiDiagnosticPanel({
5290
5291
  }) : null,
5291
5292
  status ? /* @__PURE__ */ jsx37(IqujiBadge, {
5292
5293
  tone: statusTone,
5293
- children: status === "failed" ? "失败" : status === "running" ? "执行中" : status === "queued" ? "队列中" : status === "succeeded" ? "成功" : status
5294
+ children: status === "failed" || status === "error" ? "失败" : status === "running" ? "执行中" : status === "queued" ? "队列中" : status === "succeeded" || status === "success" ? "成功" : status
5294
5295
  }) : null
5295
5296
  ]
5296
5297
  }) : null,
@@ -5359,6 +5360,7 @@ function IqujiDiagnosticDialog({
5359
5360
  ...dialogProps
5360
5361
  }) {
5361
5362
  const [copiedDiagnostic, setCopiedDiagnostic] = useState18(false);
5363
+ const [copiedTaskId, setCopiedTaskId] = useState18(false);
5362
5364
  const fullDiagnosticReport = useMemo10(() => {
5363
5365
  if (diagnosticText)
5364
5366
  return diagnosticText;
@@ -5382,7 +5384,13 @@ function IqujiDiagnosticDialog({
5382
5384
  if (typeof log === "string") {
5383
5385
  lines.push(log);
5384
5386
  } else {
5385
- lines.push([log.timestamp, log.level?.toUpperCase(), log.source, log.phase, log.message].filter(Boolean).join(" "));
5387
+ lines.push([
5388
+ log.timestamp,
5389
+ log.level?.toUpperCase(),
5390
+ log.source,
5391
+ log.phase,
5392
+ log.message
5393
+ ].filter(Boolean).join(" "));
5386
5394
  }
5387
5395
  }
5388
5396
  lines.push("```");
@@ -5397,30 +5405,128 @@ function IqujiDiagnosticDialog({
5397
5405
  setTimeout(() => setCopiedDiagnostic(false), 2500);
5398
5406
  } catch {}
5399
5407
  };
5408
+ const handleCopyTaskId = async (id) => {
5409
+ try {
5410
+ await navigator.clipboard.writeText(id);
5411
+ setCopiedTaskId(true);
5412
+ setTimeout(() => setCopiedTaskId(false), 2000);
5413
+ } catch {}
5414
+ };
5415
+ const statusTone = status === "failed" || status === "error" ? "danger" : status === "running" || status === "queued" ? "info" : status === "succeeded" || status === "success" ? "success" : "neutral";
5416
+ const statusText = status === "failed" || status === "error" ? "操作失败" : status === "running" ? "执行中" : status === "queued" ? "排队中" : status === "succeeded" || status === "success" ? "执行成功" : status;
5417
+ const headingNode = /* @__PURE__ */ jsxs33("div", {
5418
+ className: "iquji-diagnostic-dialog-header",
5419
+ children: [
5420
+ /* @__PURE__ */ jsxs33("div", {
5421
+ className: "iquji-diagnostic-dialog-header__lead",
5422
+ children: [
5423
+ /* @__PURE__ */ jsx37("span", {
5424
+ className: "iquji-diagnostic-dialog-header__title",
5425
+ children: title
5426
+ }),
5427
+ status ? /* @__PURE__ */ jsxs33("span", {
5428
+ className: "iquji-diagnostic-dialog-header__badge",
5429
+ "data-tone": statusTone,
5430
+ children: [
5431
+ /* @__PURE__ */ jsx37("span", {
5432
+ className: "iquji-diagnostic-dialog-header__badge-dot"
5433
+ }),
5434
+ /* @__PURE__ */ jsx37("span", {
5435
+ children: statusText
5436
+ })
5437
+ ]
5438
+ }) : null
5439
+ ]
5440
+ }),
5441
+ action || taskId ? /* @__PURE__ */ jsxs33("div", {
5442
+ className: "iquji-diagnostic-dialog-header__meta",
5443
+ children: [
5444
+ action ? /* @__PURE__ */ jsx37("span", {
5445
+ className: "iquji-diagnostic-dialog-header__action",
5446
+ children: action
5447
+ }) : null,
5448
+ action && taskId ? /* @__PURE__ */ jsx37("span", {
5449
+ className: "iquji-diagnostic-dialog-header__sep",
5450
+ children: "·"
5451
+ }) : null,
5452
+ taskId ? /* @__PURE__ */ jsxs33("span", {
5453
+ className: "iquji-diagnostic-dialog-header__task",
5454
+ children: [
5455
+ /* @__PURE__ */ jsx37("code", {
5456
+ children: taskId
5457
+ }),
5458
+ /* @__PURE__ */ jsx37("button", {
5459
+ "aria-label": `复制任务 ID: ${taskId}`,
5460
+ className: "iquji-diagnostic-dialog-header__copy-btn",
5461
+ onClick: () => void handleCopyTaskId(taskId),
5462
+ title: "复制任务 ID",
5463
+ type: "button",
5464
+ children: /* @__PURE__ */ jsx37(IqujiIcon17, {
5465
+ decorative: true,
5466
+ name: copiedTaskId ? "check" : "copy",
5467
+ size: 11
5468
+ })
5469
+ })
5470
+ ]
5471
+ }) : null
5472
+ ]
5473
+ }) : null
5474
+ ]
5475
+ });
5400
5476
  return /* @__PURE__ */ jsx37(IqujiDialog, {
5401
5477
  ...dialogProps,
5402
- actions: /* @__PURE__ */ jsxs33(Fragment9, {
5478
+ actions: /* @__PURE__ */ jsxs33("div", {
5479
+ className: "iquji-diagnostic-dialog__footer",
5403
5480
  children: [
5404
- onRefreshLogs ? /* @__PURE__ */ jsx37(IqujiButton, {
5405
- loading: logsLoading,
5406
- onClick: onRefreshLogs,
5407
- variant: "secondary",
5408
- children: "刷新日志"
5409
- }) : null,
5410
- /* @__PURE__ */ jsx37(IqujiButton, {
5411
- onClick: () => void handleCopyDiagnostic(),
5412
- variant: "primary",
5413
- children: copiedDiagnostic ? "✓ 诊断信息已复制" : "复制诊断信息"
5481
+ /* @__PURE__ */ jsx37("div", {
5482
+ className: "iquji-diagnostic-dialog__footer-hint",
5483
+ children: logs.length > 0 ? /* @__PURE__ */ jsxs33("span", {
5484
+ className: "iquji-diagnostic-dialog__footer-count",
5485
+ children: [
5486
+ "已记录 ",
5487
+ logs.length,
5488
+ " 条日志"
5489
+ ]
5490
+ }) : null
5414
5491
  }),
5415
- /* @__PURE__ */ jsx37(IqujiButton, {
5416
- onClick: () => onOpenChange?.(false),
5417
- variant: "ghost",
5418
- children: "关闭"
5492
+ /* @__PURE__ */ jsxs33("div", {
5493
+ className: "iquji-diagnostic-dialog__footer-actions",
5494
+ children: [
5495
+ onRefreshLogs ? /* @__PURE__ */ jsx37(IqujiButton, {
5496
+ className: "iquji-diagnostic-dialog__refresh-btn",
5497
+ disabled: logsLoading,
5498
+ iconStart: /* @__PURE__ */ jsx37(IqujiIcon17, {
5499
+ decorative: true,
5500
+ name: "rotate-ccw",
5501
+ size: 13
5502
+ }),
5503
+ loading: logsLoading,
5504
+ onClick: onRefreshLogs,
5505
+ variant: "secondary",
5506
+ children: "刷新日志"
5507
+ }) : null,
5508
+ /* @__PURE__ */ jsx37(IqujiButton, {
5509
+ className: "iquji-diagnostic-dialog__copy-btn",
5510
+ iconStart: /* @__PURE__ */ jsx37(IqujiIcon17, {
5511
+ decorative: true,
5512
+ name: copiedDiagnostic ? "check" : "copy",
5513
+ size: 13
5514
+ }),
5515
+ onClick: () => void handleCopyDiagnostic(),
5516
+ variant: "secondary",
5517
+ children: copiedDiagnostic ? "已复制诊断信息" : "复制诊断信息"
5518
+ }),
5519
+ /* @__PURE__ */ jsx37(IqujiButton, {
5520
+ onClick: () => onOpenChange?.(false),
5521
+ variant: "ghost",
5522
+ children: "关闭"
5523
+ })
5524
+ ]
5419
5525
  })
5420
5526
  ]
5421
5527
  }),
5422
5528
  closeLabel,
5423
- description: action && taskId ? `${action} · ${taskId}` : dialogProps.description,
5529
+ heading: headingNode,
5424
5530
  onOpenChange,
5425
5531
  open,
5426
5532
  size: size2,
@@ -5430,6 +5536,7 @@ function IqujiDiagnosticDialog({
5430
5536
  errorCode,
5431
5537
  errorMessage,
5432
5538
  errorTitle,
5539
+ hideMeta: true,
5433
5540
  logs,
5434
5541
  logsError,
5435
5542
  logsLoading,
@@ -5441,9 +5548,9 @@ function IqujiDiagnosticDialog({
5441
5548
  }
5442
5549
 
5443
5550
  // src/index.tsx
5444
- import { jsx as jsx38, jsxs as jsxs34, Fragment as Fragment10 } from "react/jsx-runtime";
5551
+ import { jsx as jsx38, jsxs as jsxs34, Fragment as Fragment9 } from "react/jsx-runtime";
5445
5552
  var renderNavigationItem = (item) => {
5446
- const content = /* @__PURE__ */ jsxs34(Fragment10, {
5553
+ const content = /* @__PURE__ */ jsxs34(Fragment9, {
5447
5554
  children: [
5448
5555
  item.icon,
5449
5556
  /* @__PURE__ */ jsx38("span", {
package/dist/styles.css CHANGED
@@ -4839,30 +4839,34 @@
4839
4839
  .iquji-diagnostic-banner {
4840
4840
  background: var(--iquji-color-critical-fill);
4841
4841
  border: 1px solid var(--iquji-color-critical-border);
4842
+ border-left: 3.5px solid var(--iquji-color-critical-text);
4842
4843
  border-radius: var(--iquji-radius-panel);
4843
4844
  color: var(--iquji-color-critical-text);
4844
4845
  display: flex;
4845
- gap: var(--iquji-space-2);
4846
4846
  position: relative;
4847
4847
  flex-direction: column;
4848
- padding: 12px 16px;
4848
+ gap: 6px;
4849
+ padding: 10px 14px;
4849
4850
  }
4850
4851
 
4851
4852
  .iquji-diagnostic-banner[data-tone="warning"] {
4852
4853
  background: var(--iquji-color-warning-fill);
4853
4854
  border-color: var(--iquji-color-warning-border);
4855
+ border-left-color: var(--iquji-color-warning-text);
4854
4856
  color: var(--iquji-color-warning-text);
4855
4857
  }
4856
4858
 
4857
4859
  .iquji-diagnostic-banner[data-tone="info"] {
4858
4860
  background: var(--iquji-color-info-fill);
4859
4861
  border-color: var(--iquji-color-info-border);
4862
+ border-left-color: var(--iquji-color-info-text);
4860
4863
  color: var(--iquji-color-info-text);
4861
4864
  }
4862
4865
 
4863
4866
  .iquji-diagnostic-banner[data-tone="success"] {
4864
4867
  background: var(--iquji-color-positive-fill);
4865
4868
  border-color: var(--iquji-color-positive-border);
4869
+ border-left-color: var(--iquji-color-positive-text);
4866
4870
  color: var(--iquji-color-positive-text);
4867
4871
  }
4868
4872
 
@@ -4882,39 +4886,59 @@
4882
4886
  .iquji-diagnostic-banner__icon {
4883
4887
  display: inline-flex;
4884
4888
  flex-shrink: 0;
4889
+ justify-content: center;
4885
4890
  align-items: center;
4886
4891
  }
4887
4892
 
4888
4893
  .iquji-diagnostic-banner__title {
4889
- font-size: var(--iquji-font-size-body-md);
4890
- font-weight: 600;
4891
- line-height: var(--iquji-line-height-body-md, 20px);
4894
+ font-size: var(--iquji-font-size-body-sm);
4892
4895
  margin: 0;
4896
+ font-weight: 600;
4897
+ line-height: 1.4;
4893
4898
  }
4894
4899
 
4895
4900
  .iquji-diagnostic-banner__code {
4901
+ appearance: none;
4902
+ background: var(--iquji-color-surface, #fff);
4903
+ border: 1px solid var(--iquji-color-critical-border);
4896
4904
  border-radius: var(--iquji-radius-control);
4905
+ color: var(--iquji-color-critical-text);
4897
4906
  cursor: pointer;
4898
4907
  display: inline-flex;
4899
4908
  font-family: var(--iquji-font-mono);
4900
- font-size: var(--iquji-font-size-caption);
4909
+ outline: none;
4901
4910
  user-select: all;
4902
- background: #0000000f;
4903
- gap: 4px;
4904
- padding: 2px 6px;
4905
- transition: background .15s;
4911
+ -webkit-appearance: none;
4912
+ align-items: center;
4913
+ gap: 5px;
4914
+ padding: 2px 7px;
4915
+ transition: all .15s;
4916
+ font-size: 11px;
4906
4917
  font-weight: 500;
4918
+ line-height: 1.4;
4907
4919
  }
4908
4920
 
4909
4921
  .iquji-diagnostic-banner__code:hover {
4910
- background: #0000001f;
4922
+ background: color-mix(in srgb, var(--iquji-color-critical-fill) 40%, #fff);
4923
+ border-color: var(--iquji-color-critical-text);
4924
+ }
4925
+
4926
+ .iquji-diagnostic-banner[data-tone="warning"] .iquji-diagnostic-banner__code {
4927
+ border-color: var(--iquji-color-warning-border);
4928
+ color: var(--iquji-color-warning-text);
4929
+ }
4930
+
4931
+ .iquji-diagnostic-banner[data-tone="info"] .iquji-diagnostic-banner__code {
4932
+ border-color: var(--iquji-color-info-border);
4933
+ color: var(--iquji-color-info-text);
4911
4934
  }
4912
4935
 
4913
4936
  .iquji-diagnostic-banner__desc {
4937
+ color: var(--iquji-color-text, #1e293b);
4914
4938
  font-size: var(--iquji-font-size-body-sm);
4915
- opacity: .95;
4939
+ opacity: .92;
4916
4940
  margin: 0;
4917
- line-height: 1.5;
4941
+ line-height: 1.55;
4918
4942
  }
4919
4943
 
4920
4944
  .iquji-diagnostic-meta {
@@ -4938,9 +4962,11 @@
4938
4962
  }
4939
4963
 
4940
4964
  .iquji-diagnostic-meta__btn {
4965
+ appearance: none;
4941
4966
  color: inherit;
4942
4967
  cursor: pointer;
4943
4968
  display: inline-flex;
4969
+ outline: none;
4944
4970
  background: none;
4945
4971
  border: none;
4946
4972
  padding: 0;
@@ -4953,11 +4979,135 @@
4953
4979
 
4954
4980
  .iquji-diagnostic-dialog-body {
4955
4981
  display: flex;
4956
- gap: var(--iquji-space-3);
4957
4982
  flex-direction: column;
4983
+ gap: 12px;
4984
+ width: 100%;
4985
+ }
4986
+
4987
+ .iquji-diagnostic-dialog-header {
4988
+ display: flex;
4989
+ flex-direction: column;
4990
+ gap: 4px;
4991
+ width: 100%;
4992
+ }
4993
+
4994
+ .iquji-diagnostic-dialog-header__lead {
4995
+ display: flex;
4996
+ flex-wrap: wrap;
4997
+ align-items: center;
4998
+ gap: 8px;
4999
+ }
5000
+
5001
+ .iquji-diagnostic-dialog-header__title {
5002
+ color: var(--iquji-color-text);
5003
+ font-size: var(--iquji-font-size-title-sm);
5004
+ font-weight: 600;
5005
+ line-height: 1.3;
5006
+ }
5007
+
5008
+ .iquji-diagnostic-dialog-header__badge {
5009
+ background: var(--iquji-color-neutral-fill);
5010
+ color: var(--iquji-color-neutral-text);
5011
+ display: inline-flex;
5012
+ border-radius: 999px;
5013
+ align-items: center;
5014
+ gap: 5px;
5015
+ padding: 3px 8px;
5016
+ font-size: 11px;
5017
+ font-weight: 500;
5018
+ line-height: 1;
5019
+ }
5020
+
5021
+ .iquji-diagnostic-dialog-header__badge[data-tone="danger"] {
5022
+ background: var(--iquji-color-critical-fill);
5023
+ color: var(--iquji-color-critical-text);
5024
+ }
5025
+
5026
+ .iquji-diagnostic-dialog-header__badge[data-tone="info"] {
5027
+ background: var(--iquji-color-info-fill);
5028
+ color: var(--iquji-color-info-text);
5029
+ }
5030
+
5031
+ .iquji-diagnostic-dialog-header__badge[data-tone="success"] {
5032
+ background: var(--iquji-color-positive-fill);
5033
+ color: var(--iquji-color-positive-text);
5034
+ }
5035
+
5036
+ .iquji-diagnostic-dialog-header__badge-dot {
5037
+ display: inline-block;
5038
+ background: currentColor;
5039
+ border-radius: 999px;
5040
+ width: 6px;
5041
+ height: 6px;
5042
+ }
5043
+
5044
+ .iquji-diagnostic-dialog-header__meta {
5045
+ color: var(--iquji-color-muted);
5046
+ display: flex;
5047
+ font-family: var(--iquji-font-mono);
5048
+ flex-wrap: wrap;
5049
+ align-items: center;
5050
+ gap: 6px;
5051
+ font-size: 12px;
5052
+ line-height: 1.4;
5053
+ }
5054
+
5055
+ .iquji-diagnostic-dialog-header__action {
5056
+ color: var(--iquji-color-text);
5057
+ font-weight: 500;
5058
+ }
5059
+
5060
+ .iquji-diagnostic-dialog-header__sep {
5061
+ opacity: .4;
5062
+ }
5063
+
5064
+ .iquji-diagnostic-dialog-header__task {
5065
+ display: inline-flex;
5066
+ align-items: center;
5067
+ gap: 4px;
5068
+ }
5069
+
5070
+ .iquji-diagnostic-dialog-header__copy-btn {
5071
+ appearance: none;
5072
+ color: var(--iquji-color-muted);
5073
+ cursor: pointer;
5074
+ display: inline-flex;
5075
+ outline: none;
5076
+ background: none;
5077
+ border: none;
5078
+ align-items: center;
5079
+ padding: 1px;
5080
+ transition: color .15s;
5081
+ }
5082
+
5083
+ .iquji-diagnostic-dialog-header__copy-btn:hover {
5084
+ color: var(--iquji-color-text);
5085
+ }
5086
+
5087
+ .iquji-diagnostic-dialog__footer {
5088
+ display: flex;
5089
+ justify-content: space-between;
5090
+ align-items: center;
4958
5091
  width: 100%;
4959
5092
  }
4960
5093
 
5094
+ .iquji-diagnostic-dialog__footer-hint {
5095
+ color: var(--iquji-color-muted);
5096
+ display: flex;
5097
+ font-size: var(--iquji-font-size-caption);
5098
+ align-items: center;
5099
+ }
5100
+
5101
+ .iquji-diagnostic-dialog__footer-actions {
5102
+ display: flex;
5103
+ align-items: center;
5104
+ gap: 8px;
5105
+ }
5106
+
5107
+ .iquji-diagnostic-dialog__copy-btn {
5108
+ font-weight: 500;
5109
+ }
5110
+
4961
5111
  /* src/emoji-picker.css */
4962
5112
  .iquji-emoji-picker {
4963
5113
  display: grid;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iquji-web/web-component",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "files": [
@@ -24,8 +24,8 @@
24
24
  "react": "19.2.4"
25
25
  },
26
26
  "dependencies": {
27
- "@iquji-web/web-icons": "0.1.11",
28
- "@iquji-web/web-theme": "0.1.11",
27
+ "@iquji-web/web-icons": "0.1.12",
28
+ "@iquji-web/web-theme": "0.1.12",
29
29
  "@tanstack/react-table": "8.21.3"
30
30
  },
31
31
  "description": "React 通用交互组件与布局。",