@iyulab/chat-components 0.1.1 → 0.3.0

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 (115) hide show
  1. package/CHANGELOG.md +31 -1
  2. package/dist/components/blocks/UCodeBlock.component.d.ts +7 -8
  3. package/dist/components/blocks/UCodeBlock.component.js +32 -21
  4. package/dist/components/blocks/UCodeBlock.styles.js +7 -6
  5. package/dist/components/{json-viewer/UJsonViewer.component.d.ts → blocks/UJsonBlock.component.d.ts} +5 -4
  6. package/dist/components/{json-viewer/UJsonViewer.component.js → blocks/UJsonBlock.component.js} +20 -17
  7. package/dist/components/blocks/UJsonBlock.d.ts +7 -0
  8. package/dist/components/blocks/UJsonBlock.js +5 -0
  9. package/dist/components/blocks/UMarkedBlock.component.d.ts +30 -9
  10. package/dist/components/blocks/UMarkedBlock.component.js +75 -26
  11. package/dist/components/blocks/UMarkedBlock.styles.js +288 -949
  12. package/dist/components/blocks/URefBlock.component.d.ts +17 -0
  13. package/dist/components/blocks/URefBlock.component.js +74 -0
  14. package/dist/components/blocks/URefBlock.d.ts +7 -0
  15. package/dist/components/blocks/URefBlock.js +5 -0
  16. package/dist/components/blocks/URefBlock.styles.js +75 -0
  17. package/dist/components/blocks/UThinkBlock.component.d.ts +3 -8
  18. package/dist/components/blocks/UThinkBlock.component.js +28 -22
  19. package/dist/components/blocks/UThinkBlock.styles.js +35 -54
  20. package/dist/components/blocks/UToolBlock.component.d.ts +13 -9
  21. package/dist/components/blocks/UToolBlock.component.js +30 -76
  22. package/dist/components/blocks/UToolBlock.styles.js +21 -62
  23. package/dist/components/buttons/UAttachButton.component.d.ts +3 -5
  24. package/dist/components/buttons/UAttachButton.component.js +30 -19
  25. package/dist/components/buttons/UAttachButton.styles.js +5 -12
  26. package/dist/components/buttons/UCopyButton.component.d.ts +3 -8
  27. package/dist/components/buttons/UCopyButton.component.js +29 -53
  28. package/dist/components/buttons/UCopyButton.styles.js +8 -37
  29. package/dist/components/buttons/UReportButton.component.d.ts +9 -0
  30. package/dist/components/buttons/UReportButton.component.js +36 -0
  31. package/dist/components/buttons/UReportButton.d.ts +7 -0
  32. package/dist/components/buttons/UReportButton.js +5 -0
  33. package/dist/components/buttons/UReportButton.styles.js +14 -0
  34. package/dist/components/buttons/URetryButton.component.d.ts +11 -0
  35. package/dist/components/buttons/{USendButton.component.js → URetryButton.component.js} +21 -14
  36. package/dist/components/buttons/URetryButton.d.ts +7 -0
  37. package/dist/components/buttons/URetryButton.js +5 -0
  38. package/dist/components/buttons/URetryButton.styles.d.ts +1 -0
  39. package/dist/components/buttons/URetryButton.styles.js +26 -0
  40. package/dist/components/buttons/UShareButton.component.d.ts +9 -0
  41. package/dist/components/buttons/UShareButton.component.js +36 -0
  42. package/dist/components/buttons/UShareButton.d.ts +7 -0
  43. package/dist/components/buttons/UShareButton.js +5 -0
  44. package/dist/components/buttons/UShareButton.styles.d.ts +1 -0
  45. package/dist/components/buttons/UShareButton.styles.js +14 -0
  46. package/dist/components/buttons/UVoteButton.component.d.ts +15 -0
  47. package/dist/components/buttons/UVoteButton.component.js +70 -0
  48. package/dist/components/buttons/UVoteButton.d.ts +8 -0
  49. package/dist/components/buttons/UVoteButton.js +5 -0
  50. package/dist/components/buttons/UVoteButton.styles.d.ts +1 -0
  51. package/dist/components/buttons/UVoteButton.styles.js +19 -0
  52. package/dist/components/loaders/UDotLoader.component.d.ts +9 -0
  53. package/dist/components/loaders/UDotLoader.component.js +23 -0
  54. package/dist/components/loaders/UDotLoader.d.ts +7 -0
  55. package/dist/components/loaders/UDotLoader.js +5 -0
  56. package/dist/components/loaders/UDotLoader.styles.d.ts +1 -0
  57. package/dist/components/loaders/UDotLoader.styles.js +50 -0
  58. package/dist/components/message/UMessage.component.d.ts +12 -6
  59. package/dist/components/message/UMessage.component.js +45 -59
  60. package/dist/components/message/UMessage.d.ts +0 -1
  61. package/dist/components/message/UMessage.styles.js +30 -49
  62. package/dist/components/prompt/UPrompt.component.d.ts +25 -0
  63. package/dist/components/prompt/UPrompt.component.js +113 -0
  64. package/dist/components/prompt/UPrompt.d.ts +7 -0
  65. package/dist/components/prompt/UPrompt.js +5 -0
  66. package/dist/components/prompt/UPrompt.styles.d.ts +1 -0
  67. package/dist/components/prompt/UPrompt.styles.js +42 -0
  68. package/dist/components/references/URefCard.component.d.ts +24 -0
  69. package/dist/components/references/URefCard.component.js +105 -0
  70. package/dist/components/references/URefCard.d.ts +7 -0
  71. package/dist/components/references/URefCard.js +5 -0
  72. package/dist/components/references/URefCard.styles.d.ts +1 -0
  73. package/dist/components/references/URefCard.styles.js +103 -0
  74. package/dist/components/references/URefCardGroup.component.d.ts +25 -0
  75. package/dist/components/references/URefCardGroup.component.js +88 -0
  76. package/dist/components/references/URefCardGroup.d.ts +7 -0
  77. package/dist/components/references/URefCardGroup.js +5 -0
  78. package/dist/components/references/URefCardGroup.styles.d.ts +1 -0
  79. package/dist/components/references/URefCardGroup.styles.js +69 -0
  80. package/dist/components/references/URefTag.component.d.ts +13 -0
  81. package/dist/components/references/URefTag.component.js +54 -0
  82. package/dist/components/references/URefTag.d.ts +7 -0
  83. package/dist/components/references/URefTag.js +5 -0
  84. package/dist/components/references/URefTag.styles.d.ts +1 -0
  85. package/dist/components/references/URefTag.styles.js +51 -0
  86. package/dist/events/UCancelEvent.d.ts +6 -0
  87. package/dist/index.d.ts +16 -5
  88. package/dist/index.js +25 -9
  89. package/dist/types/BlockItem.d.ts +42 -0
  90. package/dist/types/JsonNode.d.ts +20 -0
  91. package/dist/types/References.d.ts +28 -0
  92. package/dist/utilities/converters.d.ts +9 -0
  93. package/dist/utilities/converters.js +19 -0
  94. package/package.json +10 -11
  95. package/dist/components/buttons/USendButton.component.d.ts +0 -13
  96. package/dist/components/buttons/USendButton.d.ts +0 -7
  97. package/dist/components/buttons/USendButton.js +0 -5
  98. package/dist/components/buttons/USendButton.styles.js +0 -23
  99. package/dist/components/buttons/UThinkButton.component.d.ts +0 -19
  100. package/dist/components/buttons/UThinkButton.component.js +0 -73
  101. package/dist/components/buttons/UThinkButton.d.ts +0 -7
  102. package/dist/components/buttons/UThinkButton.js +0 -5
  103. package/dist/components/buttons/UThinkButton.styles.js +0 -72
  104. package/dist/components/json-viewer/UJsonViewer.d.ts +0 -7
  105. package/dist/components/json-viewer/UJsonViewer.js +0 -5
  106. package/dist/components/json-viewer/UJsonViewer.lib.d.ts +0 -16
  107. package/dist/components/json-viewer/UJsonViewer.lib.js +0 -28
  108. package/dist/components/message/UMessage.types.d.ts +0 -21
  109. package/dist/events/UStopEvent.d.ts +0 -6
  110. package/dist/internals/date-helpers.d.ts +0 -8
  111. package/dist/internals/date-helpers.js +0 -27
  112. /package/dist/components/{buttons/USendButton.styles.d.ts → blocks/UJsonBlock.styles.d.ts} +0 -0
  113. /package/dist/components/{json-viewer/UJsonViewer.styles.js → blocks/UJsonBlock.styles.js} +0 -0
  114. /package/dist/components/{buttons/UThinkButton.styles.d.ts → blocks/URefBlock.styles.d.ts} +0 -0
  115. /package/dist/components/{json-viewer/UJsonViewer.styles.d.ts → buttons/UReportButton.styles.d.ts} +0 -0
