@iyulab/components 2.2.0 → 2.2.2

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
+ ## [2.2.2] - 2026-10-06
4
+
5
+ ### Documentation
6
+
7
+ - Examples that did not type-check against the API they teach: `Theme.init` persisted to localStorage with a `store.key` option that does not exist (the theme is stored under `theme`, with an optional `prefix`) in the theming guide and the skill reference; `Dialog.prompt` took `default` instead of `defaultValue`; the overlay-manager example read a field it never declared.
8
+
9
+ ## [2.2.1] - 2026-10-06
10
+
11
+ ### Fixed
12
+
13
+ - **`u-select`'s `search` and `u-tab-panel`'s `change` are typed for TypeScript listeners.** Each element
14
+ declares its custom events (`USelectEventMap`, `UTabPanelEventMap`) and types `addEventListener` with
15
+ them — `select.addEventListener('search', (e) => e.detail.query)` no longer needs a cast. They are
16
+ element-scoped rather than global: `change` is already the native `Event` there.
17
+
18
+ ### Documentation
19
+
20
+ - **Quick Start** — a first page (token sheet, `u-input` and `u-button` in a native form, a toast) that
21
+ builds, type-checks and renders as written.
22
+
3
23
  ## [2.2.0] - 2026-10-06
4
24
 
5
25
  ### Added
package/README.md CHANGED
@@ -10,6 +10,31 @@ Lit 기반 웹 컴포넌트 라이브러리.
10
10
  npm install @iyulab/components
11
11
  ```
12
12
 
13
+ ## Quick Start
14
+
15
+ 아래 파일 하나가 그대로 돌아가는 첫 페이지입니다(Vite 기준 — `index.html` 이 `src/main.ts` 를 모듈로 싣는다).
16
+
17
+ ```ts
18
+ // src/main.ts
19
+ import '@iyulab/components/styles/tokens.css';
20
+ import { Toast } from '@iyulab/components';
21
+
22
+ document.body.innerHTML = `
23
+ <form id="signup" style="display: grid; gap: 12px; max-width: 320px; margin: 32px">
24
+ <u-input name="email" type="email" label="Email" required></u-input>
25
+ <u-button type="submit" color="primary">Sign up</u-button>
26
+ </form>
27
+ `;
28
+
29
+ const form = document.querySelector<HTMLFormElement>('#signup')!;
30
+ form.addEventListener('submit', (event) => {
31
+ event.preventDefault();
32
+ Toast.success(`Welcome, ${new FormData(form).get('email')}`);
33
+ });
34
+ ```
35
+
36
+ `u-input` 과 `u-button` 은 네이티브 폼에 참여하므로 `FormData`·`required` 검증·Enter 제출이 그대로 동작합니다.
37
+
13
38
  ## Usage
14
39
 
15
40
  ```ts
@@ -115,6 +115,22 @@ export declare class USelect extends UFormControlElement<string | string[]> {
115
115
  private handleClearKeydown;
116
116
  private handleChipRemove;
117
117
  }
118
+ /** Custom events `<u-select>` dispatches (its `change`/`input` are the native form-control events). */
119
+ export interface USelectEventMap {
120
+ /** The search box changed (`searchable`). `query` is the trimmed, lower-cased text. */
121
+ 'search': CustomEvent<{
122
+ query: string;
123
+ }>;
124
+ }
125
+ /** Typed listeners for {@link USelectEventMap} — element-scoped, the DOM's own pattern (`HTMLMediaElementEventMap`). */
126
+ export interface USelect {
127
+ addEventListener<K extends keyof USelectEventMap>(type: K, listener: (this: USelect, ev: USelectEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
128
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: USelect, ev: HTMLElementEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
129
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
130
+ removeEventListener<K extends keyof USelectEventMap>(type: K, listener: (this: USelect, ev: USelectEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
131
+ removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: USelect, ev: HTMLElementEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
132
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
133
+ }
118
134
  declare global {
119
135
  interface HTMLElementTagNameMap {
120
136
  'u-select': USelect;
@@ -56,6 +56,20 @@ export declare class UTabPanel extends UElement {
56
56
  private handleTabKeydown;
57
57
  private handleNavWheel;
58
58
  }
59
+ /** Events `<u-tab-panel>` dispatches. */
60
+ export interface UTabPanelEventMap {
61
+ /** A tab was chosen by click or keyboard — not on first mount. Does not bubble; read `value` on the panel. */
62
+ 'change': CustomEvent<null>;
63
+ }
64
+ /** Typed listeners for {@link UTabPanelEventMap} — element-scoped, the DOM's own pattern (`HTMLMediaElementEventMap`). */
65
+ export interface UTabPanel {
66
+ addEventListener<K extends keyof UTabPanelEventMap>(type: K, listener: (this: UTabPanel, ev: UTabPanelEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
67
+ addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: UTabPanel, ev: HTMLElementEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
68
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
69
+ removeEventListener<K extends keyof UTabPanelEventMap>(type: K, listener: (this: UTabPanel, ev: UTabPanelEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
70
+ removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: UTabPanel, ev: HTMLElementEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
71
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
72
+ }
59
73
  declare global {
60
74
  interface HTMLElementTagNameMap {
61
75
  'u-tab-panel': UTabPanel;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@iyulab/components",
3
3
  "description": "web-components library based on lit-element made by iyulab",
4
- "version": "2.2.0",
4
+ "version": "2.2.2",
5
5
  "keywords": [
6
6
  "iyulab",
7
7
  "components",
@@ -45,7 +45,7 @@ await Theme.init({
45
45
  useBuiltIn: true, // load bundled CSS variables (default: true)
46
46
  store: { // persist theme preference in localStorage (optional)
47
47
  type: 'localStorage',
48
- key: 'app-theme'
48
+ prefix: 'my-app:' // stored under 'my-app:theme' (default key: 'theme')
49
49
  }
50
50
  });
51
51
  ```
@@ -290,7 +290,7 @@ await Dialog.alert('Operation completed.');
290
290
  const confirmed = await Dialog.confirm('Delete this item?');
291
291
 
292
292
  // Prompt
293
- const name = await Dialog.prompt('Enter your name:', { default: 'Alice' });
293
+ const name = await Dialog.prompt('Enter your name:', { defaultValue: 'Alice' });
294
294
 
295
295
  // Toast
296
296
  Toast.DefaultOptions = { position: 'bottom-center', duration: 3000 };
@@ -58,6 +58,7 @@ OverlayManager.closeLayer(panel); // when it closes, by any
58
58
  import { UOverlayElement } from '@iyulab/components';
59
59
 
60
60
  class MyOverlay extends UOverlayElement {
61
+ hasUnsavedChanges = false;
61
62
  // UOverlayElement already calls OverlayManager.add/remove internally
62
63
  // Override requestClose() if you need custom close logic
63
64
  override requestClose(source: string) {