@iyulab/chat-components 0.7.0 → 0.8.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.
- package/CHANGELOG.md +22 -0
- package/dist/_virtual/{_@oxc-project_runtime@0.138.0 → _@oxc-project_runtime@0.139.0}/helpers/esm/decorate.js +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.138.0 → _@oxc-project_runtime@0.139.0}/helpers/esm/decorateMetadata.js +1 -1
- package/dist/components/UDataElement.d.ts +4 -0
- package/dist/components/UDataElement.js +4 -0
- package/dist/components/blocks/UCodeBlock.js +2 -2
- package/dist/components/blocks/UElementBlock.js +2 -2
- package/dist/components/blocks/UFileBlock.js +2 -2
- package/dist/components/blocks/UMarkedBlock.js +3 -3
- package/dist/components/blocks/URefBlock.js +2 -2
- package/dist/components/blocks/UTableBlock.js +2 -2
- package/dist/components/blocks/UTextBlock.js +2 -2
- package/dist/components/message/UMessage.js +2 -2
- package/dist/components/prompt/UPrompt.js +2 -2
- package/dist/components/references/URefCard.d.ts +4 -3
- package/dist/components/references/URefCard.js +8 -6
- package/dist/components/references/URefCardGroup.js +2 -2
- package/dist/components/references/URefTag.js +2 -2
- package/dist/components-extra/UChartBlock.js +2 -2
- package/dist/components-extra/UImagesBlock.js +2 -2
- package/dist/components-extra/UMapBlock.js +2 -2
- package/dist/components-extra/UVideoBlock.js +2 -2
- package/dist/types/BlockItem.d.ts +1 -1
- package/dist/types/Schema.d.ts +10 -3
- package/dist/utilities/sanitizers.d.ts +0 -4
- package/dist/utilities/sanitizers.js +22 -4
- package/package.json +15 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.8.0] - 2026-07-19
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- **채팅 메시지의 이모지가 조용히 분해되던 결함 수정** — `stripZeroWidth` 가 보이지 않는 문자를 제거하면서 ZWJ(U+200D)까지 지웠다. ZWJ 는 이모지 시퀀스를 결합하는 조판 문자이므로, `UMarkedBlock` 이 메시지 본문에 이 함수를 적용할 때 가족·직업 이모지가 낱개로 쪼개졌다(👨👩👧 → 👨👩👧). 이제 표시 경로는 ZWJ 를 보존하고, URL 위생 경로(`escapeHtmlHref`)는 종전대로 ZWJ 까지 제거해 `java<ZWJ>script:` 형태의 protocol 우회를 계속 차단한다. 두 경로의 요구가 반대이므로 문자 집합을 분리했다. 회귀 테스트 7건 추가.
|
|
7
|
+
|
|
8
|
+
### Changed
|
|
9
|
+
- **이 패키지의 eslint 가 실제로 동작하기 시작했다.** `eslint.config.js` 의 두 결함 — (1) `files: ["src/**/*"]` 가 ESLint 9 에서 universal 패턴이라 `.ts` 를 opt-in 하지 못함, (2) 배열 프리셋(`tseslint.configs.recommended`)을 객체 스프레드해 프리셋이 무력화됨 — 을 수정했다. `build` 스크립트의 `eslint &&` 게이트는 매칭 파일이 0개라 항상 통과하고 있었다. 위 이모지 결함은 이 복구로 처음 드러났다.
|
|
10
|
+
- `npm run lint` / `npm run lint:fix` 스크립트 추가.
|
|
11
|
+
- **타입 정밀화(소비자 영향 가능)**: `BaseJsonSchema` 의 `default`/`enum`/`examples` 가 `any` → 새 `JsonValue` 타입으로, `FileBlockItem.data` 가 `any` → `unknown` 으로 좁혀졌다. 값을 그대로 사용하던 코드는 좁히기(narrowing)나 캐스팅이 필요할 수 있다.
|
|
12
|
+
- `UMarkedBlock`: 재할당 없는 `let` → `const`.
|
|
13
|
+
|
|
14
|
+
## [0.7.1] - 2026-07-12
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- `u-ref-card`: no longer logs a spurious `Missing <script type="application/json">` console error on every render when driven by property bindings (the pattern `u-ref-block` itself uses). `URefCard` now overrides `UDataElement.load()` to skip JSON loading gracefully when neither a `data` argument nor a `<script type="application/json">` child is present; the script-payload path (used by `u-marked-block` reference tooltips via `URefCard.buildHTML`) is unaffected. Cards always rendered correctly — the error was cosmetic console noise, but it fired once per reference card per message in downstream consoles. (Reported by the Filer project.)
|
|
19
|
+
- `URefCard`'s redundant `error()` override was removed — since 0.7.0 the `UDataElement` base logs to the console without rendering an error card, so the override duplicated base behavior. Genuine load errors now log as `failed to load data for [u-ref-card]` instead of `Error in URefCard:`.
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- Browser-mode regression tests (vitest + playwright, matching the `@iyulab/components` test setup) covering both `u-ref-card` data paths and the `u-ref-block` sources rendering acceptance criteria.
|
|
24
|
+
|
|
3
25
|
## [0.7.0] - 2026-07-07
|
|
4
26
|
|
|
5
27
|
### Changed
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region \0@oxc-project+runtime@0.
|
|
1
|
+
//#region \0@oxc-project+runtime@0.139.0/helpers/esm/decorate.js
|
|
2
2
|
function __decorate(decorators, target, key, desc) {
|
|
3
3
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
4
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region \0@oxc-project+runtime@0.
|
|
1
|
+
//#region \0@oxc-project+runtime@0.139.0/helpers/esm/decorateMetadata.js
|
|
2
2
|
function __decorateMetadata(k, v) {
|
|
3
3
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
4
4
|
}
|
|
@@ -11,6 +11,10 @@ import { UElement } from '@iyulab/components/dist/components/UElement.js';
|
|
|
11
11
|
* ```
|
|
12
12
|
*
|
|
13
13
|
* JSON 최상위 키가 컴포넌트의 프로퍼티 이름과 일치하면 자동으로 할당됩니다.
|
|
14
|
+
*
|
|
15
|
+
* script 페이로드 없이 property 바인딩만으로도 사용되는 서브클래스는
|
|
16
|
+
* `load()`를 오버라이드해 script 부재 시 조용히 건너뛰어야 합니다.
|
|
17
|
+
* (예: `URefCard` — URefBlock의 property 구동과 UMarkedBlock의 script 주입을 모두 지원)
|
|
14
18
|
*/
|
|
15
19
|
export declare class UDataElement extends UElement {
|
|
16
20
|
static styles: import('lit').CSSResultGroup;
|
|
@@ -13,6 +13,10 @@ import { UElement } from "@iyulab/components/dist/components/UElement.js";
|
|
|
13
13
|
* ```
|
|
14
14
|
*
|
|
15
15
|
* JSON 최상위 키가 컴포넌트의 프로퍼티 이름과 일치하면 자동으로 할당됩니다.
|
|
16
|
+
*
|
|
17
|
+
* script 페이로드 없이 property 바인딩만으로도 사용되는 서브클래스는
|
|
18
|
+
* `load()`를 오버라이드해 script 부재 시 조용히 건너뛰어야 합니다.
|
|
19
|
+
* (예: `URefCard` — URefBlock의 property 구동과 UMarkedBlock의 script 주입을 모두 지원)
|
|
16
20
|
*/
|
|
17
21
|
var UDataElement = class extends UElement {
|
|
18
22
|
static {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../../utilities/icons.js";
|
|
2
2
|
import { styles } from "./UCodeBlock.styles.js";
|
|
3
|
-
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.
|
|
4
|
-
import __decorate from "../../_virtual/_@oxc-project_runtime@0.
|
|
3
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorateMetadata.js";
|
|
4
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorate.js";
|
|
5
5
|
import { html } from "lit";
|
|
6
6
|
import { customElement, property } from "lit/decorators.js";
|
|
7
7
|
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
-
import __decorate from "../../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorateMetadata.js";
|
|
2
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorate.js";
|
|
3
3
|
import { UDataElement } from "../UDataElement.js";
|
|
4
4
|
import { styles } from "./UElementBlock.styles.js";
|
|
5
5
|
import { html, nothing } from "lit";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../../utilities/icons.js";
|
|
2
|
-
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.
|
|
3
|
-
import __decorate from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorateMetadata.js";
|
|
3
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorate.js";
|
|
4
4
|
import { styles } from "./UFileBlock.styles.js";
|
|
5
5
|
import { html, nothing } from "lit";
|
|
6
6
|
import { customElement, property, state } from "lit/decorators.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
-
import __decorate from "../../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorateMetadata.js";
|
|
2
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorate.js";
|
|
3
3
|
import "./UCodeBlock.js";
|
|
4
4
|
import { escapeHtmlText, stripZeroWidth } from "../../utilities/sanitizers.js";
|
|
5
5
|
import { HtmlBuilder } from "../../utilities/HtmlBuilder.js";
|
|
@@ -68,7 +68,7 @@ var UMarkedBlock = class UMarkedBlock extends UElement {
|
|
|
68
68
|
this.placeholder.reset();
|
|
69
69
|
value = stripZeroWidth(value);
|
|
70
70
|
if (this.refs?.length) value = this.insertRefs(value, this.refs);
|
|
71
|
-
|
|
71
|
+
const html = this.parser.parse(value, { async: false });
|
|
72
72
|
return unsafeHTML(this.placeholder.restore(html));
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
-
import __decorate from "../../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorateMetadata.js";
|
|
2
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorate.js";
|
|
3
3
|
import "../references/URefCard.js";
|
|
4
4
|
import { styles } from "./URefBlock.styles.js";
|
|
5
5
|
import { html } from "lit";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../../utilities/icons.js";
|
|
2
|
-
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.
|
|
3
|
-
import __decorate from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorateMetadata.js";
|
|
3
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorate.js";
|
|
4
4
|
import { UDataElement } from "../UDataElement.js";
|
|
5
5
|
import { styles } from "./UTableBlock.styles.js";
|
|
6
6
|
import { html } from "lit";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
-
import __decorate from "../../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorateMetadata.js";
|
|
2
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorate.js";
|
|
3
3
|
import { styles } from "./UTextBlock.styles.js";
|
|
4
4
|
import { html } from "lit";
|
|
5
5
|
import { customElement, property, query } from "lit/decorators.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
-
import __decorate from "../../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorateMetadata.js";
|
|
2
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorate.js";
|
|
3
3
|
import { styles } from "./UMessage.styles.js";
|
|
4
4
|
import { html } from "lit";
|
|
5
5
|
import { customElement, property } from "lit/decorators.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../../utilities/icons.js";
|
|
2
|
-
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.
|
|
3
|
-
import __decorate from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorateMetadata.js";
|
|
3
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorate.js";
|
|
4
4
|
import "../blocks/UFileBlock.js";
|
|
5
5
|
import { styles } from "./UPrompt.styles.js";
|
|
6
6
|
import { html } from "lit";
|
|
@@ -17,10 +17,11 @@ export declare class URefCard extends UDataElement {
|
|
|
17
17
|
tags?: string[];
|
|
18
18
|
render(): import('lit-html').TemplateResult<1>;
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
20
|
+
* script-payload(UMarkedBlock 툴팁)와 property 바인딩(URefBlock) 두 사용
|
|
21
|
+
* 패턴을 모두 지원합니다. script 자식이 없으면 property 기반 렌더로
|
|
22
|
+
* 간주하고 조용히 건너뜁니다.
|
|
22
23
|
*/
|
|
23
|
-
protected
|
|
24
|
+
protected load(data?: object): Promise<void>;
|
|
24
25
|
/** 링크 클릭 핸들러 */
|
|
25
26
|
private handleAnchorClick;
|
|
26
27
|
/** URL에서 Google의 파비콘 URL을 반환합니다. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../../utilities/icons.js";
|
|
2
|
-
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.
|
|
3
|
-
import __decorate from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorateMetadata.js";
|
|
3
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorate.js";
|
|
4
4
|
import { UDataElement } from "../UDataElement.js";
|
|
5
5
|
import { styles } from "./URefCard.styles.js";
|
|
6
6
|
import { html } from "lit";
|
|
@@ -53,11 +53,13 @@ var URefCard = class URefCard extends UDataElement {
|
|
|
53
53
|
`;
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
56
|
+
* script-payload(UMarkedBlock 툴팁)와 property 바인딩(URefBlock) 두 사용
|
|
57
|
+
* 패턴을 모두 지원합니다. script 자식이 없으면 property 기반 렌더로
|
|
58
|
+
* 간주하고 조용히 건너뜁니다.
|
|
58
59
|
*/
|
|
59
|
-
|
|
60
|
-
|
|
60
|
+
async load(data) {
|
|
61
|
+
if (!data && !this.querySelector("script[type=\"application/json\"]")) return;
|
|
62
|
+
return super.load(data);
|
|
61
63
|
}
|
|
62
64
|
/** 링크 클릭 핸들러 */
|
|
63
65
|
handleAnchorClick(e) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
-
import __decorate from "../../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorateMetadata.js";
|
|
2
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorate.js";
|
|
3
3
|
import { URefCard } from "./URefCard.js";
|
|
4
4
|
import { styles } from "./URefCardGroup.styles.js";
|
|
5
5
|
import { html } from "lit";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../../utilities/icons.js";
|
|
2
|
-
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.
|
|
3
|
-
import __decorate from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorateMetadata.js";
|
|
3
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorate.js";
|
|
4
4
|
import { styles } from "./URefTag.styles.js";
|
|
5
5
|
import { html } from "lit";
|
|
6
6
|
import { customElement, property } from "lit/decorators.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../utilities/icons.js";
|
|
2
|
-
import __decorateMetadata from "../_virtual/_@oxc-project_runtime@0.
|
|
3
|
-
import __decorate from "../_virtual/_@oxc-project_runtime@0.
|
|
2
|
+
import __decorateMetadata from "../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorateMetadata.js";
|
|
3
|
+
import __decorate from "../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorate.js";
|
|
4
4
|
import { styles } from "./UChartBlock.styles.js";
|
|
5
5
|
import { html, nothing } from "lit";
|
|
6
6
|
import { customElement, property, query, state } from "lit/decorators.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import __decorateMetadata from "../_virtual/_@oxc-project_runtime@0.
|
|
2
|
-
import __decorate from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import __decorateMetadata from "../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorateMetadata.js";
|
|
2
|
+
import __decorate from "../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorate.js";
|
|
3
3
|
import { styles } from "./UImagesBlock.styles.js";
|
|
4
4
|
import { html, nothing } from "lit";
|
|
5
5
|
import { customElement, property, state } from "lit/decorators.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import __decorateMetadata from "../_virtual/_@oxc-project_runtime@0.
|
|
2
|
-
import __decorate from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import __decorateMetadata from "../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorateMetadata.js";
|
|
2
|
+
import __decorate from "../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorate.js";
|
|
3
3
|
import { styles } from "./UMapBlock.styles.js";
|
|
4
4
|
import { html, nothing } from "lit";
|
|
5
5
|
import { customElement, property } from "lit/decorators.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import __decorateMetadata from "../_virtual/_@oxc-project_runtime@0.
|
|
2
|
-
import __decorate from "../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import __decorateMetadata from "../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorateMetadata.js";
|
|
2
|
+
import __decorate from "../_virtual/_@oxc-project_runtime@0.139.0/helpers/esm/decorate.js";
|
|
3
3
|
import { styles } from "./UVideoBlock.styles.js";
|
|
4
4
|
import { html, nothing } from "lit";
|
|
5
5
|
import { customElement, property } from "lit/decorators.js";
|
package/dist/types/Schema.d.ts
CHANGED
|
@@ -11,15 +11,22 @@
|
|
|
11
11
|
* - 조건부 스키마 if/then/else (위젯 속성에 불필요)
|
|
12
12
|
* - 고급 object/array 검증들 (단순한 구조만으로 충분)
|
|
13
13
|
*/
|
|
14
|
+
/**
|
|
15
|
+
* JSON 으로 표현 가능한 임의의 값.
|
|
16
|
+
* 스키마의 default/enum/examples 는 임의 JSON 을 담으므로 `any` 대신 이 타입을 쓴다.
|
|
17
|
+
*/
|
|
18
|
+
export type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
19
|
+
[key: string]: JsonValue;
|
|
20
|
+
};
|
|
14
21
|
export interface BaseJsonSchema {
|
|
15
22
|
/** 속성에 대한 설명 (LLM용) */
|
|
16
23
|
description?: string;
|
|
17
24
|
/** 기본값 */
|
|
18
|
-
default?:
|
|
25
|
+
default?: JsonValue;
|
|
19
26
|
/** 허용 가능한 값들 (제한된 선택지) */
|
|
20
|
-
enum?:
|
|
27
|
+
enum?: JsonValue[];
|
|
21
28
|
/** 예시 값들 (LLM이 이해하기 쉽도록) */
|
|
22
|
-
examples?:
|
|
29
|
+
examples?: JsonValue[];
|
|
23
30
|
}
|
|
24
31
|
export interface BooleanJsonSchema extends BaseJsonSchema {
|
|
25
32
|
type: 'boolean';
|
|
@@ -7,10 +7,6 @@
|
|
|
7
7
|
* - escapeHtmlAttr : HTML attribute 값에 삽입할 때
|
|
8
8
|
* - escapeHtmlHref : href/src 같은 URL attribute에 삽입할 때
|
|
9
9
|
*/
|
|
10
|
-
/**
|
|
11
|
-
* Zero Width Space / LTR / RTL mark / BOM 등
|
|
12
|
-
* 화면에 표시되지 않는 유니코드 문자를 제거합니다.
|
|
13
|
-
*/
|
|
14
10
|
export declare function stripZeroWidth(value: string): string;
|
|
15
11
|
/**
|
|
16
12
|
* HTML 텍스트 노드(context)에 삽입할 문자열을 escape합니다.
|
|
@@ -12,9 +12,24 @@
|
|
|
12
12
|
* Zero Width Space / LTR / RTL mark / BOM 등
|
|
13
13
|
* 화면에 표시되지 않는 유니코드 문자를 제거합니다.
|
|
14
14
|
*/
|
|
15
|
+
/**
|
|
16
|
+
* \uD45C\uC2DC \uACBD\uB85C\uC5D0\uC11C \uC81C\uAC70\uD560 zero-width \uBB38\uC790.
|
|
17
|
+
*
|
|
18
|
+
* ZWJ(U+200D)\uB294 **\uC758\uB3C4\uC801\uC73C\uB85C \uC81C\uC678**\uD55C\uB2E4. ZWJ \uB294 \uC774\uBAA8\uC9C0 \uC2DC\uD000\uC2A4\uB97C \uACB0\uD569\uD558\uB294
|
|
19
|
+
* \uC870\uD310 \uBB38\uC790\uB77C, \uC81C\uAC70\uD558\uBA74 \uC0AC\uC6A9\uC790\uAC00 \uC785\uB825\uD55C \uAC00\uC871\u00B7\uC9C1\uC5C5 \uC774\uBAA8\uC9C0\uAC00 \uB0B1\uAC1C\uB85C \uBD84\uD574\uB41C\uB2E4
|
|
20
|
+
* (\uD83D\uDC68\u200D\uD83D\uDC69\u200D\uD83D\uDC67 \u2192 \uD83D\uDC68\uD83D\uDC69\uD83D\uDC67). \uD45C\uC2DC \uACBD\uB85C\uC5D0\uC11C\uB294 \uCF58\uD150\uCE20 \uBCF4\uC874\uC774 \uC6B0\uC120\uC774\uB2E4.
|
|
21
|
+
*/
|
|
22
|
+
var ZERO_WIDTH_DISPLAY_REGEX = /[\u200B\u200C\u200E\u200F\uFEFF]/gu;
|
|
23
|
+
/**
|
|
24
|
+
* URL \uC704\uC0DD \uACBD\uB85C\uC5D0\uC11C \uC81C\uAC70\uD560 zero-width \uBB38\uC790.
|
|
25
|
+
*
|
|
26
|
+
* URL \uC548\uC5D0\uC11C\uB294 zero-width \uBB38\uC790\uC5D0 \uC815\uB2F9\uD55C \uC870\uD310 \uC758\uBBF8\uAC00 \uC5C6\uACE0 protocol \uC6B0\uD68C
|
|
27
|
+
* \uB09C\uB3C5\uD654\uC5D0 \uC4F0\uC77C \uC218 \uC788\uC73C\uBBC0\uB85C ZWJ \uAE4C\uC9C0 \uC804\uBD80 \uC81C\uAC70\uD55C\uB2E4 \u2014 \uACB0\uD569 \uC2DC\uD000\uC2A4 \uD574\uCCB4\uAC00
|
|
28
|
+
* \uC5EC\uAE30\uC11C\uB294 \uC758\uB3C4\uB41C \uB3D9\uC791\uC774\uBBC0\uB85C \uADDC\uCE59\uC744 \uBA85\uC2DC\uC801\uC73C\uB85C \uD574\uC81C\uD55C\uB2E4.
|
|
29
|
+
*/
|
|
30
|
+
var ZERO_WIDTH_STRICT_REGEX = /[\u200B\u200C\u200D\u200E\u200F\uFEFF]/gu;
|
|
15
31
|
function stripZeroWidth(value) {
|
|
16
|
-
|
|
17
|
-
return ZERO_WIDTH_REGEX.test(value) ? value.replace(ZERO_WIDTH_REGEX, "") : value;
|
|
32
|
+
return ZERO_WIDTH_DISPLAY_REGEX.test(value) ? value.replace(ZERO_WIDTH_DISPLAY_REGEX, "") : value;
|
|
18
33
|
}
|
|
19
34
|
/** HTML text context escape 대상 문자 */
|
|
20
35
|
var HTML_TEXT_ESCAPE_REGEX = /[&<>"']/g;
|
|
@@ -53,7 +68,10 @@ var HTML_ATTR_ESCAPE_MAP = {
|
|
|
53
68
|
function escapeHtmlAttr(value) {
|
|
54
69
|
return HTML_ATTR_ESCAPE_REGEX.test(value) ? value.replace(HTML_ATTR_ESCAPE_REGEX, (ch) => HTML_ATTR_ESCAPE_MAP[ch]) : value;
|
|
55
70
|
}
|
|
56
|
-
/**
|
|
71
|
+
/**
|
|
72
|
+
* protocol 우회 공격 방지를 위한 공백/제어문자 제거.
|
|
73
|
+
* 제어문자 매칭이 이 상수의 목적 자체이므로 no-control-regex 를 의도적으로 해제한다.
|
|
74
|
+
*/
|
|
57
75
|
var HREF_STRIP_CHARS_REGEX = /[\u0000-\u001F\u007F\s]+/g;
|
|
58
76
|
/** href/src에서 차단해야 하는 위험 protocol */
|
|
59
77
|
var HREF_UNSAFE_PROTOCOL_REGEX = /^(?:javascript|data|vbscript):/i;
|
|
@@ -64,7 +82,7 @@ var HREF_UNSAFE_PROTOCOL_REGEX = /^(?:javascript|data|vbscript):/i;
|
|
|
64
82
|
* <a href="{value}">
|
|
65
83
|
*/
|
|
66
84
|
function escapeHtmlHref(value) {
|
|
67
|
-
let normalized =
|
|
85
|
+
let normalized = value.replace(ZERO_WIDTH_STRICT_REGEX, "").trim();
|
|
68
86
|
if (HREF_STRIP_CHARS_REGEX.test(normalized)) normalized = normalized.replace(HREF_STRIP_CHARS_REGEX, "");
|
|
69
87
|
normalized = normalized.replace(/\\/g, "/");
|
|
70
88
|
if (normalized.startsWith("//")) return "#";
|
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.
|
|
4
|
+
"version": "0.8.0",
|
|
5
5
|
"author": "iyulab",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"keywords": [
|
|
@@ -38,14 +38,18 @@
|
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"start": "vite",
|
|
41
|
-
"build": "eslint && vite build"
|
|
41
|
+
"build": "eslint && vite build",
|
|
42
|
+
"test": "vitest run",
|
|
43
|
+
"test:watch": "vitest",
|
|
44
|
+
"lint": "eslint src/",
|
|
45
|
+
"lint:fix": "eslint src/ --fix"
|
|
42
46
|
},
|
|
43
47
|
"dependencies": {
|
|
44
|
-
"@iyulab/components": "^1.5.
|
|
48
|
+
"@iyulab/components": "^1.5.1",
|
|
45
49
|
"highlight.js": "^11.11.1",
|
|
46
50
|
"katex": "^0.17.0",
|
|
47
51
|
"lit": "^3.3.3",
|
|
48
|
-
"marked": "^18.0.
|
|
52
|
+
"marked": "^18.0.6",
|
|
49
53
|
"marked-katex-extension": "^5.1.10"
|
|
50
54
|
},
|
|
51
55
|
"peerDependencies": {
|
|
@@ -66,16 +70,18 @@
|
|
|
66
70
|
},
|
|
67
71
|
"devDependencies": {
|
|
68
72
|
"@eslint/js": "^9.39.4",
|
|
69
|
-
"@types/node": "^26.1.
|
|
73
|
+
"@types/node": "^26.1.1",
|
|
74
|
+
"@vitest/browser-playwright": "^4.1.10",
|
|
70
75
|
"chart.js": "^4.5.1",
|
|
71
76
|
"eslint": "^9.39.4",
|
|
72
77
|
"eslint-plugin-lit": "^2.3.1",
|
|
73
78
|
"glob": "^13.0.6",
|
|
74
79
|
"globals": "^17.7.0",
|
|
75
|
-
"openai": "^6.
|
|
80
|
+
"openai": "^6.47.0",
|
|
76
81
|
"typescript": "^5.9.3",
|
|
77
|
-
"typescript-eslint": "^8.
|
|
78
|
-
"vite": "^8.1.
|
|
79
|
-
"vite-plugin-dts": "^5.0.3"
|
|
82
|
+
"typescript-eslint": "^8.64.0",
|
|
83
|
+
"vite": "^8.1.4",
|
|
84
|
+
"vite-plugin-dts": "^5.0.3",
|
|
85
|
+
"vitest": "^4.1.10"
|
|
80
86
|
}
|
|
81
87
|
}
|