@iyulab/components 3.0.0 → 3.1.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,31 @@
1
1
  # Changelog
2
2
 
3
+ ## [3.1.0] - 2026-11-12
4
+
5
+ ### Added
6
+
7
+ - **`compareText(a, b, locale?)` and `getCollator(locale?)` — one text order for tables and lists.** Digit runs
8
+ inside text compare as numbers (`A-2` before `A-10`, `9` before `10`), case and accents compare as the same letter (equal
9
+ rows keep their input order), and the locale is the app's `Locale.get()` (`<html lang>`, then the browser language, then
10
+ `en`) — not the browser default, so one app orders Hangul and Latin the same way for every user (`Locale.set('ko')` puts
11
+ Hangul first). One `Intl.Collator` is built per locale and reused; a malformed locale tag compares as English instead of
12
+ throwing. The table packages use it for their text columns.
13
+
14
+ ### Fixed
15
+
16
+ - **`u-radio` no longer passes its own host as the `setValidity` anchor.** `ElementInternals.setValidity(flags,
17
+ message, anchor)` requires the anchor to be a shadow-including descendant of the element; the host is not one. Older
18
+ Chromium (the 120 generation) threw `NotFoundError` on every selection, and because the exception interrupted
19
+ validation before the event was dispatched, `change` never fired while `value` had already changed. The anchor is
20
+ now the radiogroup container, like every other form control. Current browsers accept the host, so they were not
21
+ affected.
22
+
23
+ ### Documentation
24
+
25
+ - The README now states the browser floor: browsers that support `:state()` without the `--` prefix (Chrome and
26
+ Edge 125, Firefox 126, Safari 17.4). Below it, form controls throw on `states.add()` and styling that keys on
27
+ states does not apply. The skill overview carries the same line.
28
+
3
29
  ## [3.0.0] - 2026-11-11
4
30
 
5
31
  ### Changed (BREAKING — 3.0)
package/README.md CHANGED
@@ -10,6 +10,13 @@ Lit 기반 웹 컴포넌트 라이브러리.
10
10
  npm install @iyulab/components