@@ -0,0 +1,54 @@
1
+ import { html } from 'lit';
2
+ import { property } from 'lit/decorators.js';
3
+ import { ifDefined } from 'lit/directives/if-defined.js';
4
+ import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
5
+ import { UTooltip } from '@iyulab/components/dist/components/tooltip/UTooltip.component.js';
6
+ import { UIcon } from '@iyulab/components/dist/components/icon/UIcon.component.js';
7
+ import { styles } from './URefTag.styles.js';
8
+
9
+ var __defProp = Object.defineProperty;
10
+ var __decorateClass = (decorators, target, key, kind) => {
11
+ var result = void 0 ;
12
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
13
+ if (decorator = decorators[i])
14
+ result = (decorator(target, key, result) ) || result;
15
+ if (result) __defProp(target, key, result);
16
+ return result;
17
+ };
18
+ class URefTag extends BaseElement {
19
+ static {
20
+ this.styles = [super.styles, styles];
21
+ }
22
+ static {
23
+ this.dependencies = {
24
+ "u-icon": UIcon,
25
+ "u-tooltip": UTooltip
26
+ };
27
+ }
28
+ render() {
29
+ return html`
30
+ <a href="${ifDefined(this.href)}" target="_blank" rel="noopener noreferrer"
31
+ @click=${this.handleAnchorClick}>
32
+ <slot></slot>
33
+ </a>
34
+
35
+ <u-icon lib="internal" name="box-arrow-up-right"></u-icon>
36
+
37
+ <u-tooltip interactive placement="bottom" distance="4">
38
+ <slot name="tooltip"></slot>
39
+ </u-tooltip>
40
+ `;
41
+ }
42
+ /** 링크 클릭 핸들러 */
43
+ handleAnchorClick(e) {
44
+ if (!this.href) {
45
+ e.preventDefault();
46
+ e.stopPropagation();
47
+ }
48
+ }
49
+ }
50
+ __decorateClass([
51
+ property({ type: String })
52
+ ], URefTag.prototype, "href");
53
+
54
+ export { URefTag };
@@ -0,0 +1,7 @@
1
+ import { URefTag } from './URefTag.component.js';
2
+ declare global {
3
+ interface HTMLElementTagNameMap {
4
+ 'u-ref-tag': URefTag;
5
+ }
6
+ }
7
+ export { URefTag };
@@ -0,0 +1,5 @@
1
+ import { URefTag } from './URefTag.component.js';
2
+
3
+ URefTag.define("u-ref-tag");
4
+
5
+ export { URefTag };
@@ -0,0 +1 @@
1
+ export declare const styles: import('lit').CSSResult;
@@ -0,0 +1,51 @@
1
+ import { css } from 'lit';
2
+
3
+ const styles = css`
4
+ :host {
5
+ display: inline-flex;
6
+ flex-direction: row;
7
+ align-items: center;
8
+ gap: 4px;
9
+ color: var(--u-neutral-800);
10
+ font-size: 10px;
11
+ border: 1px solid var(--u-neutral-300);
12
+ border-radius: 9999px;
13
+ background-color: var(--u-neutral-100);
14
+ padding: 2px 6px;
15
+ transition: background-color 0.2s ease-in-out;
16
+ cursor: pointer;
17
+ }
18
+ :host(:hover) {
19
+ color: var(--u-neutral-100);
20
+ background-color: var(--u-neutral-900);
21
+ }
22
+
23
+ a {
24
+ min-width: 1em;
25
+ max-width: 6em;
26
+ display: inline-block;
27
+ text-decoration: none;
28
+ color: inherit;
29
+ line-height: 1.5;
30
+ white-space: nowrap;
31
+ text-overflow: ellipsis;
32
+ overflow: hidden;
33
+ }
34
+
35
+ u-icon {
36
+ color: inherit;
37
+ font-size: inherit;
38
+ }
39
+
40
+ u-tooltip {
41
+ padding: 0;
42
+ border: none;
43
+ background-color: transparent;
44
+ box-shadow: none;
45
+ }
46
+ u-tooltip[visible] {
47
+ opacity: 1;
48
+ }
49
+ `;
50
+
51
+ export { styles };
@@ -0,0 +1,6 @@
1
+ export type UCancelEvent = CustomEvent<undefined>;
2
+ declare global {
3
+ interface HTMLElementEventMap {
4
+ 'u-cancel': UCancelEvent;
5
+ }
6
+ }
package/dist/index.d.ts CHANGED
@@ -1,13 +1,24 @@
1
1
  export * from './components/blocks/UCodeBlock.js';
