@iyulab/chat-components 0.15.0 → 0.16.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,25 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.16.0] - 2026-09-30
4
+
5
+ ### Added
6
+
7
+ - **`u-video-block` takes subtitle / caption tracks** — `tracks: VideoTrack[]`
8
+ (`{ src, kind?, srclang?, label?, default? }`, WebVTT) for a direct video file. The `<video>` is
9
+ drawn inside the shadow tree, so an app had no way to add a `<track>`. Also in the block schema, so
10
+ block JSON can carry them. YouTube and Vimeo keep their own player's captions.
11
+
12
+ ### Fixed
13
+
14
+ - **Links that open a new tab now say so to screen readers.** `u-ref-tag`, `u-ref-card` and the
15
+ `u-map-block` caption open in a new tab; their accessible name now ends with a localized
16
+ "(opens in a new tab)" (`opensInNewTab` in the message registry). The text is visually hidden —
17
+ the external-link icon already shows it on screen.
18
+
19
+ ### Documentation
20
+
21
+ - README: the Accessibility section links the KWCAG 2.2 table in `@iyulab/components`.
22
+
3
23
  ## [0.15.0] - 2026-09-30
4
24
 
5
25
  ### Changed
package/README.md CHANGED
@@ -121,6 +121,7 @@ conformance claim for the success criteria it does not list.
121
121
  |---|---|---|
122
122
  | SC 2.5.8 Target Size (Minimum) | Every pointer target inside the registered blocks (`.` and `./extra` entries) is at least 24×24 CSS px or meets the spacing exception (24px between centers), and is actually hit at that position | `tests/browser/target-size.browser.test.ts` (real Chromium) |
123
123
  | SC 2.1.1 Keyboard (pointer-cursor check) | Nothing a block renders shows a pointer cursor without being an interactive element — table sort headers, image thumbnails and previewable file cards are buttons | `tests/browser/target-size.browser.test.ts` · `tests/browser/table-block-sort-keyboard.browser.test.ts` |
124
+ | SC 3.2.5 Change on Request (new tabs) | Links that open a new tab — `u-ref-tag`, `u-ref-card`, the `u-map-block` caption — end their accessible name with a localized "(opens in a new tab)" | `tests/browser/new-tab-link-name.browser.test.ts` |
124
125
 
125
126
  `u-ref-tag` uses the SC's **inline exception** — it is a citation badge set inside a sentence, where
126
127
  growing it to 24px would push the line height. It is still measured and reported.
@@ -128,6 +129,8 @@ growing it to 24px would push the line height. It is still measured and reported
128
129
  Color contrast comes from the `@iyulab/components` tokens this package renders with — see that
129
130
  package's Accessibility section.
130
131
 
