@iyulab/components 2.20.0 → 2.20.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,29 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.20.2] - 2026-10-12
4
+
5
+ ### Fixed
6
+
7
+ - The React wrapper types name every event's `detail` type with an import. `onPageChange` on the `UPagination`
8
+ wrapper used `PageChangeDetail` without importing it: under `skipLibCheck` the handler's event was silently
9
+ `any`, otherwise the declaration failed with `TS2304`. The wrapper generator (`plugins/vite-plugin-react-wrapper`)
10
+ now imports a detail type declared in the element's own module, and one imported from another package by its
11
+ package specifier.
12
+ - The wrapper generator types an `@event`-only event from the package's event map declarations — an element-scoped
13
+ `*EventMap`, then the `HTMLElementEventMap` / `GlobalEventHandlersEventMap` augmentations — when the event's
14
+ `detail` is `CustomEvent<T>` (or an alias of it) with `T` importable. Events dispatched by a controller rather than
15
+ `this.fire<T>()` were typed as a bare `CustomEvent`. Native-named events (`change`, `input`) are unchanged.
16
+
17
+ ## [2.20.1] - 2026-10-12
18
+
19
+ ### Fixed
20
+
21
+ - `u-date-picker` and `u-date-range-picker` in `mode="datetime"` read a value written with another offset as the
22
+ instant it names. A value such as `2026-09-06T22:22:34Z` showed `22:22` on a `+09:00` machine, and editing it wrote
23
+ that wall clock back with the local offset, moving the stored instant by nine hours. The picker now shows the local
24
+ time of that instant, writes edits in the local offset for the same moment, and keeps the given string (no `change`)
25
+ when a pick leaves the instant as it was. `start` and `end` on the range picker still return the halves as written.
26
+
3
27
  ## [2.20.0] - 2026-10-10
4
28
 
5
29
  ### Changed
@@ -1,3 +1,4 @@
1
+ import { sameDateTime } from "./datetime.js";
1
2
  //#region src/components/calendar/date-text-controller.ts
2
3
  /**
3
4
  * The typed-date text box shared by `u-date-picker` and `u-date-range-picker`: what is being typed
@@ -52,8 +53,8 @@ var DateTextController = class {
52
53
  const next = this.options.toValue(text);
53
54
  this.badText = next === null;
54
55
  const value = next ?? void 0;
55
- const changed = value !== this.host.value;
56
- this.host.value = value;
56
+ const changed = !sameDateTime(value, this.host.value);
57
+ if (changed) this.host.value = value;
57
58
  this.draft = this.badText ? text : null;
58
59
  this.host.requestUpdate();
59
60
  if (changed) this.options.onChange();
@@ -3,8 +3,19 @@
3
3
  export declare function localOffset(date: Date): string;
4
4
  /** ISO day + `HH:mm` or `HH:mm:ss` → `YYYY-MM-DDTHH:mm:ss±HH:mm` (the offset of that local day and time). */
5
5
  export declare function toDateTimeOffset(day: string, time: string): string;