2
+ export * from './components/blocks/UJsonBlock.js';
2
3
  export * from './components/blocks/UMarkedBlock.js';
3
4
  export * from './components/blocks/UTextBlock.js';
4
5
  export * from './components/blocks/UThinkBlock.js';
5
6
  export * from './components/blocks/UToolBlock.js';
7
+ export * from './components/blocks/URefBlock.js';
6
8
  export * from './components/buttons/UAttachButton.js';
7
9
  export * from './components/buttons/UCopyButton.js';
8
- export * from './components/buttons/USendButton.js';
9
- export * from './components/buttons/UThinkButton.js';
10
- export * from './components/json-viewer/UJsonViewer.js';
10
+ export * from './components/buttons/UVoteButton.js';
11
+ export * from './components/buttons/UReportButton.js';
12
+ export * from './components/buttons/URetryButton.js';
13
+ export * from './components/buttons/UShareButton.js';
14
+ export * from './components/loaders/UDotLoader.js';
11
15
  export * from './components/message/UMessage.js';
12
- export type { UStopEvent } from './events/UStopEvent';
13
- export type { USubmitEvent } from './events/USubmitEvent';
16
+ export * from './components/prompt/UPrompt.js';
17
+ export * from './components/references/URefTag.js';
18
+ export * from './components/references/URefCard.js';
19
+ export * from './components/references/URefCardGroup.js';
20
+ export type * from './types/BlockItem';
21
+ export type * from './types/JsonNode';
22
+ export type * from './types/References';
23
+ export type * from './events/UCancelEvent';
24
+ export type * from './events/USubmitEvent';
package/dist/index.js CHANGED
@@ -1,22 +1,38 @@
1
1
  import './components/blocks/UCodeBlock.js';