132
+ For **KWCAG 2.2** (the Korean web accessibility standard), the `@iyulab/components` README has a table of all 33 check items — which are guaranteed by a test across the sibling packages, which are shared with the app, and which do not apply: [KWCAG 2.2 대응표](https://github.com/iyulab/node-components#kwcag-22-대응표).
133
+
131
134
  ## Documentation
132
135
 
133
136
  | File | Description |
@@ -3,6 +3,7 @@ import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.151.0/hel
3
3
  import __decorate from "../../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/decorate.js";
4
4
  import { sanitizeHref } from "../../utilities/sanitizers.js";
5
5
  import { UDataElement } from "../UDataElement.js";
6
+ import { messages } from "../../utilities/messages.js";
6
7
  import { styles } from "./URefCard.styles.js";
7
8
  import { html, nothing } from "lit";
8
9
  import { customElement, property } from "lit/decorators.js";
@@ -64,6 +65,7 @@ var URefCard = class URefCard extends UDataElement {
64
65
  <div class="footer" ?hidden=${!this.tags || this.tags.length === 0}>
65
66
  ${this.tags?.map((tag) => html`<span class="tag">${tag}</span>`)}
66
67
  </div>
68
+ <span class="new-tab-hint">${messages.text("opensInNewTab")}</span>
67
69
  </a>
68
70
  `;
69
71
  }
@@ -98,6 +98,18 @@ var styles = css`
98
98
  border-radius: 4px;
99
99
  white-space: nowrap;
100
100
  }
101
+ /* 새 창 알림 — 화면에는 없고 접근성 이름에만 붙는다(KWCAG 7.2.1). */
102
+ .new-tab-hint {
103
+ position: absolute;
104
+ width: 1px;
105
+ height: 1px;
106
+ margin: -1px;
107
+ padding: 0;
108
+ overflow: hidden;
109
+ clip-path: inset(50%);
110
+ white-space: nowrap;
111
+ border: 0;
112
+ }
101
113
  `;
102
114
  //#endregion
103
115
  export { styles };
@@ -2,6 +2,7 @@ import "../../utilities/icons.js";
2
2
  import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/decorateMetadata.js";
3
3
  import __decorate from "../../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/decorate.js";
4
4
  import { sanitizeHref } from "../../utilities/sanitizers.js";
5
+ import { messages } from "../../utilities/messages.js";
5
6
  import { styles } from "./URefTag.styles.js";
6
7
  import { html } from "lit";
7
8
  import { customElement, property } from "lit/decorators.js";
@@ -19,6 +20,7 @@ var URefTag = class URefTag extends UElement {
19
20
  <a href="${ifDefined(this.href ? sanitizeHref(this.href) : void 0)}" target="_blank" rel="noopener noreferrer"
20
21
  @click=${this.handleAnchorClick}>
21
22
  <slot></slot>
23
+ <span class="new-tab-hint">${messages.text("opensInNewTab")}</span>
22
24
  </a>
23
25
 
24
26
  <u-icon lib="internal-chat" name="external-link"></u-icon>
@@ -46,6 +46,18 @@ var styles = css`
46
46
  u-tooltip[visible] {
47
47
  opacity: 1;
48
48
  }
49
+ /* 새 창 알림 — 화면에는 없고 접근성 이름에만 붙는다(KWCAG 7.2.1). */
50
+ .new-tab-hint {
51
+ position: absolute;
52
+ width: 1px;
53
+ height: 1px;
54
+ margin: -1px;
55
+ padding: 0;
56
+ overflow: hidden;
57
+ clip-path: inset(50%);
58
+ white-space: nowrap;
59
+ border: 0;
60
+ }
49
61
  `;
50
62
  //#endregion
51
63
  export { styles };
@@ -1,6 +1,7 @@
1
1
  import __decorateMetadata from "../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/decorateMetadata.js";
2
2
  import __decorate from "../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/decorate.js";
3
3
  import { registerElementBlock } from "../utilities/ElementRegistry.js";
4
+ import { messages } from "../utilities/messages.js";
4
5
  import { styles } from "./UMapBlock.styles.js";
5
6
  import schema from "./UMapBlock.schema.js";
6
7
  import { html, nothing } from "lit";
@@ -34,6 +35,7 @@ var UMapBlock = class UMapBlock extends UElement {
34
35
  >
35
36
  <strong>${this.label}</strong>
36
37
  <span>${this.description}</span>
38
+ <span class="new-tab-hint">${messages.text("opensInNewTab")}</span>
37
39
  </a>
38
40
  `;
39
41
  }
@@ -52,6 +52,18 @@ var styles = css`
52
52
  font-size: 0.7em;
53
53
  opacity: 0.8;
54
54
  }
55
+ /* 새 창 알림 — 화면에는 없고 접근성 이름에만 붙는다(KWCAG 7.2.1). */
56
+ .new-tab-hint {
57
+ position: absolute;
58
+ width: 1px;
59
+ height: 1px;
60
+ margin: -1px;
61
+ padding: 0;
62
+ overflow: hidden;
63
+ clip-path: inset(50%);
64
+ white-space: nowrap;
65
+ border: 0;
66
+ }
55
67
  `;
56
68
  //#endregion
57
69
  export { styles };
@@ -1,5 +1,14 @@
1
1
  import { nothing, PropertyValues } from 'lit';
2
2
  import { UElement } from '@iyulab/components/dist/components/UElement.js';
