@iquji-web/web-component 0.1.10 → 0.1.11

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.
@@ -0,0 +1,38 @@
1
+ import { type ReactNode } from "react";
2
+ export type IqujiLogLevel = "debug" | "info" | "warn" | "error";
3
+ export type IqujiLogEntry = {
4
+ id?: string | undefined;
5
+ timestamp?: string | undefined;
6
+ level?: IqujiLogLevel | string | undefined;
7
+ source?: string | undefined;
8
+ phase?: string | undefined;
9
+ message: string;
10
+ errorSummary?: string | undefined;
11
+ };
12
+ export type IqujiLogViewerProps = {
13
+ /** 日志条目列表,可为结构化对象或纯文本行列表(自动解析时间戳与等级) */
14
+ logs: ReadonlyArray<IqujiLogEntry | string>;
15
+ /** 区域可访问名称 */
16
+ label?: string | undefined;
17
+ /** 最大高度,默认 380px */
18
+ maxHeight?: number | string | undefined;
19
+ /** 是否显示工具栏(搜索、等级过滤、复制、换行切换),默认 true */
20
+ toolbar?: boolean | undefined;
21
+ /** 是否显示行号,默认 true */
22
+ showLineNumbers?: boolean | undefined;
23
+ /** 是否显示时间戳,默认 true */
24
+ showTimestamps?: boolean | undefined;
25
+ /** 是否默认自动换行,默认 false(水平滚动) */
26
+ wrapLines?: boolean | undefined;
27
+ /** 加载中状态 */
28
+ loading?: boolean | undefined;
29
+ /** 空状态文案 */
30
+ emptyLabel?: string | undefined;
31
+ /** 额外的工具栏操作按钮(例如“刷新”) */
32
+ actions?: ReactNode | undefined;
33
+ /** 复制完成回调 */
34
+ onCopy?: ((text: string) => void) | undefined;
35
+ className?: string | undefined;
36
+ };
37
+ export declare function parseLogLine(raw: string, index: number): IqujiLogEntry;
38
+ export declare function IqujiLogViewer({ actions, className, emptyLabel, label, loading, logs, maxHeight, onCopy, showLineNumbers, showTimestamps, toolbar, wrapLines, }: IqujiLogViewerProps): import("react/jsx-runtime").JSX.Element;
package/dist/styles.css CHANGED
@@ -4529,6 +4529,435 @@
4529
4529
  background: none;
4530
4530
  }
4531
4531
 