11
11
  ```
12
12
 
13
+ ## Browser support
14
+
15
+ 지원 하한은 **`CustomStateSet` 의 `:state()` 를 `--` 접두 없이 지원하는 판**입니다 — Chrome · Edge 125, Firefox 126,
16
+ Safari 17.4 이상. 폼 컨트롤은 `:state(field)` 같은 상태를 `ElementInternals.states` 에 싣고 시트가 그 선택자로 모양을
17
+ 정하므로, 그 아래 판(예: Chromium 120)에서는 `states.add('field')` 가 `--` 접두를 요구하며 던지고 스타일도 어긋납니다.
18
+ 호환 shim 은 두지 않습니다 — 하한을 올리거나, 하한 아래가 꼭 필요하면 알려 주세요.
19
+
13
20
  ## Quick Start
14
21
 
15
22
  아래 파일 하나가 그대로 돌아가는 첫 페이지입니다(Vite 기준 — `index.html` 이 `src/main.ts` 를 모듈로 싣는다).
@@ -118,7 +118,7 @@ var URadio = class URadio extends UFormControlElement {
118
118
  }
119
119
  setValidity() {
120
120
  const missing = this.required && !this.value;
121
- this.commit(missing ? { valueMissing: true } : {}, missing ? Locale.getValue("valueMissing") : "", this);
121
+ this.commit(missing ? { valueMissing: true } : {}, missing ? Locale.getValue("valueMissing") : "", this.renderRoot.querySelector(".container") ?? void 0);
122
122
  }
123
123
  reset() {
124
124
  this.value = void 0;
package/dist/index.d.ts CHANGED
@@ -66,6 +66,7 @@ export * from './events/ShiftEvent';
66
66
  export * from './events/ShowEvent';
67
67
  export * from './utilities/BrowserStorage.js';
68
68
  export * from './utilities/clipboard.js';
69
+ export * from './utilities/collation.js';
69
70
  export * from './utilities/converters.js';
70
71
  export * from './utilities/dateValue.js';
71
72
  export * from './utilities/devWarning.js';
package/dist/index.js CHANGED
@@ -57,6 +57,7 @@ import { UTree } from "./components/tree/UTree.js";
57
57
  import { UTreeItem } from "./components/tree-item/UTreeItem.js";
58
58
  import { BrowserStorage } from "./utilities/BrowserStorage.js";
59
59
  import { copyFromKey, isTextEntry, pasteFromKey } from "./utilities/clipboard.js";
60
+ import { compareText, getCollator } from "./utilities/collation.js";
60
61
  import { arrayAttrConverter, booleanAttrConverter, dateAttrConverter, jsonAttrConverter, urlAttrConverter } from "./utilities/converters.js";
61
62
  import { localOffset, readDateValue, writeInstant, writePlainDate, writePlainDateTime } from "./utilities/dateValue.js";
62
63
  import { createDevWarner, devWarnOnce, resetDevWarnings } from "./utilities/devWarning.js";
@@ -74,4 +75,4 @@ import { OverlayManager } from "./utilities/OverlayManager.js";
74
75
  import { Theme } from "./utilities/Theme.js";
75
76
  import { Toast } from "./utilities/Toast.js";
76
77
  import { decodeDelimited, decodeTsv, encodeTsv } from "./utilities/tsv.js";
77
- export { ALERT_STATUSES, BrowserStorage, CompositionTracker, Dialog, IconCache, IconRegistry, Locale, OverlayManager, Theme, Toast, UAlert, UAutoScroll, UAvatar, UBadge, UBreadcrumb, UBreadcrumbItem, UButton, UButtonGroup, UCard, UCarousel, UCheckbox, UChip, UCommandPalette, UCopyButton, UDatePicker, UDateRangePicker, UDialog, UDivider, UDrawer, UElement, UExpander, UField, UFileInput, UFloatingElement, UForm, UFormControlElement, UIcon, UIconButton, UInput, UMenu, UMenuItem, UOption, UOptionGroup, UOverlayElement, UPagination, UPanel, UPopover, UProgressBar, UProgressRing, URadio, URating, USelect, USkeleton, USlider, USpinner, USplitPanel, USteps, USwitch, UTab, UTabNav, UTabPanel, UTag, UText, UTextarea, UTooltip, UTree, UTreeItem, applyNumberFormat, arrayAttrConverter, booleanAttrConverter, collectOptions, copyFromKey, createDevWarner, dateAttrConverter, dateTextPattern, decodeDelimited, decodeTsv, defaultSearchMatch, delegate, devWarnOnce, encodeTsv, filterCommands, foldForSearch, formatCurrency, formatDate, formatDateRange, formatDateRangeText, formatDateText, formatDateTimeRangeText, formatDateTimeText, formatNumber, getDefaultBaseUrl, getParentElement, hangulKeystrokes, initialsOf, isCoarsePointer, isFocusCandidate, isFromControl, isHangul, isImeComposing, isTextEntry, jsonAttrConverter, listenInShadow, localOffset, parseDate, parseDateRange, parseDateTime, parseDateTimeRange, parseNumber, pasteFromKey, querySelectorAllWithin, querySelectorDeep, querySelectorWithin, readDateValue, replayInput, resetDevWarnings, setDefaultBaseUrl, urlAttrConverter, writeInstant, writePlainDate, writePlainDateTime };
78
+ export { ALERT_STATUSES, BrowserStorage, CompositionTracker, Dialog, IconCache, IconRegistry, Locale, OverlayManager, Theme, Toast, UAlert, UAutoScroll, UAvatar, UBadge, UBreadcrumb, UBreadcrumbItem, UButton, UButtonGroup, UCard, UCarousel, UCheckbox, UChip, UCommandPalette, UCopyButton, UDatePicker, UDateRangePicker, UDialog, UDivider, UDrawer, UElement, UExpander, UField, UFileInput, UFloatingElement, UForm, UFormControlElement, UIcon, UIconButton, UInput, UMenu, UMenuItem, UOption, UOptionGroup, UOverlayElement, UPagination, UPanel, UPopover, UProgressBar, UProgressRing, URadio, URating, USelect, USkeleton, USlider, USpinner, USplitPanel, USteps, USwitch, UTab, UTabNav, UTabPanel, UTag, UText, UTextarea, UTooltip, UTree, UTreeItem, applyNumberFormat, arrayAttrConverter, booleanAttrConverter, collectOptions, compareText, copyFromKey, createDevWarner, dateAttrConverter, dateTextPattern, decodeDelimited, decodeTsv, defaultSearchMatch, delegate, devWarnOnce, encodeTsv, filterCommands, foldForSearch, formatCurrency, formatDate, formatDateRange, formatDateRangeText, formatDateText, formatDateTimeRangeText, formatDateTimeText, formatNumber, getCollator, getDefaultBaseUrl, getParentElement, hangulKeystrokes, initialsOf, isCoarsePointer, isFocusCandidate, isFromControl, isHangul, isImeComposing, isTextEntry, jsonAttrConverter, listenInShadow, localOffset, parseDate, parseDateRange, parseDateTime, parseDateTimeRange, parseNumber, pasteFromKey, querySelectorAllWithin, querySelectorDeep, querySelectorWithin, readDateValue, replayInput, resetDevWarnings, setDefaultBaseUrl, urlAttrConverter, writeInstant, writePlainDate, writePlainDateTime };
@@ -0,0 +1,11 @@
1
+ import { LocaleTag } from './Locale.js';
2
+ /**
3
+ * 로캘의 글자 비교기. `locale` 을 주지 않으면 앱의 활성 로캘(`Locale.get()`)이다.
4
+ * `Intl.Collator#compare` 는 바인딩돼 있어 `array.sort(collator.compare)` 로 바로 쓸 수 있다.
5
+ */
6
+ export declare function getCollator(locale?: LocaleTag): Intl.Collator;
7
+ /**
8
+ * 두 글자를 앱의 순서로 견준다 — 음수 · 0 · 양수. 숫자는 숫자로, 한글 · 라틴의 앞뒤는 `Locale.get()` 이 정한다.
9
+ * 호출마다 `Locale.get()` 을 읽으므로 로캘이 바뀐 뒤의 정렬은 바뀐 순서를 낸다.
10
+ */
11
+ export declare function compareText(a: string, b: string, locale?: LocaleTag): number;
@@ -0,0 +1,52 @@
1
+ import { Locale } from "./Locale.js";
2
+ // src/utilities/collation.ts
3
+ /**
4
+ * 글자 비교 — 표 · 목록이 «글자 열» 을 줄 세울 때 쓰는 하나의 순서.
5
+ *
6
+ * 규칙은 둘이다:
7
+ * - **숫자는 숫자로 견준다**(`numeric`) — 품번 `A-2` 가 `A-10` 앞이다. 사전순(`A-10` < `A-2`)은 품번 · 전표번호에서 바로 틀려 보인다.
8
+ * - **로캘은 앱이 정한 `Locale.get()`** 이다(`<html lang>` → 브라우저 언어 → `en`). 브라우저 기본이 아니다 — 같은 앱이
9
+ * 브라우저 언어가 다른 두 사람에게 다른 순서(한글이 라틴 앞 / 뒤)를 내지 않게 한다.
10
+ *
11
+ * 대소문자와 악센트는 같은 글자로 본다(`sensitivity: 'base'`) — 같은 줄은 입력 순서(안정 정렬)를 그대로 둔다.
12
+ * `Intl.Collator` 는 만드는 값이 비싸므로 로캘별로 한 번만 만들어 둔다.
13
+ */
14
+ var collators = /* @__PURE__ */ new Map();
15
+ /** 마지막으로 쓴 로캘의 collator — 정렬 한 번에 수만 번 부르므로 `Map` 조회도 아낀다. */
16
+ var lastTag;
17
+ var lastCollator;
18
+ function createCollator(tag) {
19
+ const options = {
20
+ numeric: true,
21
+ sensitivity: "base"
22
+ };
23
+ try {
24
+ return new Intl.Collator(tag, options);
25
+ } catch {
26
+ return new Intl.Collator("en", options);
27
+ }
28
+ }
29
+ /**
30
+ * 로캘의 글자 비교기. `locale` 을 주지 않으면 앱의 활성 로캘(`Locale.get()`)이다.
31
+ * `Intl.Collator#compare` 는 바인딩돼 있어 `array.sort(collator.compare)` 로 바로 쓸 수 있다.
32
+ */
33
+ function getCollator(locale) {
34
+ const tag = locale ?? Locale.get();
35
+ if (tag === lastTag && lastCollator) return lastCollator;
36
+ let collator = collators.get(tag);
37
+ if (!collator) {
38
+ collator = createCollator(tag);
39
+ collators.set(tag, collator);
40
+ }
41
+ lastTag = tag;
42
+ lastCollator = collator;
43
+ return collator;
44
+ }
45
+ /**
46
+ * 두 글자를 앱의 순서로 견준다 — 음수 · 0 · 양수. 숫자는 숫자로, 한글 · 라틴의 앞뒤는 `Locale.get()` 이 정한다.
47
+ * 호출마다 `Locale.get()` 을 읽으므로 로캘이 바뀐 뒤의 정렬은 바뀐 순서를 낸다.
48
+ */
49
+ function compareText(a, b, locale) {
50
+ return getCollator(locale).compare(a, b);
51
+ }
52
+ export { compareText, getCollator };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@iyulab/components",
3
3
  "description": "Lit-based UI elements for business web apps: buttons, inputs, selects, date pickers, dialogs, design tokens, theming and a locale registry",