2
+ import './components/blocks/UJsonBlock.js';
2
3
  import './components/blocks/UMarkedBlock.js';
3
4
  import './components/blocks/UTextBlock.js';
4
5
  import './components/blocks/UThinkBlock.js';
5
6
  import './components/blocks/UToolBlock.js';
7
+ import './components/blocks/URefBlock.js';
6
8
  import './components/buttons/UAttachButton.js';
7
9
  import './components/buttons/UCopyButton.js';
8
- import './components/buttons/USendButton.js';
9
- import './components/buttons/UThinkButton.js';
10
- import './components/json-viewer/UJsonViewer.js';
10
+ import './components/buttons/UVoteButton.js';
11
+ import './components/buttons/UReportButton.js';
12
+ import './components/buttons/URetryButton.js';
13
+ import './components/buttons/UShareButton.js';
14
+ import './components/loaders/UDotLoader.js';
11
15
  import './components/message/UMessage.js';
16
+ import './components/prompt/UPrompt.js';
17
+ import './components/references/URefTag.js';
18
+ import './components/references/URefCard.js';
19
+ import './components/references/URefCardGroup.js';
20
+ export { UAttachButton } from './components/buttons/UAttachButton.component.js';
12
21
  export { UCodeBlock } from './components/blocks/UCodeBlock.component.js';
22
+ export { UCopyButton } from './components/buttons/UCopyButton.component.js';
23
+ export { UDotLoader } from './components/loaders/UDotLoader.component.js';
24
+ export { UJsonBlock } from './components/blocks/UJsonBlock.component.js';
13
25
  export { UMarkedBlock } from './components/blocks/UMarkedBlock.component.js';