3
+ /** 자막·캡션 트랙(WebVTT) 하나. */
4
+ export interface VideoTrack {
5
+ src: string;
6
+ /** 기본 `subtitles` */
7
+ kind?: 'subtitles' | 'captions' | 'descriptions' | 'chapters' | 'metadata';
8
+ srclang?: string;
9
+ label?: string;
10
+ default?: boolean;
11
+ }
3
12
  /**
4
13
  * 비디오 플레이어 블록 컴포넌트
5
14
  */
@@ -11,6 +20,11 @@ export declare class UVideoBlock extends UElement {
11
20
  poster?: string;
12
21
  /** 비디오 비율 */
13
22
  ratio: '16:9' | '4:3' | '1:1';
23
+ /**
24
+ * 직접 파일 영상의 자막·캡션 트랙(WebVTT). 영상이 섀도 안에 그려지므로 앱이 `<track>` 을
25
+ * 넣을 수 없다 — 이 속성이 유일한 자리다. YouTube·Vimeo 는 그 플레이어가 자막을 다룬다.
26
+ */
27
+ tracks: VideoTrack[];
14
28
  protected updated(changedProperties: PropertyValues): void;
15
29
  render(): typeof nothing | import('lit-html').TemplateResult<1>;
16
30
  private isYouTube;
@@ -1,5 +1,6 @@
1
1
  import __decorateMetadata from "../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/decorateMetadata.js";
2
2
  import __decorate from "../_virtual/_@oxc-project_runtime@0.151.0/helpers/esm/decorate.js";
3
+ import { sanitizeHref } from "../utilities/sanitizers.js";
3
4
  import { registerElementBlock } from "../utilities/ElementRegistry.js";
4
5
  import { styles } from "./UVideoBlock.styles.js";
5
6
  import schema from "./UVideoBlock.schema.js";
@@ -13,6 +14,7 @@ var UVideoBlock = class UVideoBlock extends UElement {
13
14
  constructor(..._args) {
14
15
  super(..._args);
15
16
  this.ratio = "16:9";
17
+ this.tracks = [];
16
18
  }
17
19
  static {
18
20
  this.styles = [super.styles, styles];
@@ -55,7 +57,13 @@ var UVideoBlock = class UVideoBlock extends UElement {
55
57
  poster=${ifDefined(this.poster)}
56
58
  controls
57
59
  playsinline
58
- ></video>
60
+ >${this.tracks.filter((t) => t && typeof t.src === "string" && sanitizeHref(t.src) !== "#").map((t) => html`<track
61
+ src=${sanitizeHref(t.src)}
62
+ kind=${t.kind ?? "subtitles"}
63
+ srclang=${ifDefined(t.srclang)}
64
+ label=${ifDefined(t.label)}
65
+ ?default=${t.default === true}
66
+ />`)}</video>
59
67
  `;
60
68
  }
61
69
  isYouTube(url) {
@@ -79,6 +87,7 @@ var UVideoBlock = class UVideoBlock extends UElement {
79
87
  __decorate([property({ type: String }), __decorateMetadata("design:type", String)], UVideoBlock.prototype, "src", void 0);
80
88
  __decorate([property({ type: String }), __decorateMetadata("design:type", String)], UVideoBlock.prototype, "poster", void 0);
81
89
  __decorate([property({ type: String }), __decorateMetadata("design:type", String)], UVideoBlock.prototype, "ratio", void 0);
90
+ __decorate([property({ type: Array }), __decorateMetadata("design:type", Array)], UVideoBlock.prototype, "tracks", void 0);
82
91
  UVideoBlock = __decorate([customElement("u-video-block")], UVideoBlock);
83
92
  //#endregion
84
93
  export { UVideoBlock };
@@ -20,6 +20,44 @@ var schema = {
20
20
  ],
21
21
  default: "16:9",
22
22
  description: "Video aspect ratio"
23
+ },
24
+ tracks: {
25
+ type: "array",
26
+ items: {
27
+ type: "object",
28
+ properties: {
29
+ src: {
30
+ type: "string",
31
+ description: "WebVTT file URL"
32
+ },
33
+ kind: {
34
+ type: "string",
35
+ enum: [
36
+ "subtitles",
37
+ "captions",
38
+ "descriptions",
39
+ "chapters",
40
+ "metadata"
41
+ ],
42
+ default: "subtitles",
43
+ description: "Track kind"
44
+ },
45
+ srclang: {
46
+ type: "string",
47
+ description: "Language of the track text (BCP 47, e.g. ko)"
48
+ },
49
+ label: {
50
+ type: "string",
51
+ description: "Name shown in the player's track menu"
52
+ },
53
+ default: {
54
+ type: "boolean",
55
+ description: "Show this track by default"
56
+ }
57
+ },
58
+ required: ["src"]
59
+ },
60
+ description: "Subtitle / caption tracks for a direct video file (ignored for YouTube and Vimeo)"
23
61
  }
24
62
  },
25
63
  required: ["src"]
@@ -5,5 +5,5 @@
5
5
  * 이 리포가 채택한 표준이 *"영어 기본 **+ 레지스트리**"* 이기 때문이다 — 영어 리터럴만으로는
6
6
  * 한국어 앱이 그 문구를 되돌릴 방법이 없다. 다음 문자열은 여기로 온다.
7
7
  */
8
- export type ChatMessageKey = 'canvasUnavailable' | 'previousReference' | 'nextReference' | 'closePreview' | 'closeLightbox' | 'previousImage' | 'nextImage' | 'sendMessage' | 'stopGenerating' | 'fullScreen' | 'remove' | 'pngDownload' | 'jsonDownload' | 'search' | 'rowCount' | 'excelDownload' | 'csvDownload' | 'openImage' | 'previewFile' | 'imageBlocked' | 'imageBlockedNamed';
8
+ export type ChatMessageKey = 'canvasUnavailable' | 'previousReference' | 'nextReference' | 'closePreview' | 'closeLightbox' | 'previousImage' | 'nextImage' | 'sendMessage' | 'stopGenerating' | 'fullScreen' | 'remove' | 'pngDownload' | 'jsonDownload' | 'search' | 'rowCount' | 'excelDownload' | 'csvDownload' | 'openImage' | 'previewFile' | 'imageBlocked' | 'imageBlockedNamed' | 'opensInNewTab';
9
9
  export declare const messages: import('@iyulab/components/dist/utilities/Locale.js').LocaleNamespace<ChatMessageKey>;
@@ -22,7 +22,8 @@ messages.register("en", {
22
22
  openImage: "Open image {index}",
23
23
  previewFile: "Preview {name}",
24
24
  imageBlocked: "Image blocked",
25
- imageBlockedNamed: "Image blocked: {name}"
25
+ imageBlockedNamed: "Image blocked: {name}",
26
+ opensInNewTab: "(opens in a new tab)"
26
27
  });
27
28
  messages.register("ko", {
28
29
  canvasUnavailable: "Canvas 2D context를 가져올 수 없습니다.",
@@ -45,7 +46,8 @@ messages.register("ko", {
45
46
  openImage: "이미지 {index} 열기",
46
47
  previewFile: "{name} 미리보기",
47
48
  imageBlocked: "차단된 이미지",
48
- imageBlockedNamed: "차단된 이미지: {name}"
49
+ imageBlockedNamed: "차단된 이미지: {name}",
50
+ opensInNewTab: "(새 창에서 열림)"
49
51
  });
50
52
  //#endregion
51
53
  export { messages };
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.15.0",
4
+ "version": "0.16.0",
5
5
  "author": "iyulab",
6
6
  "license": "MIT",
7
7
  "keywords": [
@@ -55,6 +55,7 @@ reason as the image block: vertical squeezing would break the aspect ratio. The
55
55
  | `src` | `string` | `undefined` | Video URL: YouTube, Vimeo, or direct file |
56
56
  | `poster` | `string` | `undefined` | Poster image URL for direct video files |
57
57
  | `ratio` | `'16:9'\|'4:3'\|'1:1'` | `'16:9'` | Aspect ratio |
58
+ | `tracks` | `VideoTrack[]` | `[]` | Subtitle / caption tracks (WebVTT) for a direct video file — `{ src, kind?, srclang?, label?, default? }`, `kind` defaults to `'subtitles'`. The video is inside the shadow tree, so this is the only way to add a `<track>`. Ignored for YouTube and Vimeo. Track files on another origin load only when that server allows CORS for the page |
58
59
 
59
60
  ## Supported Platforms
60
61