4
- "version": "3.0.0",
4
+ "version": "3.1.0",
5
5
  "keywords": [
6
6
  "iyulab",
7
7
  "components",
@@ -43,6 +43,8 @@ import { UButton, UInput } from '@iyulab/components/react';
43
43
 
44
44
  > For detailed guidance on theming, icon setup, and advanced usage, see [./references/usage.md](./references/usage.md).
45
45
 
46
+ > **Browser support:** the floor is the browsers that support `:state()` without the `--` prefix — Chrome/Edge 125, Firefox 126, Safari 17.4. Form controls expose states through `ElementInternals.states`, which throws on older engines (for example Chromium 120), so there is nothing to polyfill.
47
+
46
48
  > **Direction:** layout follows the document direction — under `dir="rtl"` the prefix/suffix slots, inner padding and borders mirror (logical CSS properties). Placement values that name a physical side (`u-drawer placement="left"`, `u-tab-panel placement`) stay physical. The chevrons a component draws itself mirror too (breadcrumb separator, previous/next in pagination and calendar, the closed marker of expander and tree item, the submenu marker) — a chevron you pass through a `separator` or `expand-icon` slot stays as you drew it. Script-positioned parts follow the pointer and the arrow keys in a right-to-left page (`u-split-panel`, `u-slider`, `u-rating`, `u-carousel`). The badge corner placements stay physical on purpose; the virtualized grid and spreadsheet are mirrored in `@iyulab/flex-table` and `@iyulab/data-components`, and the timeline keeps time left to right.
47
49
 
48
50
  ---
@@ -148,7 +150,7 @@ set on the host yourself always wins and is never overwritten.
148
150
  - [`IconRegistry`](./references/utilities/icons.md) — Register and resolve icon libraries
149
151
  - [`BrowserStorage`](./references/utilities/browser-storage.md) — Unified localStorage / Cookie API
150
152
  - [`converters`](./references/utilities/converters.md) — Lit property attribute converters (array, JSON, date, url…)
151
- - [`Locale`](./references/utilities/locale.md) — Validation-message locale registry and lookup utility · search matching (`matchesSearch` — Hangul jamo and initials)
153
+ - [`Locale`](./references/utilities/locale.md) — Validation-message locale registry and lookup utility · search matching (`matchesSearch` — Hangul jamo and initials) · text order (`compareText` — digit runs as numbers, the app locale)
152
154
  - [`elements`](./references/utilities/elements.md) — Shadow-DOM-aware DOM query helpers
153
155
  - [`format`](./references/utilities/format.md) — Locale-aware number, currency and date formatting
154
156
  - [`number-format`](./references/utilities/number-format.md) — One number format for tables, sheets and widgets: spreadsheet codes or `Intl` options
@@ -101,6 +101,20 @@ Locale.registerSearch('tr', (text, query, options) =>
101
101
  text.toLocaleLowerCase('tr').includes(query.toLocaleLowerCase('tr')) || defaultSearchMatch(text, query, options));
102
102
  ```
103
103
 
104
+ ### Text order
105
+
106
+ `compareText(a, b, locale?)` orders two texts the way a table column should (`getCollator(locale?)` is the
107
+ `Intl.Collator` behind it, one per locale, reusable as `array.sort(collator.compare)`):
108
+
109
+ - Digit runs inside text compare as numbers — `A-2` before `A-10`, `9` before `10`.
110
+ - Case and accents compare as the same letter, so rows that are equal keep their input order.
111
+ - The locale is the app's `Locale.get()` (`<html lang>` → browser language → `en`) unless you pass one — **not**
112
+ the browser's default. One app therefore puts Hangul before or after Latin letters the same way for every user:
113
+ `Locale.set('ko')` puts it first. A malformed tag compares as English instead of throwing.
114
+
115
+ `u-rich-table` (client mode), `flex-table`, the chat table block, `uw-table` and the `dimension-timeline` row
116
+ groups all order text this way — use it for your own sorted lists instead of `localeCompare`.
117
+
104
118
  ## Example
105
119
 
106
120
  ```ts