26
+ export { UMessage } from './components/message/UMessage.component.js';
27
+ export { UPrompt } from './components/prompt/UPrompt.component.js';
28
+ export { URefBlock } from './components/blocks/URefBlock.component.js';
29
+ export { URefCard } from './components/references/URefCard.component.js';
30
+ export { URefCardGroup } from './components/references/URefCardGroup.component.js';
31
+ export { URefTag } from './components/references/URefTag.component.js';
32
+ export { UReportButton } from './components/buttons/UReportButton.component.js';
33
+ export { URetryButton } from './components/buttons/URetryButton.component.js';
34
+ export { UShareButton } from './components/buttons/UShareButton.component.js';
14
35
  export { UTextBlock } from './components/blocks/UTextBlock.component.js';
15
36
  export { UThinkBlock } from './components/blocks/UThinkBlock.component.js';
16
37
  export { UToolBlock } from './components/blocks/UToolBlock.component.js';
17
- export { UAttachButton } from './components/buttons/UAttachButton.component.js';
18
- export { UCopyButton } from './components/buttons/UCopyButton.component.js';
19
- export { USendButton } from './components/buttons/USendButton.component.js';
20
- export { UThinkButton } from './components/buttons/UThinkButton.component.js';
21
- export { UJsonViewer } from './components/json-viewer/UJsonViewer.component.js';
22
- export { UMessage } from './components/message/UMessage.component.js';
38
+ export { UVoteButton } from './components/buttons/UVoteButton.component.js';
@@ -0,0 +1,42 @@
1
+ import { ReferenceSource, ReferenceCitation } from './References';
2
+ import { JsonNode } from './JsonNode';
3
+ /** LLM 추론 텍스트 블록입니다. */
4
+ export interface ThinkingBlockItem {
5
+ type: "thinking";
6
+ /** 추론 텍스트 내용 */
7
+ value?: string;
8
+ }
9
+ /** 일반 텍스트 블록입니다. */
10
+ export interface TextBlockItem {
11
+ type: "text";
12
+ /** 텍스트 내용 */
13
+ value?: string;
14
+ }
15
+ /** 마크다운 텍스트 블록입니다. */
16
+ export interface MarkdownBlockItem {
17
+ type: "markdown";
18
+ /** 마크다운 텍스트 */
19
+ value?: string;
20
+ /** 마크다운 내 인용 정보 들 */
21
+ refs?: ReferenceCitation[];
22
+ }
23
+ /** 툴 사용 블록입니다. */
24
+ export interface ToolBlockItem {
25
+ type: "tool";
26
+ /** 도구 블록 제목 */
27
+ title?: string;
28
+ /** 도구 블록 입력값(json) */
29
+ input?: JsonNode;
30
+ /** 도구 블록 출력값(json) */
31
+ output?: JsonNode;
32
+ }
33
+ /** 출처 정보 */
34
+ export interface ReferenceBlockItem {
35
+ type: "reference";
36
+ /** 출처 목록 */
37
+ sources: ReferenceSource[];
38
+ }
39
+ /**
40
+ * 타입별 메시지 컨텐츠 아이템
41
+ */
42
+ export type BlockItem = (ThinkingBlockItem | TextBlockItem | MarkdownBlockItem | ToolBlockItem | ReferenceBlockItem);
@@ -0,0 +1,20 @@
1
+ /** JSON 값 타입 */
2
+ export type JsonValue = string | number | boolean | null;
3
+ /** JSON 객체 타입 */
4
+ export type JsonObject = {
5
+ [x: string]: JsonNode;
6
+ };
7
+ /** JSON 배열 타입 */
8
+ export type JsonArray = Array<JsonNode>;
9
+ /**
10
+ * JSON 데이터 구조에서 사용할 수 있는 모든 유형의 노드를 표현합니다.
11
+ * JsonValue(원시값), JsonObject(객체), JsonArray(배열) 중 하나가 될 수 있습니다.
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * const primitiveNode: JsonNode = "string value";
16
+ * const objectNode: JsonNode = { key: "value" };
17
+ * const arrayNode: JsonNode = [1, 2, 3];
18
+ * ```
19
+ */
20
+ export type JsonNode = JsonValue | JsonObject | JsonArray;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * 참조에서 사용되는 원본 내용입니다.
3
+ */
4
+ export interface ReferenceSource {
5
+ /** 자료의 종류 입니다. */
6
+ type: 'web' | 'document';
7
+ /** 참조 링크 URL */
8
+ url?: string;
9
+ /** 제목 */
10
+ title?: string;
11
+ /** 발췌 내용 */
12
+ snippet?: string;
13
+ /** 태그 */
14
+ tags?: string[];
15
+ }
16
+ /**
17
+ * 본문 내 참조 인용 정보입니다.
18
+ */
19
+ export interface ReferenceCitation {
20
+ /** 참조 텍스트 시작 위치 (문자 인덱스) */
21
+ startIndex: number;
22
+ /** 참조 텍스트 종료 위치 (문자 인덱스) */
23
+ endIndex: number;
24
+ /** 본문에 표시될 참조 라벨 (예: [1], (Smith et al., 2023)) */
25
+ label?: string;
26
+ /** 원본 참조 내용 */
27
+ sources: ReferenceSource[];
28
+ }
@@ -0,0 +1,9 @@
1
+ import { JsonNode } from '../types/JsonNode';
2
+ /**
3
+ * 이 컨버터는 JsonNode 타입을 사용하여 JSON 데이터를 처리합니다.
4
+ * 문자열 어트리뷰트로 전달된 JSON 문자열을 객체로 변환/직렬화합니다.
5
+ */
6
+ export declare const jsonAttrConverter: {
7
+ fromAttribute: (value: string | null) => JsonNode;
8
+ toAttribute: (value: JsonNode) => string;
9
+ };
@@ -0,0 +1,19 @@
1
+ const jsonAttrConverter = {
2
+ fromAttribute: (value) => {
3
+ if (!value || !value.trim()) return {};
4
+ try {
5
+ return JSON.parse(value);
6
+ } catch {
7
+ return {};
8
+ }
9
+ },
10
+ toAttribute: (value) => {
11
+ try {
12
+ return JSON.stringify(value);
13
+ } catch {
14
+ return "{}";
15
+ }
16
+ }
17
+ };
18
+
19
+ export { jsonAttrConverter };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@iyulab/chat-components",
3
3
  "description": "llm chat components for building chat interfaces",