4532
+ /* src/log-viewer.css */
4533
+ .iquji-log-viewer {
4534
+ --iquji-log-bg: #101216;
4535
+ --iquji-log-header-bg: #181b22;
4536
+ --iquji-log-text: #e1e4ea;
4537
+ --iquji-log-muted: #6e7687;
4538
+ --iquji-log-border: #262a33;
4539
+ --iquji-log-num: #4e5564;
4540
+ --iquji-log-hover: #161920;
4541
+ --iquji-log-err-bg: #ef44441a;
4542
+ --iquji-log-err-border: #ef4444;
4543
+ --iquji-log-warn-bg: #f59e0b14;
4544
+ --iquji-log-warn-border: #f59e0b;
4545
+ background: var(--iquji-log-bg);
4546
+ border: 1px solid var(--iquji-log-border);
4547
+ border-radius: var(--iquji-radius-panel);
4548
+ color: var(--iquji-log-text);
4549
+ display: flex;
4550
+ font-family: var(--iquji-font-mono);
4551
+ overflow: hidden;
4552
+ position: relative;
4553
+ flex-direction: column;
4554
+ width: 100%;
4555
+ font-size: 12px;
4556
+ line-height: 1.6;
4557
+ }
4558
+
4559
+ .iquji-log-viewer__toolbar {
4560
+ background: var(--iquji-log-header-bg);
4561
+ border-bottom: 1px solid var(--iquji-log-border);
4562
+ display: flex;
4563
+ align-items: center;
4564
+ gap: var(--iquji-space-2);
4565
+ flex-wrap: wrap;
4566
+ justify-content: space-between;
4567
+ padding: 8px 12px;
4568
+ }
4569
+
4570
+ .iquji-log-viewer__toolbar-left {
4571
+ display: flex;
4572
+ align-items: center;
4573
+ gap: var(--iquji-space-2);
4574
+ flex-wrap: wrap;
4575
+ flex: 1;
4576
+ min-width: 200px;
4577
+ }
4578
+
4579
+ .iquji-log-viewer__search {
4580
+ border: 1px solid var(--iquji-log-border);
4581
+ border-radius: var(--iquji-radius-control);
4582
+ color: var(--iquji-log-text);
4583
+ display: inline-flex;
4584
+ background: #ffffff0f;
4585
+ align-items: center;
4586
+ gap: 6px;
4587
+ padding: 3px 8px;
4588
+ transition: border-color .15s, background .15s;
4589
+ }
4590
+
4591
+ .iquji-log-viewer__search:focus-within {
4592
+ background: #ffffff17;
4593
+ border-color: #3b82f6;
4594
+ }
4595
+
4596
+ .iquji-log-viewer__search-input {
4597
+ color: inherit;
4598
+ outline: none;
4599
+ background: none;
4600
+ border: none;
4601
+ min-width: 140px;
4602
+ font-family: inherit;
4603
+ font-size: 12px;
4604
+ }
4605
+
4606
+ .iquji-log-viewer__search-input::placeholder {
4607
+ color: var(--iquji-log-muted);
4608
+ }
4609
+
4610
+ .iquji-log-viewer__filters {
4611
+ display: inline-flex;
4612
+ align-items: center;
4613
+ gap: 2px;
4614
+ }
4615
+
4616
+ .iquji-log-viewer__filter-btn {
4617
+ border-radius: var(--iquji-radius-control);
4618
+ color: var(--iquji-log-muted);
4619
+ cursor: pointer;
4620
+ display: inline-flex;
4621
+ background: none;
4622
+ border: none;
4623
+ align-items: center;
4624
+ gap: 4px;
4625
+ padding: 3px 8px;
4626
+ transition: all .15s;
4627
+ font-family: inherit;
4628
+ font-size: 11px;
4629
+ font-weight: 500;
4630
+ }
4631
+
4632
+ .iquji-log-viewer__filter-btn:hover {
4633
+ color: var(--iquji-log-text);
4634
+ background: #ffffff0f;
4635
+ }
4636
+
4637
+ .iquji-log-viewer__filter-btn[data-active="true"] {
4638
+ color: #fff;
4639
+ background: #ffffff1f;
4640
+ }
4641
+
4642
+ .iquji-log-viewer__filter-btn[data-tone="error"][data-active="true"] {
4643
+ color: #f87171;
4644
+ background: #ef444433;
4645
+ }
4646
+
4647
+ .iquji-log-viewer__toolbar-right {
4648
+ display: inline-flex;
4649
+ align-items: center;
4650
+ gap: 6px;
4651
+ }
4652
+
4653
+ .iquji-log-viewer__tool-btn {
4654
+ border: 1px solid var(--iquji-log-border);
4655
+ border-radius: var(--iquji-radius-control);
4656
+ color: var(--iquji-log-muted);
4657
+ cursor: pointer;
4658
+ display: inline-flex;
4659
+ user-select: none;
4660
+ background: #ffffff0d;
4661
+ align-items: center;
4662
+ gap: 5px;
4663
+ padding: 4px 9px;
4664
+ transition: all .15s;
4665
+ font-family: inherit;
4666
+ font-size: 11px;
4667
+ }
4668
+
4669
+ .iquji-log-viewer__tool-btn:hover:not(:disabled) {
4670
+ color: var(--iquji-log-text);
4671
+ background: #ffffff1a;
4672
+ }
4673
+
4674
+ .iquji-log-viewer__tool-btn[data-active="true"] {
4675
+ color: #60a5fa;
4676
+ background: #3b82f626;
4677
+ border-color: #3b82f6;
4678
+ }
4679
+
4680
+ .iquji-log-viewer__tool-btn:disabled {
4681
+ cursor: not-allowed;
4682
+ opacity: .5;
4683
+ }
4684
+
4685
+ .iquji-log-viewer__scroll {
4686
+ background: var(--iquji-log-bg);
4687
+ box-sizing: border-box;
4688
+ display: block;
4689
+ overflow: auto;
4690
+ position: relative;
4691
+ width: 100%;
4692
+ }
4693
+
4694
+ .iquji-log-viewer__lines {
4695
+ display: flex;
4696
+ flex-direction: column;
4697
+ width: max-content;
4698
+ min-width: 100%;
4699
+ padding: 8px 0;
4700
+ }
4701
+
4702
+ .iquji-log-viewer[data-wrap="true"] .iquji-log-viewer__lines {
4703
+ width: 100%;
4704
+ }
4705
+
4706
+ .iquji-log-viewer__line {
4707
+ box-sizing: border-box;
4708
+ display: flex;
4709
+ white-space: pre;
4710
+ align-items: baseline;
4711
+ gap: 8px;
4712
+ min-height: 22px;
4713
+ padding: 1px 12px;
4714
+ transition: background .1s;
4715
+ }
4716
+
4717
+ .iquji-log-viewer[data-wrap="true"] .iquji-log-viewer__line {
4718
+ white-space: pre-wrap;
4719
+ word-break: break-all;
4720
+ }
4721
+
4722
+ .iquji-log-viewer__line:hover {
4723
+ background: var(--iquji-log-hover);
4724
+ }
4725
+
4726
+ .iquji-log-viewer__line[data-level="error"] {
4727
+ background: var(--iquji-log-err-bg);
4728
+ border-left: 3px solid var(--iquji-log-err-border);
4729
+ padding-left: 9px;
4730
+ }
4731
+
4732
+ .iquji-log-viewer__line[data-level="warn"] {
4733
+ background: var(--iquji-log-warn-bg);
4734
+ border-left: 3px solid var(--iquji-log-warn-border);
4735
+ padding-left: 9px;
4736
+ }
4737
+
4738
+ .iquji-log-viewer__num {
4739
+ color: var(--iquji-log-num);
4740
+ display: inline-block;
4741
+ text-align: right;
4742
+ user-select: none;
4743
+ flex-shrink: 0;
4744
+ min-width: 32px;
4745
+ font-size: 11px;
4746
+ }
4747
+
4748
+ .iquji-log-viewer__time {
4749
+ color: var(--iquji-log-muted);
4750
+ user-select: none;
4751
+ flex-shrink: 0;
4752
+ font-size: 11px;
4753
+ }
4754
+
4755
+ .iquji-log-viewer__level {
4756
+ display: inline-block;
4757
+ letter-spacing: .5px;
4758
+ text-align: center;
4759
+ text-transform: uppercase;
4760
+ user-select: none;
4761
+ border-radius: 3px;
4762
+ flex-shrink: 0;
4763
+ padding: 1px 5px;
4764
+ font-size: 10px;
4765
+ font-weight: 600;
4766
+ line-height: 14px;
4767
+ }
4768
+
4769
+ .iquji-log-viewer__level[data-level="info"] {
4770
+ color: #38bdf8;
4771
+ background: #38bdf81f;
4772
+ }
4773
+
4774
+ .iquji-log-viewer__level[data-level="warn"] {
4775
+ color: #fbbf24;
4776
+ background: #fbbf2426;
4777
+ }
4778
+
4779
+ .iquji-log-viewer__level[data-level="error"] {
4780
+ color: #f87171;
4781
+ background: #f8717133;
4782
+ }
4783
+
4784
+ .iquji-log-viewer__level[data-level="debug"] {
4785
+ color: #94a3b8;
4786
+ background: #94a3b81f;
4787
+ }
4788
+
4789
+ .iquji-log-viewer__tag {
4790
+ color: #a5b4fc;
4791
+ user-select: none;
4792
+ background: #6366f11f;
4793
+ border: 1px solid #6366f140;
4794
+ border-radius: 3px;
4795
+ flex-shrink: 0;
4796
+ padding: 0 4px;
4797
+ font-size: 10px;
4798
+ line-height: 14px;
4799
+ }
4800
+
4801
+ .iquji-log-viewer__msg {
4802
+ color: var(--iquji-log-text);
4803
+ flex: 1;
4804
+ }
4805
+
4806
+ .iquji-log-viewer__highlight {
4807
+ color: #fef3c7;
4808
+ background: #f59e0b59;
4809
+ border-radius: 2px;
4810
+ padding: 0 2px;
4811
+ }
4812
+
4813
+ .iquji-log-viewer__status {
4814
+ background: var(--iquji-log-header-bg);
4815
+ border-top: 1px solid var(--iquji-log-border);
4816
+ color: var(--iquji-log-muted);
4817
+ display: flex;
4818
+ justify-content: space-between;
4819
+ align-items: center;
4820
+ gap: 12px;
4821
+ padding: 6px 12px;
4822
+ font-size: 11px;
4823
+ }
4824
+
4825
+ .iquji-log-viewer__empty, .iquji-log-viewer__loading {
4826
+ box-sizing: border-box;
4827
+ color: var(--iquji-log-muted);
4828
+ display: flex;
4829
+ text-align: center;
4830
+ flex-direction: column;
4831
+ justify-content: center;
4832
+ align-items: center;
4833
+ gap: 8px;
4834
+ min-height: 160px;
4835
+ padding: 24px;
4836
+ }
4837
+
4838
+ /* src/diagnostic.css */
4839
+ .iquji-diagnostic-banner {
4840
+ background: var(--iquji-color-critical-fill);
4841
+ border: 1px solid var(--iquji-color-critical-border);
4842
+ border-radius: var(--iquji-radius-panel);
4843
+ color: var(--iquji-color-critical-text);
4844
+ display: flex;
4845
+ gap: var(--iquji-space-2);
4846
+ position: relative;
4847
+ flex-direction: column;
4848
+ padding: 12px 16px;
4849
+ }
4850
+
4851
+ .iquji-diagnostic-banner[data-tone="warning"] {
4852
+ background: var(--iquji-color-warning-fill);
4853
+ border-color: var(--iquji-color-warning-border);
4854
+ color: var(--iquji-color-warning-text);
4855
+ }
4856
+
4857
+ .iquji-diagnostic-banner[data-tone="info"] {
4858
+ background: var(--iquji-color-info-fill);
4859
+ border-color: var(--iquji-color-info-border);
4860
+ color: var(--iquji-color-info-text);
4861
+ }
4862
+
4863
+ .iquji-diagnostic-banner[data-tone="success"] {
4864
+ background: var(--iquji-color-positive-fill);
4865
+ border-color: var(--iquji-color-positive-border);
4866
+ color: var(--iquji-color-positive-text);
4867
+ }
4868
+
4869
+ .iquji-diagnostic-banner__header {
4870
+ display: flex;
4871
+ justify-content: space-between;
4872
+ align-items: center;
4873
+ gap: 10px;
4874
+ }
4875
+
4876
+ .iquji-diagnostic-banner__lead {
4877
+ display: inline-flex;
4878
+ align-items: center;
4879
+ gap: 8px;
4880
+ }
4881
+
4882
+ .iquji-diagnostic-banner__icon {
4883
+ display: inline-flex;
4884
+ flex-shrink: 0;
4885
+ align-items: center;
4886
+ }
4887
+
4888
+ .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);
4892
+ margin: 0;
4893
+ }
4894
+
4895
+ .iquji-diagnostic-banner__code {
4896
+ border-radius: var(--iquji-radius-control);
4897
+ cursor: pointer;
4898
+ display: inline-flex;
4899
+ font-family: var(--iquji-font-mono);
4900
+ font-size: var(--iquji-font-size-caption);
4901
+ user-select: all;
4902
+ background: #0000000f;
4903
+ gap: 4px;
4904
+ padding: 2px 6px;
4905
+ transition: background .15s;
4906
+ font-weight: 500;
4907
+ }
4908
+
4909
+ .iquji-diagnostic-banner__code:hover {
4910
+ background: #0000001f;
4911
+ }
4912
+
4913
+ .iquji-diagnostic-banner__desc {
4914
+ font-size: var(--iquji-font-size-body-sm);
4915
+ opacity: .95;
4916
+ margin: 0;
4917
+ line-height: 1.5;
4918
+ }
4919
+
4920
+ .iquji-diagnostic-meta {
4921
+ display: flex;
4922
+ align-items: center;
4923
+ gap: var(--iquji-space-2);
4924
+ margin-bottom: var(--iquji-space-1);
4925
+ flex-wrap: wrap;
4926
+ }
4927
+
4928
+ .iquji-diagnostic-meta__item {
4929
+ background: var(--iquji-color-neutral-fill);
4930
+ border-radius: var(--iquji-radius-control);
4931
+ color: var(--iquji-color-neutral-text);
4932
+ display: inline-flex;
4933
+ font-family: var(--iquji-font-mono);
4934
+ align-items: center;
4935
+ gap: 6px;
4936
+ padding: 3px 8px;
4937
+ font-size: 11px;
4938
+ }
4939
+
4940
+ .iquji-diagnostic-meta__btn {
4941
+ color: inherit;
4942
+ cursor: pointer;
4943
+ display: inline-flex;
4944
+ background: none;
4945
+ border: none;
4946
+ padding: 0;
4947
+ transition: opacity .15s;
4948
+ }
4949
+
4950
+ .iquji-diagnostic-meta__btn:hover {
4951
+ opacity: .7;
4952
+ }
4953
+
4954
+ .iquji-diagnostic-dialog-body {
4955
+ display: flex;
4956
+ gap: var(--iquji-space-3);
4957
+ flex-direction: column;
4958
+ width: 100%;
4959
+ }
4960
+
4532
4961
  /* src/emoji-picker.css */
4533
4962
  .iquji-emoji-picker {
4534
4963
  display: grid;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iquji-web/web-component",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
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.10",
28
- "@iquji-web/web-theme": "0.1.10",
27
+ "@iquji-web/web-icons": "0.1.11",
28
+ "@iquji-web/web-theme": "0.1.11",
29
29
  "@tanstack/react-table": "8.21.3"
30
30
  },
31
31
  "description": "React 通用交互组件与布局。",