6
+ /** A date-time value as this browser's wall clock — `YYYY-MM-DDTHH:mm:ss±HH:mm` in the local offset.
7
+ * A value with an offset is an instant: `2026-09-06T22:22:34Z` reads `2026-09-07T07:22:34+09:00` in
8
+ * Seoul, the same moment. A value without one is already wall clock and comes back as it is, and so
9
+ * does anything that is not a date-time. Every read of a picker value goes through here, so what
10
+ * the picker shows and what it writes back describe the same instant. */
11
+ export declare function toLocalDateTime(value: string): string;
12
+ /** Whether two picker values are the same — a day, a date-time, or a `start/end` interval of either,
13
+ * compared half by half as instants when they carry offsets. A value written back in the local
14
+ * offset is then not a change from the `…Z` it came from, and the picker keeps the string it was given. */
15
+ export declare function sameDateTime(a: string | undefined, b: string | undefined): boolean;
6
16
  /** Splits a value into its ISO day and its time — `HH:mm`, or `HH:mm:ss` with `seconds`
7
- * (`00:00` when there is no time part). */
17
+ * (`00:00` when there is no time part). A value with an offset is read as this browser's wall clock
18
+ * ({@link toLocalDateTime}). */
8
19
  export declare function splitDateTime(value: string, seconds?: boolean): {
9
20
  day: string;
10
21
  time: string;
@@ -15,10 +15,34 @@ function toDateTimeOffset(day, time) {
15
15
  local.setHours(h, m, s);
16
16
  return `${day}T${normalizeTime(time, true)}${localOffset(local)}`;
17
17
  }
18
+ /** A date-time with a UTC designator or offset after its time (`…Z`, `…+09:00`, `…-0530`). */
19
+ var WITH_OFFSET = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})$/i;
20
+ /** A date-time value as this browser's wall clock — `YYYY-MM-DDTHH:mm:ss±HH:mm` in the local offset.
21
+ * A value with an offset is an instant: `2026-09-06T22:22:34Z` reads `2026-09-07T07:22:34+09:00` in
22
+ * Seoul, the same moment. A value without one is already wall clock and comes back as it is, and so
23
+ * does anything that is not a date-time. Every read of a picker value goes through here, so what
24
+ * the picker shows and what it writes back describe the same instant. */
25
+ function toLocalDateTime(value) {
26
+ if (!WITH_OFFSET.test(value)) return value;
27
+ const instant = new Date(value);
28
+ if (Number.isNaN(instant.getTime())) return value;
29
+ const pad = (n) => String(n).padStart(2, "0");
30
+ return toDateTimeOffset(`${instant.getFullYear()}-${pad(instant.getMonth() + 1)}-${pad(instant.getDate())}`, `${pad(instant.getHours())}:${pad(instant.getMinutes())}:${pad(instant.getSeconds())}`);
31
+ }
32
+ /** Whether two picker values are the same — a day, a date-time, or a `start/end` interval of either,
33
+ * compared half by half as instants when they carry offsets. A value written back in the local
34
+ * offset is then not a change from the `…Z` it came from, and the picker keeps the string it was given. */
35
+ function sameDateTime(a, b) {
36
+ if (a === b) return true;
37
+ if (!a || !b) return false;
38
+ const local = (v) => v.split("/").map(toLocalDateTime).join("/");
39
+ return local(a) === local(b);
40
+ }
18
41
  /** Splits a value into its ISO day and its time — `HH:mm`, or `HH:mm:ss` with `seconds`
19
- * (`00:00` when there is no time part). */
42
+ * (`00:00` when there is no time part). A value with an offset is read as this browser's wall clock
43
+ * ({@link toLocalDateTime}). */
20
44
  function splitDateTime(value, seconds = false) {
21
- const [day, rest] = value.split("T");
45
+ const [day, rest] = toLocalDateTime(value).split("T");
22
46
  const match = rest?.match(/^\d{2}:\d{2}(?::\d{2})?/);
23
47
  return {
24
48
  day,
@@ -32,4 +56,4 @@ function normalizeTime(time, seconds) {
32
56
  return seconds ? `${hm}:${time.slice(6, 8) || "00"}` : hm;
33
57
  }
34
58
  //#endregion
35
- export { localOffset, normalizeTime, splitDateTime, toDateTimeOffset };
59
+ export { localOffset, normalizeTime, sameDateTime, splitDateTime, toDateTimeOffset, toLocalDateTime };
@@ -10,8 +10,8 @@ import { UCalendar } from "../calendar/UCalendar.js";
10
10
  import "../field/UField.js";
11
11
  import { UPopover } from "../popover/UPopover.js";
12
12
  import { CharsWidthController } from "../../utilities/chars.js";
13
+ import { normalizeTime, sameDateTime, splitDateTime, toDateTimeOffset } from "../calendar/datetime.js";
13
14
  import { DateTextController } from "../calendar/date-text-controller.js";
14
- import { normalizeTime, splitDateTime, toDateTimeOffset } from "../calendar/datetime.js";
15
15
  import { styles } from "../calendar/picker.styles.js";
16
16
  import { styles as styles$1 } from "./UDatePicker.styles.js";
17
17
  import { html } from "lit";
@@ -81,9 +81,9 @@ var UDatePicker = class UDatePicker extends UFormControlElement {
81
81
  }
82
82
  if (!this.value) return;
83
83
  const iso = buildValue(splitValue(this.value).date, this.mode, time);
84
- const changed = iso !== this.value;
84
+ const changed = !sameDateTime(iso, this.value);
85
85
  this.textEntry.clear();
86
- this.value = iso;
86
+ if (changed) this.value = iso;
87
87
  if (changed) this.emitChange();
88
88
  };
89
89
  this.handleDaySelect = (e) => {
@@ -124,9 +124,9 @@ var UDatePicker = class UDatePicker extends UFormControlElement {
124
124
  };
125
125
  this.handleApplyClick = () => {
126
126
  const next = this.staged;
127
- const changed = next !== this.value;
127
+ const changed = !sameDateTime(next, this.value);
128
128
  this.textEntry.clear();
129
- this.value = next;
129
+ if (changed) this.value = next;
130
130
  if (changed) this.emitChange();
131
131
  this.popoverEl?.hide();
132
132
  (this.textInputEl ?? this.containerEl)?.focus();
@@ -313,9 +313,9 @@ var UDatePicker = class UDatePicker extends UFormControlElement {
313
313
  this.staged = iso;
314
314
  return;
315
315
  }
316
- const changed = iso !== this.value;
316
+ const changed = !sameDateTime(iso, this.value);
317
317
  this.textEntry.clear();
318
- this.value = iso;
318
+ if (changed) this.value = iso;
319
319
  if (changed) this.emitChange();
320
320
  this.popoverEl?.hide();
321
321
  (this.textInputEl ?? this.containerEl)?.focus();
@@ -11,8 +11,8 @@ import { UCalendar } from "../calendar/UCalendar.js";
11
11
  import "../field/UField.js";
12
12
  import { UPopover } from "../popover/UPopover.js";
13
13
  import { CharsWidthController } from "../../utilities/chars.js";
14
+ import { normalizeTime, sameDateTime, splitDateTime, toDateTimeOffset, toLocalDateTime } from "../calendar/datetime.js";
14
15
  import { DateTextController } from "../calendar/date-text-controller.js";
15
- import { normalizeTime, splitDateTime, toDateTimeOffset } from "../calendar/datetime.js";
16
16
  import { styles } from "../calendar/picker.styles.js";
17
17
  import { resolvePresets } from "./presets.js";
18
18
  import { styles as styles$1 } from "./UDateRangePicker.styles.js";
@@ -22,14 +22,18 @@ import { ifDefined } from "lit/directives/if-defined.js";
22
22
  //#region src/components/date-range-picker/UDateRangePicker.ts
23
23
  var ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
24
24
  var ISO_DATE_TIME = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/;
25
- /** Splits `"start/end"` into its two halves — ISO dates, or in `mode="datetime"` ISO date-times;
26
- * `undefined` unless both halves have that shape. */
27
- function parseInterval(value, mode) {
25
+ /** Splits `"start/end"` into its two halves — ISO dates, or in `mode="datetime"` ISO date-times read
26
+ * as this browser's wall clock (a half with an offset is an instant — `toLocalDateTime`), or as
27
+ * written with `local` off; `undefined` unless both halves have that shape. */
28
+ function parseInterval(value, mode, local = true) {
28
29
  if (!value) return void 0;
29
30
  const [start, end, ...rest] = value.split("/");
30
31
  const shape = mode === "datetime" ? ISO_DATE_TIME : ISO_DATE;
31
32
  if (rest.length || !shape.test(start ?? "") || !shape.test(end ?? "")) return void 0;
32
- return {
33
+ return mode === "datetime" && local ? {
34
+ start: toLocalDateTime(start),
35
+ end: toLocalDateTime(end)
36
+ } : {
33
37
  start,
34
38
  end
35
39
  };
@@ -38,8 +42,8 @@ function parseInterval(value, mode) {
38
42
  function reversed(start, end, mode) {
39
43
  return mode === "datetime" ? new Date(start).getTime() > new Date(end).getTime() : start > end;
40
44
  }
41
- /** The ISO day of a half (`YYYY-MM-DD` either way). */
42
- var dayPart = (half) => half.slice(0, 10);
45
+ /** The ISO day of a half (`YYYY-MM-DD` either way) — a half with an offset on this browser's wall clock. */
46
+ var dayPart = (half) => splitDateTime(half).day;
43
47
  var UDateRangePicker = class UDateRangePicker extends UFormControlElement {
44
48
  constructor(..._args) {
45
49
  super(..._args);
@@ -139,12 +143,12 @@ var UDateRangePicker = class UDateRangePicker extends UFormControlElement {
139
143
  /** Start of the range — the ISO day, or in `mode="datetime"` the ISO date-time; `undefined` when
140
144
  * there is no complete range. */
141
145
  get start() {
142
- return parseInterval(this.value, this.mode)?.start;
146
+ return parseInterval(this.value, this.mode, false)?.start;
143
147
  }
144
148
  /** End of the range — the ISO day, or in `mode="datetime"` the ISO date-time; `undefined` when
145
149
  * there is no complete range. */
146
150
  get end() {
147
- return parseInterval(this.value, this.mode)?.end;
151
+ return parseInterval(this.value, this.mode, false)?.end;
148
152
  }
149
153
  /** Times a whole-day range takes in `mode="datetime"` — a preset or a first calendar pick: from
150
154
  * the first minute (or second, with `seconds`) to the last. */
@@ -360,9 +364,9 @@ var UDateRangePicker = class UDateRangePicker extends UFormControlElement {
360
364
  this.staged = next;
361
365
  return;
362
366
  }
363
- const changed = next !== this.value;
367
+ const changed = !sameDateTime(next, this.value);
364
368
  this.textEntry.clear();
365
- this.value = next;
369
+ if (changed) this.value = next;
366
370
  if (changed) this.emitChange();
367
371
  }
368
372
  renderPresets(presets) {
@@ -370,7 +374,7 @@ var UDateRangePicker = class UDateRangePicker extends UFormControlElement {
370
374
  <div class="presets" part="presets" role="group" aria-label=${Locale.getValue("quickRanges")}>
371
375
  ${presets.map((p) => html`
372
376
  <button type="button" class="preset" part="preset"
373
- aria-pressed=${this.build(p.start, p.end, this.wholeDay) === this.working}
377
+ aria-pressed=${sameDateTime(this.build(p.start, p.end, this.wholeDay), this.working)}
374
378
  ?disabled=${this.unavailable(p)}
375
379
  @click=${() => this.commitRange(p.start, p.end, this.wholeDay)}
376
380
  >${p.label}</button>
@@ -401,9 +405,9 @@ var UDateRangePicker = class UDateRangePicker extends UFormControlElement {
401
405
  /** Commits `next` as the value (firing `change` when it differs), closes the calendar and
402
406
  * returns focus to the text box. */
403
407
  commitValue(next) {
404
- const changed = next !== this.value;
408
+ const changed = !sameDateTime(next, this.value);
405
409
  this.textEntry.clear();
406
- this.value = next;
410
+ if (changed) this.value = next;
407
411
  if (changed) this.emitChange();
408
412
  this.popoverEl?.hide();
409
413
  this.textInputEl?.focus();
@@ -14,6 +14,17 @@ interface ComponentEvent {
14
14
  * 절대화해 이 어긋남을 원천 차단한다.
15
15
  */
16
16
  detailSource: string;
17
+ /**
18
+ * detail 타입을 **다른 패키지**에서 가져올 때의 지정자(예: `@iyulab/components/dist/events/RemoveEvent.js`).
19
+ * 그 경우 `detailSource` 는 비고, d.ts 는 이 지정자 그대로 import 한다 — 비워 두면 래퍼 d.ts 가
20
+ * import 없이 이름만 써서 소비자 쪽에서 풀리지 않는다(`TS2304`).
21
+ */
22
+ detailSpecifier?: string;
23
+ }
24
+ /** detail 타입을 어디서 가져오는가 — 같은 패키지 소스(절대 경로) 또는 다른 패키지(지정자). */
25
+ interface DetailOrigin {
26
+ detailSource: string;
27
+ detailSpecifier?: string;
17
28
  }
18
29
  interface PluginOptions {
19
30
  /** 컴포넌트 소스 디렉토리 경로 (기본값: 'src/components') */
@@ -72,4 +83,19 @@ export declare function findEventDeclarationViolations(content: string, classNam
72
83
  * ⑵leaf 가 같은 이벤트를 더 구체적 타입으로 발화하면 그것이 이긴다.
73
84
  */
74
85
  export declare function collectComponentEvents(filePath: string): ComponentEvent[];
86
+ type EventEntry = {
87
+ detailType: string;
88
+ } & DetailOrigin;
89
+ /** 이벤트 맵 인터페이스의 `'name': Type;` 항목들 — `map` 은 맵 이름(예: `HTMLElementEventMap`). */
90
+ export declare function readEventMapEntries(content: string): {
91
+ map: string;
92
+ name: string;
93
+ type: string;
94
+ }[];
95
+ /**
96
+ * 이벤트 타입 글자에서 detail 타입과 그 출처를 푼다 — `CustomEvent<X>` 이거나, 같은 파일의
97
+ * `type A = CustomEvent<X>` 별칭 `A`. `X` 는 그 파일이 선언했거나 import 한 이름 하나, 또는 다른 이름을
98
+ * 참조하지 않는 인라인 타입(`{ query: string }`). 못 풀면 null — 추측해서 거짓 타입을 내지 않는다.
99
+ */
100
+ export declare function detailFromEventType(type: string, file: string, content: string): EventEntry | null;
75
101
  export {};
@@ -131,12 +131,26 @@ export function findEventDeclarationViolations(content, className, tagName, even
131
131
  */
132
132
  export function collectComponentEvents(filePath) {
133
133
  const eventMap = new Map();
134
- collectInto(eventMap, filePath, new Set());
135
- return Array.from(eventMap, ([name, { detailType, detailSource }]) => ({
134
+ const chain = new Set();
135
+ collectInto(eventMap, filePath, chain);
136
+ // `@event` 만 있고 detail 타입을 모르는 이벤트는 **이벤트 맵 선언**에서 찾는다 — 요소 범위 맵
137
+ // (`UInputEventMap` 처럼 상속 체인 파일의 `*EventMap`)이 먼저, 패키지 전역 증강
138
+ // (`HTMLElementEventMap`·`GlobalEventHandlersEventMap`)이 다음. 타입은 그 선언 한 곳이 정본이다 —
139
+ // 컨트롤러가 대신 발화하는 이벤트(`this.fire` 가 없다)도 여기서 타입을 얻는다.
140
+ const srcRoot = packageSrcRoot(filePath);
141
+ for (const [name, entry] of eventMap) {
142
+ if (entry.detailType !== 'unknown')
143
+ continue;
144
+ const found = lookupEventMaps(name, [...chain], srcRoot);
145
+ if (found)
146
+ eventMap.set(name, found);
147
+ }
148
+ return Array.from(eventMap, ([name, { detailType, detailSource, detailSpecifier }]) => ({
136
149
  name,
137
150
  reactName: toCamelEvent(name),
138
151
  detailType,
139
152
  detailSource,
153
+ ...(detailSpecifier ? { detailSpecifier } : {}),
140
154
  }));
141
155
  }
142
156
  function collectInto(eventMap, filePath, visited) {
@@ -146,15 +160,7 @@ function collectInto(eventMap, filePath, visited) {
146
160
  const content = readFileSync(filePath, 'utf-8');
147
161
  // import 구문에서 식별자 → 소스 경로 매핑 수집 (detail 타입과 베이스 클래스 양쪽에 쓴다)
148
162
  // 예: import { ShowEventDetail } from '../events/ShowEvent.js';
149
- const importMap = new Map();
150
- for (const m of content.matchAll(/import\s+\{([^}]+)\}\s+from\s+['"]([^'"]+)['"]/g)) {
151
- const importPath = m[2];
152
- for (const name of m[1].split(',')) {
153
- const typeName = name.replace(/type\s+/, '').trim();
154
- if (typeName)
155
- importMap.set(typeName, importPath);
156
- }
157
- }
163
+ const importMap = readImportMap(content);
158
164
  // 베이스 클래스를 먼저 수집한다 (제네릭 베이스 `extends UFormControlElement<T>` 포함)
159
165
  const extendsMatch = content.match(/export\s+(?:abstract\s+)?class\s+\w+(?:<[^>]*>)?\s+extends\s+(\w+)/);
160
166
  if (extendsMatch) {
@@ -170,10 +176,142 @@ function collectInto(eventMap, filePath, visited) {
170
176
  // this.fire<DetailType>('eventName') 패턴 - 제네릭 타입 추출
171
177
  for (const m of content.matchAll(/this\.fire\s*(?:<([^>]+)>)?\s*\(\s*['"]([\w-]+)['"]/g)) {
172
178
  const detailType = m[1] || 'unknown';
173
- const detailSource = resolveLocalModule(filePath, importMap.get(detailType)) || '';
174
- eventMap.set(m[2], { detailType, detailSource });
179
+ eventMap.set(m[2], { detailType, ...detailOrigin(detailType, filePath, content, importMap) });
175
180
  }
176
181
  }
182
+ /** 이 파일이 그 이름을 export 선언하는가. */
183
+ function declaresExport(content, name) {
184
+ return new RegExp(`export\\s+(?:interface|type|class|enum)\\s+${name}\\b`).test(content);
185
+ }
186
+ /**
187
+ * detail 타입 이름의 출처 — 이 파일이 import 했으면 그 import 를, 이 파일이 스스로 export 선언했으면 이 파일을.
188
+ * ⚠뒤쪽이 빠져 있었다: `UPagination` 의 `PageChangeDetail` 처럼 요소 파일이 선언한 detail 은 출처가 비어
189
+ * 래퍼 d.ts 가 import 없이 이름만 썼다(`skipLibCheck` 소비자에게는 조용한 `any`, 아니면 `TS2304`).
190
+ */
191
+ function detailOrigin(name, file, content, importMap) {
192
+ const imported = importMap.get(name);
193
+ if (imported)
194
+ return resolveDetailOrigin(file, imported);
195
+ return declaresExport(content, name) ? { detailSource: file } : { detailSource: '' };
196
+ }
197
+ function readImportMap(content) {
198
+ const importMap = new Map();
199
+ for (const m of content.matchAll(/import\s+(?:type\s+)?\{([^}]+)\}\s+from\s+['"]([^'"]+)['"]/g)) {
200
+ for (const name of m[1].split(',')) {
201
+ const typeName = name.replace(/type\s+/, '').trim();
202
+ if (typeName)
203
+ importMap.set(typeName, m[2]);
204
+ }
205
+ }
206
+ return importMap;
207
+ }
208
+ /** 상대 import 는 같은 패키지 소스(절대 경로)로, 패키지 지정자는 그대로 — 둘 다 아니면 출처 없음. */
209
+ function resolveDetailOrigin(fromFile, importPath) {
210
+ if (importPath && !importPath.startsWith('.'))
211
+ return { detailSource: '', detailSpecifier: importPath };
212
+ return { detailSource: resolveLocalModule(fromFile, importPath) || '' };
213
+ }
214
+ /** 소스 파일이 속한 패키지의 `src` 디렉터리(없으면 그 파일의 디렉터리). */
215
+ function packageSrcRoot(filePath) {
216
+ const norm = filePath.split(sep).join('/');
217
+ const i = norm.lastIndexOf('/src/');
218
+ return i >= 0 ? norm.slice(0, i + 4) : dirname(filePath);
219
+ }
220
+ /** 이벤트 맵 인터페이스의 `'name': Type;` 항목들 — `map` 은 맵 이름(예: `HTMLElementEventMap`). */
221
+ export function readEventMapEntries(content) {
222
+ const out = [];
223
+ for (const m of content.matchAll(/interface\s+(\w*EventMap)\s*\{/g)) {
224
+ // 짝 맞는 닫는 중괄호까지 — 항목 타입 안의 `{ query: string }` 를 건너뛴다.
225
+ let depth = 1;
226
+ let i = m.index + m[0].length;
227
+ const start = i;
228
+ for (; i < content.length && depth > 0; i++) {
229
+ if (content[i] === '{')
230
+ depth++;
231
+ else if (content[i] === '}')
232
+ depth--;
233
+ }
234
+ const body = content.slice(start, i - 1).replace(/\/\*[\s\S]*?\*\//g, '').replace(/\/\/.*$/gm, '');
235
+ // 항목 = 맨 바깥 깊이의 `이름: 타입;` — 인라인 객체 타입 안의 `query: string;` 을 항목으로 읽지 않는다.
236
+ let depthB = 0;
237
+ let from = 0;
238
+ for (let j = 0; j < body.length; j++) {
239
+ const c = body[j];
240
+ if (c === '{' || c === '<' || c === '(')
241
+ depthB++;
242
+ else if (c === '}' || c === '>' || c === ')')
243
+ depthB--;
244
+ else if (c === ';' && depthB === 0) {
245
+ const e = body.slice(from, j).match(/^\s*['"]?([\w-]+)['"]?\s*:\s*([\s\S]+)$/);
246
+ if (e)
247
+ out.push({ map: m[1], name: e[1], type: e[2].trim() });
248
+ from = j + 1;
249
+ }
250
+ }
251
+ }
252
+ return out;
253
+ }
254
+ const GLOBAL_EVENT_MAPS = new Set(['HTMLElementEventMap', 'GlobalEventHandlersEventMap']);
255
+ const globalMapCache = new Map();
256
+ function globalEventMapEntries(srcRoot) {
257
+ let entries = globalMapCache.get(srcRoot);
258
+ if (!entries) {
259
+ entries = [];
260
+ for (const file of globSync('**/*.ts', { cwd: srcRoot, absolute: true, ignore: ['**/*.test.ts', '**/*.d.ts'] })) {
261
+ const content = readFileSync(file, 'utf-8');
262
+ if (!content.includes('EventMap'))
263
+ continue;
264
+ for (const e of readEventMapEntries(content)) {
265
+ if (GLOBAL_EVENT_MAPS.has(e.map))
266
+ entries.push({ name: e.name, type: e.type, file });
267
+ }
268
+ }
269
+ globalMapCache.set(srcRoot, entries);
270
+ }
271
+ return entries;
272
+ }
273
+ function lookupEventMaps(name, chainFiles, srcRoot) {
274
+ // 요소 범위 맵 — 상속 체인 파일 안의 `*EventMap`. leaf 부터(가장 구체적인 선언이 이긴다).
275
+ for (const file of [...chainFiles].reverse()) {
276
+ const content = readFileSync(file, 'utf-8');
277
+ const hit = readEventMapEntries(content).find(e => e.name === name && !GLOBAL_EVENT_MAPS.has(e.map));
278
+ const resolved = hit && detailFromEventType(hit.type, file, content);
279
+ if (resolved)
280
+ return resolved;
281
+ }
282
+ for (const hit of globalEventMapEntries(srcRoot).filter(e => e.name === name)) {
283
+ const resolved = detailFromEventType(hit.type, hit.file, readFileSync(hit.file, 'utf-8'));
284
+ if (resolved)
285
+ return resolved;
286
+ }
287
+ return null;
288
+ }
289
+ const INLINE_PRIMITIVES = new Set(['string', 'number', 'boolean', 'null', 'undefined', 'unknown', 'true', 'false', 'readonly']);
290
+ /**
291
+ * 이벤트 타입 글자에서 detail 타입과 그 출처를 푼다 — `CustomEvent<X>` 이거나, 같은 파일의
292
+ * `type A = CustomEvent<X>` 별칭 `A`. `X` 는 그 파일이 선언했거나 import 한 이름 하나, 또는 다른 이름을
293
+ * 참조하지 않는 인라인 타입(`{ query: string }`). 못 풀면 null — 추측해서 거짓 타입을 내지 않는다.
294
+ */
295
+ export function detailFromEventType(type, file, content) {
296
+ const alias = type.match(/^(\w+)$/);
297
+ if (alias) {
298
+ const def = content.match(new RegExp(`type\\s+${alias[1]}\\s*=\\s*([^;]+);`));
299
+ return def ? detailFromEventType(def[1].trim(), file, content) : null;
300
+ }
301
+ const custom = type.match(/^CustomEvent<([\s\S]+)>$/);
302
+ if (!custom)
303
+ return null;
304
+ const detail = custom[1].trim();
305
+ if (/^\w+$/.test(detail)) {
306
+ const origin = detailOrigin(detail, file, content, readImportMap(content));
307
+ return origin.detailSource || origin.detailSpecifier ? { detailType: detail, ...origin } : null;
308
+ }
309
+ // 인라인 타입 — 속성 이름과 원시 타입만 쓸 때(다른 이름을 참조하면 import 할 길이 없다).
310
+ const keys = new Set([...detail.matchAll(/(\w+)\??\s*:/g)].map(k => k[1]));
311
+ const idents = (detail.replace(/(['"])(?:(?!\1).)*\1/g, '').match(/[A-Za-z_]\w*/g) ?? [])
312
+ .filter(id => !INLINE_PRIMITIVES.has(id) && !keys.has(id));
313
+ return idents.length === 0 ? { detailType: detail, detailSource: '' } : null;
314
+ }
177
315
  /** 같은 패키지 소스 안의 상대 import 를 절대 `.ts` 경로로 해석한다 (외부 모듈이면 null) */
178
316
  function resolveLocalModule(fromFile, importPath) {
179
317
  if (!importPath || !importPath.startsWith('.'))
@@ -252,8 +390,18 @@ export const ${className} = createComponent({
252
390
  // leaf 기준으로 잘못 풀리는 것을 막기 위함 — ComponentEvent.detailSource 주석 참조).
253
391
  const detailImportMap = new Map(); // 빌드경로 → [타입명]
254
392
  for (const e of events) {
255
- if (e.detailType === 'unknown' || !e.detailSource)
393
+ if (e.detailType === 'unknown')
256
394
  continue;
395
+ // 다른 패키지의 detail 타입은 그 지정자 그대로 — 이미 «패키지 스펙»이다.
396
+ if (e.detailSpecifier) {
397
+ const types = detailImportMap.get(e.detailSpecifier) || [];
398
+ if (!types.includes(e.detailType))
399
+ types.push(e.detailType);
400
+ detailImportMap.set(e.detailSpecifier, types);
401
+ continue;
402
+ }
403
+ if (!e.detailSource)
404
+ continue; // 인라인 타입(`{ query: string }`) — import 할 것이 없다
257
405
  const absEventSrc = e.detailSource.replace(/\\/g, '/');
258
406
  const eventSrcIndex = absEventSrc.indexOf('/src/');
259
407
  const relFromSrc = eventSrcIndex >= 0
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { UPagination as UPaginationElement } from '@iyulab/components/dist/components/pagination/UPagination.js';
3
+ import { type PageChangeDetail } from '@iyulab/components/dist/components/pagination/UPagination.js';
3
4
 
4
5
  type UPaginationOwnProps = Omit<UPaginationElement, keyof HTMLElement>;
5
6
 
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.20.0",
4
+ "version": "2.20.2",
5
5
  "keywords": [
6
6
  "iyulab",
7
7
  "components",
@@ -10,7 +10,11 @@ Single-date(-time) selection with a popover calendar. `mode="date"` (default) fo
10
10
  convention as the native `input[type=date]`: an ISO `YYYY-MM-DD` string. `mode="datetime"` adds
11
11
  a time-of-day input and the value becomes a complete ISO-8601 `DateTimeOffset` string
12
12
  (`YYYY-MM-DDTHH:mm:ss±HH:mm`, seconds and the browser's local UTC offset always filled in — the
13
- value is unconditionally valid regardless of how coarse the time input was). Form-associated.
13
+ value is unconditionally valid regardless of how coarse the time input was). A value set with any
14
+ other offset — a server's UTC `…Z` — is read as the instant it names and shown in the browser's local
15
+ time, so `2026-09-06T22:22:34Z` shows `2026-09-07 07:22` in Seoul and picking the next day writes the
16
+ same moment one day later. The value keeps the string it was given until the person changes it.
17
+ Form-associated.
14
18
 
15
19
  > The calendar week always starts on Sunday, regardless of locale.
16
20
 
@@ -45,7 +45,9 @@ exported as `parseDateRange` and `formatDateRangeText`.
45
45
 
46
46
  `mode="datetime"` adds a start time and an end time under the calendar (labelled inputs). Each half of
47
47
  the value is then a complete ISO-8601 `DateTimeOffset` — seconds and the browser's local offset are
48
- always filled in — and `start`/`end` return those halves:
48
+ always filled in — and `start`/`end` return those halves. A half written with another offset (a
49
+ server's UTC `…Z`) is read as an instant and shown in the browser's local time, the same as
50
+ `u-date-picker`:
49
51
 
50
52
  ```html
51
53
  <u-date-range-picker name="shift" label="Shift" mode="datetime"