4
- "version": "0.1.1",
4
+ "version": "0.3.0",
5
5
  "author": "iyulab",
6
6
  "license": "MIT",
7
7
  "keywords": [
@@ -37,29 +37,28 @@
37
37
  }
38
38
  },
39
39
  "scripts": {
40
- "start": "vite",
40
+ "test": "vite",
41
41
  "build": "eslint && vite build"
42
42
  },
43
43
  "dependencies": {
44
- "@iyulab/components": "0.1.10",
44
+ "@iyulab/components": "0.2.0",
45
45
  "dompurify": "^3.3.1",
46
46
  "highlight.js": "^11.11.1",
47
- "lit": "^3.3.1",
47
+ "lit": "^3.3.2",
48
48
  "marked": "^17.0.1",
49
- "marked-alert": "^2.1.2",
50
- "marked-footnote": "^1.4.0",
51
49
  "marked-katex-extension": "^5.1.6"
52
50
  },
53
51
  "devDependencies": {
54
- "@lit/react": "^1.0.8",
55
52
  "@eslint/js": "^9.39.2",
56
- "@types/node": "^25.0.3",
53
+ "@lit/react": "^1.0.8",
54
+ "@types/node": "^25.0.9",
57
55
  "eslint": "^9.39.2",
58
56
  "eslint-plugin-lit": "^2.1.1",
59
- "globals": "^16.5.0",
57
+ "globals": "^17.0.0",
58
+ "openai": "^6.16.0",
60
59
  "typescript": "^5.9.3",
61
- "typescript-eslint": "^8.50.0",
62
- "vite": "^7.3.0",
60
+ "typescript-eslint": "^8.53.1",
61
+ "vite": "^7.3.1",
63
62
  "vite-plugin-dts": "^4.5.4"
64
63
  }
65
64
  }
