@iyulab/components 2.2.2 → 2.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.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.3.0] - 2026-10-06
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **`Dialog.alert` and `Dialog.confirm` render a string `message` as text**, like `Dialog.prompt` always did. They passed
|
|
8
|
+
it to `show({ content })`, whose string `content` is HTML, so a confirmation that included user input (an item's
|
|
9
|
+
name) could inject markup — `<img src=x onerror=…>` ran. Nothing documented HTML in these messages; if you relied on
|
|
10
|
+
it, pass a `TemplateResult` (below) or use `Dialog.show({ content })`, which keeps its HTML-string contract.
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `Dialog.alert` / `Dialog.confirm` accept `string | TemplateResult` — formatting goes through a Lit template, whose
|
|
15
|
+
interpolated values stay text.
|
|
16
|
+
|
|
3
17
|
## [2.2.2] - 2026-10-06
|
|
4
18
|
|
|
5
19
|
### Documentation
|
|
@@ -68,13 +68,16 @@ export declare class Dialog {
|
|
|
68
68
|
private constructor();
|
|
69
69
|
/**
|
|
70
70
|
* 알림 다이얼로그를 표시합니다.
|
|
71
|
+
* @param message 본문 — **문자열은 글자로** 그린다(사용자 입력을 넣어도 마크업이 되지 않는다). 서식이 필요하면
|
|
72
|
+
* `TemplateResult`(`html\`…\``)를 넘긴다. HTML 문자열은 그것을 명시한 `show({ content })` 로만.
|
|
71
73
|
*/
|
|
72
|
-
static alert(message: string, options?: DialogOptions): Promise<void>;
|
|
74
|
+
static alert(message: string | TemplateResult, options?: DialogOptions): Promise<void>;
|
|
73
75
|
/**
|
|
74
76
|
* 확인 다이얼로그를 표시합니다. (확인/취소 버튼)
|
|
77
|
+
* @param message 본문 — **문자열은 글자로** 그린다(`alert` 와 같다). 서식은 `TemplateResult` 로.
|
|
75
78
|
* @returns 확인이면 true, 취소이면 false
|
|
76
79
|
*/
|
|
77
|
-
static confirm(message: string, options?: ConfirmDialogOptions): Promise<boolean>;
|
|
80
|
+
static confirm(message: string | TemplateResult, options?: ConfirmDialogOptions): Promise<boolean>;
|
|
78
81
|
/**
|
|
79
82
|
* 입력 다이얼로그를 표시합니다. (텍스트 입력 + 확인/취소)
|
|
80
83
|
* @returns 입력값 또는 취소 시 null
|
package/dist/utilities/Dialog.js
CHANGED
|
@@ -8,6 +8,13 @@ import { ifDefined } from "lit/directives/if-defined.js";
|
|
|
8
8
|
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
9
9
|
//#region src/utilities/Dialog.ts
|
|
10
10
|
/**
|
|
11
|
+
* 메시지를 본문 템플릿으로 — 문자열은 lit 이 글자로 이스케이프한다. `show` 는 문자열 `content` 를 HTML 로 해석하므로
|
|
12
|
+
* (그것이 `show` 의 계약이다) `alert`·`confirm` 이 문자열을 그대로 넘기면 그 계약을 조용히 물려받아 마크업 주입 싱크가 된다.
|
|
13
|
+
*/
|
|
14
|
+
function asText(message) {
|
|
15
|
+
return html`${message}`;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
11
18
|
* Dialog 유틸리티 클래스입니다.
|
|
12
19
|
* 프로그래밍 방식으로 alert, confirm, prompt 다이얼로그를 표시합니다.
|
|
13
20
|
*/
|
|
@@ -16,21 +23,24 @@ var Dialog = class {
|
|
|
16
23
|
constructor() {}
|
|
17
24
|
/**
|
|
18
25
|
* 알림 다이얼로그를 표시합니다.
|
|
26
|
+
* @param message 본문 — **문자열은 글자로** 그린다(사용자 입력을 넣어도 마크업이 되지 않는다). 서식이 필요하면
|
|
27
|
+
* `TemplateResult`(`html\`…\``)를 넘긴다. HTML 문자열은 그것을 명시한 `show({ content })` 로만.
|
|
19
28
|
*/
|
|
20
29
|
static async alert(message, options) {
|
|
21
30
|
await this.show({
|
|
22
31
|
...options,
|
|
23
|
-
content: message
|
|
32
|
+
content: asText(message)
|
|
24
33
|
});
|
|
25
34
|
}
|
|
26
35
|
/**
|
|
27
36
|
* 확인 다이얼로그를 표시합니다. (확인/취소 버튼)
|
|
37
|
+
* @param message 본문 — **문자열은 글자로** 그린다(`alert` 와 같다). 서식은 `TemplateResult` 로.
|
|
28
38
|
* @returns 확인이면 true, 취소이면 false
|
|
29
39
|
*/
|
|
30
40
|
static async confirm(message, options) {
|
|
31
41
|
return await this.show({
|
|
32
42
|
...options,
|
|
33
|
-
content: message,
|
|
43
|
+
content: asText(message),
|
|
34
44
|
actions: [{
|
|
35
45
|
label: options?.cancelLabel || Locale.getValue("cancel"),
|
|
36
46
|
value: "cancel",
|
package/package.json
CHANGED
|
@@ -45,6 +45,11 @@ const result = await Dialog.show({
|
|
|
45
45
|
| `Dialog.prompt(message, options?)` | `Promise<string \| null>` | Text input dialog |
|
|
46
46
|
| `Dialog.show(options)` | `Promise<string \| null>` | Custom dialog; resolves with clicked action `value` |
|
|
47
47
|
|
|
48
|
+
`message` is **text**: a string is rendered as text in `alert`, `confirm` and `prompt`, so a user-supplied name in a
|
|
49
|
+
confirmation cannot inject markup. For formatting pass a Lit `TemplateResult`
|
|
50
|
+
(`Dialog.confirm(html\`Delete <strong>${name}</strong>?\`)` — interpolated values stay text). Only
|
|
51
|
+
`Dialog.show({ content })` takes an HTML string, and says so.
|
|
52
|
+
|
|
48
53
|
## Types
|
|
49
54
|
|
|
50
55
|
```ts
|