@@ -1,13 +0,0 @@
1
- import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
2
- /**
3
- * 메시지 전송/중단 버튼 컴포넌트입니다.
4
- */
5
- export declare class USendButton extends BaseElement {
6
- static styles: import('lit').CSSResultGroup[];
7
- static dependencies: Record<string, typeof BaseElement>;
8
- /** 로딩 상태 (로딩 중일 때 중단 버튼으로 변경됨) */
9
- mode: "send" | "stop" | "retry";
10
- /** 비활성화 상태 */
11
- disabled: boolean;
12
- render(): import('lit-html').TemplateResult<1>;
13
- }
@@ -1,7 +0,0 @@
1
- import { USendButton } from './USendButton.component.js';
2
- declare global {
3
- interface HTMLElementTagNameMap {
4
- "u-send-button": USendButton;
5
- }
6
- }
7
- export { USendButton };
@@ -1,5 +0,0 @@
1
- import { USendButton } from './USendButton.component.js';
2
-
3
- USendButton.define("u-send-button");
4
-
5
- export { USendButton };
@@ -1,23 +0,0 @@
1
- import { css } from 'lit';
2
-
3
- const styles = css`
4
- :host {
5
- display: inline-flex;
6
- padding: 8px;
7
- border: none;
8
- border-radius: 8px;
9
- font-size: 16px;
10
- border: 1px solid var(--u-border-color, #d1d5db);
11
- background-color: var(--u-neutral-200, #e5e7eb);
12
- cursor: pointer;
13
- }
14
- :host(:hover) {
15
- background-color: var(--u-neutral-300, #d1d5db);
16
- }
17
- :host([disabled]) {
18
- pointer-events: none;
19
- opacity: 0.5;
20
- }
21
- `;
22
-
23
- export { styles };
@@ -1,19 +0,0 @@
1
- import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
2
- export type ThinkingValue = "low" | "medium" | "high" | "none";
3
- /**
4
- * 모델이 추론을 사용하고자 할 때 사용하는 버튼입니다.
5
- */
6
- export declare class UThinkButton extends BaseElement {
7
- static styles: import('lit').CSSResultGroup[];
8
- static dependencies: Record<string, typeof BaseElement>;
9
- private readonly states;
10
- /** 비활성화 상태 */
11
- disabled: boolean;
12
- /** 추론 활성화 값 */
13
- value: ThinkingValue;
14
- render(): import('lit-html').TemplateResult<1>;
15
- /** 현재 추론 상태에 따라 아이콘 이름을 반환합니다. */
16
- private getIconName;
17
- /** 현재 추론 상태를 변경합니다. */
18
- private changeValue;
19
- }
@@ -1,73 +0,0 @@
1
- import { html } from 'lit';
2
- import { property } from 'lit/decorators.js';
3
- import { BaseElement } from '@iyulab/components/dist/components/BaseElement.js';
4
- import { UIcon } from '@iyulab/components/dist/components/icon/UIcon.component.js';
5
- import { styles } from './UThinkButton.styles.js';
6
-
7
- var __defProp = Object.defineProperty;
8
- var __decorateClass = (decorators, target, key, kind) => {
9
- var result = void 0 ;
10
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
11
- if (decorator = decorators[i])
12
- result = (decorator(target, key, result) ) || result;
13
- if (result) __defProp(target, key, result);
14
- return result;
15
- };
16
- class UThinkButton extends BaseElement {
17
- constructor() {
18
- super(...arguments);
19
- this.states = ["none", "low", "medium", "high"];
20
- this.disabled = false;
21
- this.value = "none";
22
- }
23
- static {
24
- this.styles = [super.styles, styles];
25
- }
26
- static {
27
- this.dependencies = {
28
- "u-icon": UIcon
29
- };
30
- }
31
- render() {
32
- return html`
33
- <div class="container" @click="${this.changeValue}">
34
- <u-icon lib="internal" name=${this.getIconName()}></u-icon>
35
- <div class="indicators">
36
- <span></span>
37
- <span></span>
38
- <span></span>
39
- </div>
40
- </div>
41
- `;
42
- }
43
- /** 현재 추론 상태에 따라 아이콘 이름을 반환합니다. */
44
- getIconName() {
45
- switch (this.value) {
46
- case "low":
47
- return "lightbulb";
48
- case "medium":
49
- return "lightbulb";
50
- case "high":
51
- return "lightbulb-fill";
52
- default:
53
- return "lightbulb-off";
54
- }
55
- }
56
- /** 현재 추론 상태를 변경합니다. */
57
- changeValue() {
58
- if (this.disabled) return;
59
- this.value ||= "none";
60
- const currentIdx = this.states.indexOf(this.value);
61
- const nextIdx = (currentIdx + 1) % this.states.length;
62
- this.value = this.states[nextIdx];
63
- this.emit("change", this.value);
64
- }
65
- }
66
- __decorateClass([
67
- property({ type: Boolean, reflect: true })
68
- ], UThinkButton.prototype, "disabled");
69
- __decorateClass([
70
- property({ type: String, reflect: true })
71
- ], UThinkButton.prototype, "value");
72
-
73
- export { UThinkButton };
@@ -1,7 +0,0 @@
1
- import { UThinkButton } from './UThinkButton.component.js';
2
- declare global {
3
- interface HTMLElementTagNameMap {
4
- "u-think-button": UThinkButton;
5
- }
6
- }
7
- export { UThinkButton };
@@ -1,5 +0,0 @@
1
- import { UThinkButton } from './UThinkButton.component.js';
2
-
3
- UThinkButton.define("u-think-button");
4
-
5
- export { UThinkButton };
@@ -1,72 +0,0 @@
1
- import { css } from 'lit';
2
-
3
- const styles = css`
4
- :host {
5
- position: relative;
6
- padding: 8px;
7
- font-size: 16px;
8
- border-radius: 8px;
9
- cursor: pointer;
10
- user-select: none;
11
- }
12
- :host(:hover) {
13
- background-color: var(--u-neutral-100);
14
- }
15
- :host([disabled]) {
16
- opacity: 0.5;
17
- pointer-events: none;
18
- background-color: transparent;
19
- cursor: not-allowed;
20
- }
21
- /* u-icon 스타일 */
22
- :host([value="low"]) u-icon {
23
- filter: brightness(0.8);
24
- color: var(--u-yellow-700);
25
- }
26
- :host([value="medium"]) u-icon {
27
- color: var(--u-yellow-700);
28
- }
29
- :host([value="high"]) u-icon {
30
- color: var(--u-yellow-700);
31
- }
32
- /* indicators 스타일 */
33
- :host([value="low"]) .indicators > span:last-child {
34
- background-color: var(--u-yellow-700);
35
- }
36
- :host([value="medium"]) .indicators > span:nth-last-child(-n+2) {
37
- background-color: var(--u-yellow-700);
38
- }
39
- :host([value="high"]) .indicators > span {
40
- background-color: var(--u-yellow-700);
41
- }
42
-
43
- .container {
44
- display: flex;
45
- flex-direction: row;
46
- align-items: center;
47
- gap: 4px;
48
- }
49
-
50
- u-icon {
51
- font-size: inherit;
52
- color: #e0e0e0;
53
- transition: color 0.3s ease, filter 0.3s ease;
54
- }
55
-
56
- .indicators {
57
- height: 1em;
58
- display: flex;
59
- flex-direction: column;
60
- align-items: center;
61
- justify-content: space-between;
62
- }
63
- .indicators > span {
64
- width: 0.5em;
65
- height: 0.2em;
66
- border-radius: 2px;
67
- background-color: #e0e0e0;
68
- transition: background-color 0.3s ease;
69
- }
70
- `;
71
-
72
- export { styles };
@@ -1,7 +0,0 @@
1
- import { UJsonViewer } from './UJsonViewer.component.js';
2
- declare global {
3
- interface HTMLElementTagNameMap {
4
- 'u-json-viewer': UJsonViewer;
5
- }
6
- }
7
- export { UJsonViewer };
@@ -1,5 +0,0 @@
1
- import { UJsonViewer } from './UJsonViewer.component.js';
2
-
3
- UJsonViewer.define("u-json-viewer");
4
-
5
- export { UJsonViewer };
@@ -1,16 +0,0 @@
1
- export type JsonValue = string | number | boolean | null;
2
- export type JsonObject = {
3
- [x: string]: JsonNode;
4
- };
5
- export type JsonArray = Array<JsonNode>;
6
- export type JsonNode = JsonValue | JsonObject | JsonArray;
7
- /**
8
- * 이 컨버터는 JsonNode 타입을 사용하여 JSON 데이터를 처리합니다.
9
- * 문자열 어트리뷰트로 전달된 JSON 문자열을 객체로 변환/직렬화합니다.
10
- */
11
- export declare const jsonConverter: {
12
- fromAttribute: (value: string | null) => JsonNode;
13
- toAttribute: (value: JsonNode) => string;
14
- };
15
- export declare const isValueType: (value: JsonNode) => boolean;
16
- export declare const getNodeName: (value: JsonNode) => string;