@llui/components 0.0.4 → 0.0.6

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.
Files changed (149) hide show
  1. package/dist/components/angle-slider.d.ts.map +1 -1
  2. package/dist/components/angle-slider.js +3 -1
  3. package/dist/components/carousel.d.ts +6 -6
  4. package/dist/components/carousel.d.ts.map +1 -1
  5. package/dist/components/carousel.js +10 -7
  6. package/dist/components/cascade-select.d.ts +1 -1
  7. package/dist/components/cascade-select.d.ts.map +1 -1
  8. package/dist/components/cascade-select.js +4 -1
  9. package/dist/components/clipboard.d.ts +1 -1
  10. package/dist/components/clipboard.d.ts.map +1 -1
  11. package/dist/components/clipboard.js +4 -1
  12. package/dist/components/color-picker.d.ts +4 -4
  13. package/dist/components/color-picker.d.ts.map +1 -1
  14. package/dist/components/color-picker.js +7 -4
  15. package/dist/components/combobox.d.ts +1 -1
  16. package/dist/components/combobox.d.ts.map +1 -1
  17. package/dist/components/combobox.js +4 -2
  18. package/dist/components/date-input.d.ts +1 -1
  19. package/dist/components/date-input.d.ts.map +1 -1
  20. package/dist/components/date-input.js +4 -1
  21. package/dist/components/date-picker.d.ts +2 -2
  22. package/dist/components/date-picker.d.ts.map +1 -1
  23. package/dist/components/date-picker.js +9 -18
  24. package/dist/components/dialog.d.ts +1 -1
  25. package/dist/components/dialog.d.ts.map +1 -1
  26. package/dist/components/dialog.js +4 -2
  27. package/dist/components/drawer.d.ts +1 -1
  28. package/dist/components/drawer.d.ts.map +1 -1
  29. package/dist/components/drawer.js +4 -2
  30. package/dist/components/enter-view.d.ts +73 -0
  31. package/dist/components/enter-view.d.ts.map +1 -0
  32. package/dist/components/enter-view.js +51 -0
  33. package/dist/components/file-upload.d.ts +4 -4
  34. package/dist/components/file-upload.d.ts.map +1 -1
  35. package/dist/components/file-upload.js +5 -2
  36. package/dist/components/floating-panel.d.ts +4 -4
  37. package/dist/components/floating-panel.d.ts.map +1 -1
  38. package/dist/components/floating-panel.js +7 -4
  39. package/dist/components/image-cropper.d.ts +1 -1
  40. package/dist/components/image-cropper.d.ts.map +1 -1
  41. package/dist/components/image-cropper.js +4 -1
  42. package/dist/components/in-view.d.ts +69 -0
  43. package/dist/components/in-view.d.ts.map +1 -0
  44. package/dist/components/in-view.js +51 -0
  45. package/dist/components/index.d.ts +2 -0
  46. package/dist/components/index.d.ts.map +1 -1
  47. package/dist/components/index.js +1 -0
  48. package/dist/components/navigation-menu.d.ts +1 -1
  49. package/dist/components/navigation-menu.d.ts.map +1 -1
  50. package/dist/components/navigation-menu.js +4 -1
  51. package/dist/components/number-input.d.ts +2 -2
  52. package/dist/components/number-input.d.ts.map +1 -1
  53. package/dist/components/number-input.js +5 -2
  54. package/dist/components/pagination.d.ts +3 -3
  55. package/dist/components/pagination.d.ts.map +1 -1
  56. package/dist/components/pagination.js +7 -4
  57. package/dist/components/password-input.d.ts.map +1 -1
  58. package/dist/components/password-input.js +8 -3
  59. package/dist/components/pin-input.d.ts.map +1 -1
  60. package/dist/components/pin-input.js +7 -4
  61. package/dist/components/popover.d.ts +1 -1
  62. package/dist/components/popover.d.ts.map +1 -1
  63. package/dist/components/popover.js +4 -2
  64. package/dist/components/progress.d.ts.map +1 -1
  65. package/dist/components/progress.js +2 -1
  66. package/dist/components/qr-code.d.ts +2 -2
  67. package/dist/components/qr-code.d.ts.map +1 -1
  68. package/dist/components/qr-code.js +5 -2
  69. package/dist/components/radio-group.d.ts.map +1 -1
  70. package/dist/components/radio-group.js +3 -1
  71. package/dist/components/rating-group.d.ts.map +1 -1
  72. package/dist/components/rating-group.js +3 -1
  73. package/dist/components/signature-pad.d.ts +3 -3
  74. package/dist/components/signature-pad.d.ts.map +1 -1
  75. package/dist/components/signature-pad.js +6 -3
  76. package/dist/components/slider.d.ts.map +1 -1
  77. package/dist/components/slider.js +3 -1
  78. package/dist/components/splitter.d.ts.map +1 -1
  79. package/dist/components/splitter.js +3 -1
  80. package/dist/components/steps.d.ts +1 -1
  81. package/dist/components/steps.d.ts.map +1 -1
  82. package/dist/components/steps.js +4 -1
  83. package/dist/components/tabs.d.ts.map +1 -1
  84. package/dist/components/tabs.js +3 -1
  85. package/dist/components/tags-input.d.ts +3 -3
  86. package/dist/components/tags-input.d.ts.map +1 -1
  87. package/dist/components/tags-input.js +16 -10
  88. package/dist/components/time-picker.d.ts +4 -4
  89. package/dist/components/time-picker.d.ts.map +1 -1
  90. package/dist/components/time-picker.js +7 -4
  91. package/dist/components/timer.d.ts +3 -3
  92. package/dist/components/timer.d.ts.map +1 -1
  93. package/dist/components/timer.js +6 -3
  94. package/dist/components/toast.d.ts +3 -3
  95. package/dist/components/toast.d.ts.map +1 -1
  96. package/dist/components/toast.js +5 -2
  97. package/dist/components/toc.d.ts +2 -2
  98. package/dist/components/toc.d.ts.map +1 -1
  99. package/dist/components/toc.js +5 -2
  100. package/dist/components/toggle-group.d.ts.map +1 -1
  101. package/dist/components/toggle-group.js +3 -1
  102. package/dist/components/tour.d.ts +1 -1
  103. package/dist/components/tour.d.ts.map +1 -1
  104. package/dist/components/tour.js +4 -1
  105. package/dist/components/tree-view.d.ts.map +1 -1
  106. package/dist/components/tree-view.js +3 -1
  107. package/dist/format/cache.d.ts +3 -0
  108. package/dist/format/cache.d.ts.map +1 -0
  109. package/dist/format/cache.js +24 -0
  110. package/dist/format/defaults.d.ts +3 -0
  111. package/dist/format/defaults.d.ts.map +1 -0
  112. package/dist/format/defaults.js +4 -0
  113. package/dist/format/format-date.d.ts +41 -0
  114. package/dist/format/format-date.d.ts.map +1 -0
  115. package/dist/format/format-date.js +48 -0
  116. package/dist/format/format-display-name.d.ts +9 -0
  117. package/dist/format/format-display-name.d.ts.map +1 -0
  118. package/dist/format/format-display-name.js +21 -0
  119. package/dist/format/format-file-size.d.ts +7 -0
  120. package/dist/format/format-file-size.d.ts.map +1 -0
  121. package/dist/format/format-file-size.js +27 -0
  122. package/dist/format/format-list.d.ts +7 -0
  123. package/dist/format/format-list.d.ts.map +1 -0
  124. package/dist/format/format-list.js +12 -0
  125. package/dist/format/format-number.d.ts +19 -0
  126. package/dist/format/format-number.d.ts.map +1 -0
  127. package/dist/format/format-number.js +37 -0
  128. package/dist/format/format-plural.d.ts +16 -0
  129. package/dist/format/format-plural.d.ts.map +1 -0
  130. package/dist/format/format-plural.js +30 -0
  131. package/dist/format/format-relative-time.d.ts +8 -0
  132. package/dist/format/format-relative-time.d.ts.map +1 -0
  133. package/dist/format/format-relative-time.js +12 -0
  134. package/dist/format/index.d.ts +8 -0
  135. package/dist/format/index.d.ts.map +1 -0
  136. package/dist/format/index.js +7 -0
  137. package/dist/index.d.ts +2 -0
  138. package/dist/index.d.ts.map +1 -1
  139. package/dist/index.js +4 -0
  140. package/dist/locale.d.ts +127 -0
  141. package/dist/locale.d.ts.map +1 -0
  142. package/dist/locale.js +73 -0
  143. package/dist/utils/direction.d.ts +11 -0
  144. package/dist/utils/direction.d.ts.map +1 -0
  145. package/dist/utils/direction.js +26 -0
  146. package/dist/utils/index.d.ts +1 -0
  147. package/dist/utils/index.d.ts.map +1 -1
  148. package/dist/utils/index.js +1 -0
  149. package/package.json +2 -2
@@ -0,0 +1,41 @@
1
+ export type DateValue = Date | string | number;
2
+ type DateStyle = 'full' | 'long' | 'medium' | 'short';
3
+ export interface FormatDateOptions {
4
+ locale?: string;
5
+ dateStyle?: DateStyle;
6
+ calendar?: string;
7
+ numberingSystem?: string;
8
+ timeZone?: string;
9
+ weekday?: 'long' | 'short' | 'narrow';
10
+ year?: 'numeric' | '2-digit';
11
+ month?: 'numeric' | '2-digit' | 'long' | 'short' | 'narrow';
12
+ day?: 'numeric' | '2-digit';
13
+ era?: 'long' | 'short' | 'narrow';
14
+ }
15
+ export interface FormatTimeOptions {
16
+ locale?: string;
17
+ timeStyle?: DateStyle;
18
+ timeZone?: string;
19
+ hour12?: boolean;
20
+ hourCycle?: 'h11' | 'h12' | 'h23' | 'h24';
21
+ hour?: 'numeric' | '2-digit';
22
+ minute?: 'numeric' | '2-digit';
23
+ second?: 'numeric' | '2-digit';
24
+ fractionalSecondDigits?: 0 | 1 | 2 | 3;
25
+ timeZoneName?: 'long' | 'short' | 'shortOffset' | 'longOffset' | 'shortGeneric' | 'longGeneric';
26
+ dayPeriod?: 'narrow' | 'short' | 'long';
27
+ }
28
+ export interface FormatDateTimeOptions {
29
+ locale?: string;
30
+ dateStyle?: DateStyle;
31
+ timeStyle?: DateStyle;
32
+ timeZone?: string;
33
+ calendar?: string;
34
+ hour12?: boolean;
35
+ hourCycle?: 'h11' | 'h12' | 'h23' | 'h24';
36
+ }
37
+ export declare function formatDate(value: DateValue, opts?: FormatDateOptions): string;
38
+ export declare function formatTime(value: DateValue, opts?: FormatTimeOptions): string;
39
+ export declare function formatDateTime(value: DateValue, opts?: FormatDateTimeOptions): string;
40
+ export {};
41
+ //# sourceMappingURL=format-date.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-date.d.ts","sourceRoot":"","sources":["../../src/format/format-date.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,CAAA;AAQ9C,KAAK,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAA;AAErD,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAA;IACrC,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;IAC5B,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAA;IAC3D,GAAG,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;IAC3B,GAAG,CAAC,EA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I,GAAE,qBAA0B,GAAG,MAAM,CAQzF"}
@@ -0,0 +1,48 @@
1
+ import { cached, cacheKey } from './cache';
2
+ import { defaultLocale } from './defaults';
3
+ function toDate(value) {
4
+ if (value instanceof Date)
5
+ return value;
6
+ if (typeof value === 'string')
7
+ return new Date(value);
8
+ return new Date(value);
9
+ }
10
+ function buildIntlOpts(opts) {
11
+ const result = {};
12
+ for (const [k, v] of Object.entries(opts)) {
13
+ if (v !== undefined && k !== 'locale') {
14
+ ;
15
+ result[k] = v;
16
+ }
17
+ }
18
+ return result;
19
+ }
20
+ function fmt(prefix, locale, intlOpts) {
21
+ const key = cacheKey(prefix, locale, intlOpts);
22
+ return cached(key, () => new Intl.DateTimeFormat(locale, intlOpts));
23
+ }
24
+ export function formatDate(value, opts = {}) {
25
+ const locale = opts.locale ?? defaultLocale();
26
+ const hasFineGrained = opts.weekday || opts.year || opts.month || opts.day || opts.era;
27
+ const intlOpts = hasFineGrained
28
+ ? buildIntlOpts(opts)
29
+ : buildIntlOpts({ ...opts, dateStyle: opts.dateStyle ?? 'medium' });
30
+ return fmt('date', locale, intlOpts).format(toDate(value));
31
+ }
32
+ export function formatTime(value, opts = {}) {
33
+ const locale = opts.locale ?? defaultLocale();
34
+ const hasFineGrained = opts.hour || opts.minute || opts.second || opts.fractionalSecondDigits || opts.dayPeriod;
35
+ const intlOpts = hasFineGrained
36
+ ? buildIntlOpts(opts)
37
+ : buildIntlOpts({ ...opts, timeStyle: opts.timeStyle ?? 'medium' });
38
+ return fmt('time', locale, intlOpts).format(toDate(value));
39
+ }
40
+ export function formatDateTime(value, opts = {}) {
41
+ const locale = opts.locale ?? defaultLocale();
42
+ const intlOpts = buildIntlOpts({
43
+ ...opts,
44
+ dateStyle: opts.dateStyle ?? 'medium',
45
+ timeStyle: opts.timeStyle ?? 'short',
46
+ });
47
+ return fmt('dt', locale, intlOpts).format(toDate(value));
48
+ }
@@ -0,0 +1,9 @@
1
+ export type DisplayNameType = 'language' | 'region' | 'script' | 'currency' | 'calendar' | 'dateTimeField';
2
+ export interface FormatDisplayNameOptions {
3
+ locale?: string;
4
+ style?: 'long' | 'short' | 'narrow';
5
+ languageDisplay?: 'dialect' | 'standard';
6
+ fallback?: 'code' | 'none';
7
+ }
8
+ export declare function formatDisplayName(value: string, type: DisplayNameType, opts?: FormatDisplayNameOptions): string | undefined;
9
+ //# sourceMappingURL=format-display-name.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-display-name.d.ts","sourceRoot":"","sources":["../../src/format/format-display-name.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,eAAe,GACvB,UAAU,GACV,QAAQ,GACR,QAAQ,GACR,UAAU,GACV,UAAU,GACV,eAAe,CAAA;AAEnB,MAAM,WAAW,wBAAwB;IACvC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAA;IACnC,eAAe,CAAC,EAAE,SAAS,GAAG,UAAU,CAAA;IACxC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAC3B;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,eAAe,EACrB,IAAI,GAAE,wBAA6B,GAClC,MAAM,GAAG,SAAS,CAiBpB"}
@@ -0,0 +1,21 @@
1
+ import { cached, cacheKey } from './cache';
2
+ import { defaultLocale } from './defaults';
3
+ export function formatDisplayName(value, type, opts = {}) {
4
+ const locale = opts.locale ?? defaultLocale();
5
+ const intlOpts = {
6
+ type,
7
+ style: opts.style ?? 'long',
8
+ fallback: opts.fallback ?? 'code',
9
+ };
10
+ if (opts.languageDisplay !== undefined && type === 'language') {
11
+ intlOpts.languageDisplay = opts.languageDisplay;
12
+ }
13
+ const key = cacheKey('dn', locale, { ...intlOpts });
14
+ const dn = cached(key, () => new Intl.DisplayNames(locale, intlOpts));
15
+ try {
16
+ return dn.of(value);
17
+ }
18
+ catch {
19
+ return opts.fallback === 'none' ? undefined : value;
20
+ }
21
+ }
@@ -0,0 +1,7 @@
1
+ export interface FormatFileSizeOptions {
2
+ locale?: string;
3
+ units?: string[];
4
+ decimalPlaces?: number;
5
+ }
6
+ export declare function formatFileSize(value: number | bigint, opts?: FormatFileSizeOptions): string;
7
+ //# sourceMappingURL=format-file-size.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-file-size.d.ts","sourceRoot":"","sources":["../../src/format/format-file-size.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,GAAE,qBAA0B,GAAG,MAAM,CA4B/F"}
@@ -0,0 +1,27 @@
1
+ import { cached, cacheKey } from './cache';
2
+ import { defaultLocale } from './defaults';
3
+ const DEFAULT_UNITS = ['B', 'KB', 'MB', 'GB', 'TB'];
4
+ export function formatFileSize(value, opts = {}) {
5
+ const locale = opts.locale ?? defaultLocale();
6
+ const units = opts.units ?? DEFAULT_UNITS;
7
+ const decimals = opts.decimalPlaces ?? 1;
8
+ let num = typeof value === 'bigint' ? Number(value) : value;
9
+ let unitIndex = 0;
10
+ while (num >= 1024 && unitIndex < units.length - 1) {
11
+ num /= 1024;
12
+ unitIndex++;
13
+ }
14
+ const fractionDigits = unitIndex === 0 ? 0 : decimals;
15
+ const intlOpts = {
16
+ minimumFractionDigits: fractionDigits,
17
+ maximumFractionDigits: fractionDigits,
18
+ };
19
+ const key = cacheKey('fs', locale, intlOpts);
20
+ const fmt = cached(key, () => new Intl.NumberFormat(locale, intlOpts));
21
+ const formatted = fmt.format(num);
22
+ // Strip trailing zeros when using default decimal places
23
+ const display = opts.decimalPlaces === undefined && unitIndex > 0
24
+ ? formatted.replace(/([.,]\d*?)0+$/, '$1').replace(/[.,]$/, '')
25
+ : formatted;
26
+ return `${display} ${units[unitIndex]}`;
27
+ }
@@ -0,0 +1,7 @@
1
+ export interface FormatListOptions {
2
+ locale?: string;
3
+ type?: 'conjunction' | 'disjunction' | 'unit';
4
+ style?: 'long' | 'short' | 'narrow';
5
+ }
6
+ export declare function formatList(value: string[], opts?: FormatListOptions): string;
7
+ //# sourceMappingURL=format-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-list.d.ts","sourceRoot":"","sources":["../../src/format/format-list.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,aAAa,GAAG,aAAa,GAAG,MAAM,CAAA;IAC7C,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAA;CACpC;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,GAAE,iBAAsB,GAAG,MAAM,CAShF"}
@@ -0,0 +1,12 @@
1
+ import { cached, cacheKey } from './cache';
2
+ import { defaultLocale } from './defaults';
3
+ export function formatList(value, opts = {}) {
4
+ const locale = opts.locale ?? defaultLocale();
5
+ const intlOpts = {
6
+ type: opts.type ?? 'conjunction',
7
+ style: opts.style ?? 'long',
8
+ };
9
+ const key = cacheKey('list', locale, intlOpts);
10
+ const fmt = cached(key, () => new Intl.ListFormat(locale, intlOpts));
11
+ return fmt.format(value);
12
+ }
@@ -0,0 +1,19 @@
1
+ export interface FormatNumberOptions {
2
+ locale?: string;
3
+ style?: 'decimal' | 'currency' | 'percent' | 'unit';
4
+ currency?: string;
5
+ currencyDisplay?: 'symbol' | 'narrowSymbol' | 'code' | 'name';
6
+ signDisplay?: 'auto' | 'never' | 'always' | 'exceptZero';
7
+ notation?: 'standard' | 'scientific' | 'engineering' | 'compact';
8
+ compactDisplay?: 'short' | 'long';
9
+ unit?: string;
10
+ unitDisplay?: 'short' | 'long' | 'narrow';
11
+ useGrouping?: boolean;
12
+ minimumIntegerDigits?: number;
13
+ minimumFractionDigits?: number;
14
+ maximumFractionDigits?: number;
15
+ minimumSignificantDigits?: number;
16
+ maximumSignificantDigits?: number;
17
+ }
18
+ export declare function formatNumber(value: number, opts?: FormatNumberOptions): string;
19
+ //# sourceMappingURL=format-number.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-number.d.ts","sourceRoot":"","sources":["../../src/format/format-number.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAA;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,eAAe,CAAC,EAAE,QAAQ,GAAG,cAAc,GAAG,MAAM,GAAG,MAAM,CAAA;IAC7D,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,YAAY,CAAA;IACxD,QAAQ,CAAC,EAAE,UAAU,GAAG,YAAY,GAAG,aAAa,GAAG,SAAS,CAAA;IAChE,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IACjC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAA;IACzC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC,wBAAwB,CAAC,EAAE,MAAM,CAAA;CAClC;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE,mBAAwB,GAAG,MAAM,CA0BlF"}
@@ -0,0 +1,37 @@
1
+ import { cached, cacheKey } from './cache';
2
+ import { defaultLocale } from './defaults';
3
+ export function formatNumber(value, opts = {}) {
4
+ const locale = opts.locale ?? defaultLocale();
5
+ const intlOpts = {};
6
+ if (opts.style !== undefined)
7
+ intlOpts.style = opts.style;
8
+ if (opts.currency !== undefined)
9
+ intlOpts.currency = opts.currency;
10
+ if (opts.currencyDisplay !== undefined)
11
+ intlOpts.currencyDisplay = opts.currencyDisplay;
12
+ if (opts.signDisplay !== undefined)
13
+ intlOpts.signDisplay = opts.signDisplay;
14
+ if (opts.notation !== undefined)
15
+ intlOpts.notation = opts.notation;
16
+ if (opts.compactDisplay !== undefined)
17
+ intlOpts.compactDisplay = opts.compactDisplay;
18
+ if (opts.unit !== undefined)
19
+ intlOpts.unit = opts.unit;
20
+ if (opts.unitDisplay !== undefined)
21
+ intlOpts.unitDisplay = opts.unitDisplay;
22
+ if (opts.useGrouping !== undefined)
23
+ intlOpts.useGrouping = opts.useGrouping;
24
+ if (opts.minimumIntegerDigits !== undefined)
25
+ intlOpts.minimumIntegerDigits = opts.minimumIntegerDigits;
26
+ if (opts.minimumFractionDigits !== undefined)
27
+ intlOpts.minimumFractionDigits = opts.minimumFractionDigits;
28
+ if (opts.maximumFractionDigits !== undefined)
29
+ intlOpts.maximumFractionDigits = opts.maximumFractionDigits;
30
+ if (opts.minimumSignificantDigits !== undefined)
31
+ intlOpts.minimumSignificantDigits = opts.minimumSignificantDigits;
32
+ if (opts.maximumSignificantDigits !== undefined)
33
+ intlOpts.maximumSignificantDigits = opts.maximumSignificantDigits;
34
+ const key = cacheKey('num', locale, intlOpts);
35
+ const fmt = cached(key, () => new Intl.NumberFormat(locale, intlOpts));
36
+ return fmt.format(value);
37
+ }
@@ -0,0 +1,16 @@
1
+ export type PluralCategory = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';
2
+ export type PluralMessages = Partial<Record<PluralCategory, string>> & {
3
+ other: string;
4
+ };
5
+ export interface FormatPluralOptions {
6
+ locale?: string;
7
+ type?: 'cardinal' | 'ordinal';
8
+ minimumIntegerDigits?: number;
9
+ minimumFractionDigits?: number;
10
+ maximumFractionDigits?: number;
11
+ minimumSignificantDigits?: number;
12
+ maximumSignificantDigits?: number;
13
+ }
14
+ export declare function resolvePluralCategory(value: number, opts?: FormatPluralOptions): PluralCategory;
15
+ export declare function formatPlural(value: number, messages: PluralMessages, opts?: FormatPluralOptions): string;
16
+ //# sourceMappingURL=format-plural.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-plural.d.ts","sourceRoot":"","sources":["../../src/format/format-plural.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,CAAA;AAC9E,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAExF,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,UAAU,GAAG,SAAS,CAAA;IAC7B,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,wBAAwB,CAAC,EAAE,MAAM,CAAA;IACjC,wBAAwB,CAAC,EAAE,MAAM,CAAA;CAClC;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,IAAI,GAAE,mBAAwB,GAC7B,cAAc,CAiBhB;AAED,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,cAAc,EACxB,IAAI,GAAE,mBAAwB,GAC7B,MAAM,CASR"}
@@ -0,0 +1,30 @@
1
+ import { cached, cacheKey } from './cache';
2
+ import { defaultLocale } from './defaults';
3
+ export function resolvePluralCategory(value, opts = {}) {
4
+ const locale = opts.locale ?? defaultLocale();
5
+ const intlOpts = { type: opts.type ?? 'cardinal' };
6
+ if (opts.minimumIntegerDigits !== undefined)
7
+ intlOpts.minimumIntegerDigits = opts.minimumIntegerDigits;
8
+ if (opts.minimumFractionDigits !== undefined)
9
+ intlOpts.minimumFractionDigits = opts.minimumFractionDigits;
10
+ if (opts.maximumFractionDigits !== undefined)
11
+ intlOpts.maximumFractionDigits = opts.maximumFractionDigits;
12
+ if (opts.minimumSignificantDigits !== undefined)
13
+ intlOpts.minimumSignificantDigits = opts.minimumSignificantDigits;
14
+ if (opts.maximumSignificantDigits !== undefined)
15
+ intlOpts.maximumSignificantDigits = opts.maximumSignificantDigits;
16
+ const key = cacheKey('plural', locale, intlOpts);
17
+ const rules = cached(key, () => new Intl.PluralRules(locale, intlOpts));
18
+ return rules.select(value);
19
+ }
20
+ export function formatPlural(value, messages, opts = {}) {
21
+ // Check for explicit zero/one/two messages before CLDR rules
22
+ // (English PluralRules returns 'other' for 0, but apps may want a 'zero' message)
23
+ if (value === 0 && messages.zero !== undefined)
24
+ return messages.zero;
25
+ const category = resolvePluralCategory(value, opts);
26
+ const template = messages[category] ?? messages.other;
27
+ const locale = opts.locale ?? defaultLocale();
28
+ const formatted = new Intl.NumberFormat(locale).format(value);
29
+ return template.replace(/\{count\}/g, formatted);
30
+ }
@@ -0,0 +1,8 @@
1
+ export type RelativeTimeUnit = 'year' | 'quarter' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second';
2
+ export interface FormatRelativeTimeOptions {
3
+ locale?: string;
4
+ numeric?: 'always' | 'auto';
5
+ style?: 'long' | 'short' | 'narrow';
6
+ }
7
+ export declare function formatRelativeTime(value: number, unit: RelativeTimeUnit, opts?: FormatRelativeTimeOptions): string;
8
+ //# sourceMappingURL=format-relative-time.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-relative-time.d.ts","sourceRoot":"","sources":["../../src/format/format-relative-time.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,gBAAgB,GACxB,MAAM,GACN,SAAS,GACT,OAAO,GACP,MAAM,GACN,KAAK,GACL,MAAM,GACN,QAAQ,GACR,QAAQ,CAAA;AAEZ,MAAM,WAAW,yBAAyB;IACxC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAA;IAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAA;CACpC;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,gBAAgB,EACtB,IAAI,GAAE,yBAA8B,GACnC,MAAM,CASR"}
@@ -0,0 +1,12 @@
1
+ import { cached, cacheKey } from './cache';
2
+ import { defaultLocale } from './defaults';
3
+ export function formatRelativeTime(value, unit, opts = {}) {
4
+ const locale = opts.locale ?? defaultLocale();
5
+ const intlOpts = {
6
+ numeric: opts.numeric ?? 'auto',
7
+ style: opts.style ?? 'long',
8
+ };
9
+ const key = cacheKey('rel', locale, intlOpts);
10
+ const fmt = cached(key, () => new Intl.RelativeTimeFormat(locale, intlOpts));
11
+ return fmt.format(value, unit);
12
+ }
@@ -0,0 +1,8 @@
1
+ export { formatNumber, type FormatNumberOptions } from './format-number';
2
+ export { formatDate, formatTime, formatDateTime, type DateValue, type FormatDateOptions, type FormatTimeOptions, type FormatDateTimeOptions, } from './format-date';
3
+ export { formatRelativeTime, type RelativeTimeUnit, type FormatRelativeTimeOptions, } from './format-relative-time';
4
+ export { formatList, type FormatListOptions } from './format-list';
5
+ export { formatPlural, resolvePluralCategory, type PluralCategory, type PluralMessages, type FormatPluralOptions, } from './format-plural';
6
+ export { formatDisplayName, type DisplayNameType, type FormatDisplayNameOptions, } from './format-display-name';
7
+ export { formatFileSize, type FormatFileSizeOptions } from './format-file-size';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/format/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AACxE,OAAO,EACL,UAAU,EACV,UAAU,EACV,cAAc,EACd,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,GAC3B,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,kBAAkB,EAClB,KAAK,gBAAgB,EACrB,KAAK,yBAAyB,GAC/B,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAClE,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,mBAAmB,GACzB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,iBAAiB,EACjB,KAAK,eAAe,EACpB,KAAK,wBAAwB,GAC9B,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAA"}
@@ -0,0 +1,7 @@
1
+ export { formatNumber } from './format-number';
2
+ export { formatDate, formatTime, formatDateTime, } from './format-date';
3
+ export { formatRelativeTime, } from './format-relative-time';
4
+ export { formatList } from './format-list';
5
+ export { formatPlural, resolvePluralCategory, } from './format-plural';
6
+ export { formatDisplayName, } from './format-display-name';
7
+ export { formatFileSize } from './format-file-size';
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export { en, LocaleContext, type Locale } from './locale';
2
+ export * from './format/index';
1
3
  export * from './utils/index';
2
4
  export * from './components/index';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,eAAe,CAAA;AAE7B,cAAc,oBAAoB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,aAAa,EAAE,KAAK,MAAM,EAAE,MAAM,UAAU,CAAA;AAEzD,cAAc,gBAAgB,CAAA;AAE9B,cAAc,eAAe,CAAA;AAE7B,cAAc,oBAAoB,CAAA"}
package/dist/index.js CHANGED
@@ -1,3 +1,7 @@
1
+ // Locale
2
+ export { en, LocaleContext } from './locale';
3
+ // Format utilities
4
+ export * from './format/index';
1
5
  // Utilities — re-exported from @llui/components/utils for convenience.
2
6
  export * from './utils/index';
3
7
  // Components
@@ -0,0 +1,127 @@
1
+ /** Per-component locale strings. Only components with user-facing text have entries. */
2
+ export interface Locale {
3
+ carousel: {
4
+ label: string;
5
+ indicators: string;
6
+ next: string;
7
+ prev: string;
8
+ slide: (index: number) => string;
9
+ goToSlide: (index: number) => string;
10
+ };
11
+ cascadeSelect: {
12
+ clear: string;
13
+ };
14
+ clipboard: {
15
+ copy: string;
16
+ };
17
+ colorPicker: {
18
+ hue: string;
19
+ saturation: string;
20
+ lightness: string;
21
+ hex: string;
22
+ };
23
+ combobox: {
24
+ toggle: string;
25
+ };
26
+ dateInput: {
27
+ clear: string;
28
+ };
29
+ datePicker: {
30
+ prev: string;
31
+ next: string;
32
+ monthNames: string[];
33
+ grid: (year: number, month: number) => string;
34
+ };
35
+ dialog: {
36
+ close: string;
37
+ };
38
+ drawer: {
39
+ close: string;
40
+ };
41
+ fileUpload: {
42
+ remove: string;
43
+ clear: string;
44
+ };
45
+ floatingPanel: {
46
+ label: string;
47
+ minimize: string;
48
+ maximize: string;
49
+ close: string;
50
+ };
51
+ imageCropper: {
52
+ reset: string;
53
+ };
54
+ navigationMenu: {
55
+ label: string;
56
+ };
57
+ numberInput: {
58
+ increment: string;
59
+ decrement: string;
60
+ };
61
+ pagination: {
62
+ label: string;
63
+ prev: string;
64
+ next: string;
65
+ page: (n: number) => string;
66
+ };
67
+ passwordInput: {
68
+ show: string;
69
+ hide: string;
70
+ };
71
+ pinInput: {
72
+ input: (index: number) => string;
73
+ };
74
+ popover: {
75
+ close: string;
76
+ };
77
+ progress: {
78
+ loading: string;
79
+ };
80
+ qrCode: {
81
+ label: string;
82
+ download: string;
83
+ };
84
+ signaturePad: {
85
+ label: string;
86
+ clear: string;
87
+ undo: string;
88
+ };
89
+ steps: {
90
+ label: string;
91
+ };
92
+ tagsInput: {
93
+ input: string;
94
+ remove: string;
95
+ clear: string;
96
+ };
97
+ timePicker: {
98
+ label: string;
99
+ hours: string;
100
+ minutes: string;
101
+ period: string;
102
+ };
103
+ timer: {
104
+ start: string;
105
+ pause: string;
106
+ reset: string;
107
+ };
108
+ toast: {
109
+ region: string;
110
+ dismiss: string;
111
+ };
112
+ toc: {
113
+ label: string;
114
+ expand: string;
115
+ };
116
+ tour: {
117
+ close: string;
118
+ };
119
+ }
120
+ /** English locale — used as the default when no provider is in the tree. */
121
+ export declare const en: Locale;
122
+ /**
123
+ * Locale context. Components read from this via `useContext(LocaleContext)`.
124
+ * English defaults are provided — apps that don't call `provide()` get English for free.
125
+ */
126
+ export declare const LocaleContext: import("@llui/dom").Context<Locale>;
127
+ //# sourceMappingURL=locale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale.d.ts","sourceRoot":"","sources":["../src/locale.ts"],"names":[],"mappings":"AAEA,wFAAwF;AACxF,MAAM,WAAW,MAAM;IACrB,QAAQ,EAAE;QACR,KAAK,EAAE,MAAM,CAAA;QACb,UAAU,EAAE,MAAM,CAAA;QAClB,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,MAAM,CAAA;QACZ,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;QAChC,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;KACrC,CAAA;IACD,aAAa,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;IAChC,SAAS,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;IAC3B,WAAW,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC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MAmDhB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,qCAA4B,CAAA"}
package/dist/locale.js ADDED
@@ -0,0 +1,73 @@
1
+ import { createContext } from '@llui/dom';
2
+ const MONTH_NAMES = [
3
+ 'January',
4
+ 'February',
5
+ 'March',
6
+ 'April',
7
+ 'May',
8
+ 'June',
9
+ 'July',
10
+ 'August',
11
+ 'September',
12
+ 'October',
13
+ 'November',
14
+ 'December',
15
+ ];
16
+ /** English locale — used as the default when no provider is in the tree. */
17
+ export const en = {
18
+ carousel: {
19
+ label: 'Carousel',
20
+ indicators: 'Slide indicators',
21
+ next: 'Next slide',
22
+ prev: 'Previous slide',
23
+ slide: (i) => `Slide ${i + 1}`,
24
+ goToSlide: (i) => `Go to slide ${i + 1}`,
25
+ },
26
+ cascadeSelect: { clear: 'Clear selection' },
27
+ clipboard: { copy: 'Copy to clipboard' },
28
+ colorPicker: { hue: 'Hue', saturation: 'Saturation', lightness: 'Lightness', hex: 'Hex color' },
29
+ combobox: { toggle: 'Toggle options' },
30
+ dateInput: { clear: 'Clear date' },
31
+ datePicker: {
32
+ prev: 'Previous month',
33
+ next: 'Next month',
34
+ monthNames: MONTH_NAMES,
35
+ grid: (y, m) => `${MONTH_NAMES[m - 1]} ${y}`,
36
+ },
37
+ dialog: { close: 'Close' },
38
+ drawer: { close: 'Close' },
39
+ fileUpload: { remove: 'Remove file', clear: 'Clear files' },
40
+ floatingPanel: {
41
+ label: 'Floating panel',
42
+ minimize: 'Minimize',
43
+ maximize: 'Maximize',
44
+ close: 'Close',
45
+ },
46
+ imageCropper: { reset: 'Reset crop' },
47
+ navigationMenu: { label: 'Main navigation' },
48
+ numberInput: { increment: 'Increase value', decrement: 'Decrease value' },
49
+ pagination: {
50
+ label: 'Pagination',
51
+ prev: 'Previous page',
52
+ next: 'Next page',
53
+ page: (n) => `Page ${n}`,
54
+ },
55
+ passwordInput: { show: 'Show password', hide: 'Hide password' },
56
+ pinInput: { input: (i) => `Digit ${i + 1}` },
57
+ popover: { close: 'Close' },
58
+ progress: { loading: 'Loading\u2026' },
59
+ qrCode: { label: 'QR code', download: 'Download QR code' },
60
+ signaturePad: { label: 'Signature pad', clear: 'Clear signature', undo: 'Undo last stroke' },
61
+ steps: { label: 'Progress' },
62
+ tagsInput: { input: 'Add tag', remove: 'Remove tag', clear: 'Clear all tags' },
63
+ timePicker: { label: 'Time', hours: 'Hours', minutes: 'Minutes', period: 'Toggle AM/PM' },
64
+ timer: { start: 'Start timer', pause: 'Pause timer', reset: 'Reset timer' },
65
+ toast: { region: 'Notifications', dismiss: 'Dismiss notification' },
66
+ toc: { label: 'Table of contents', expand: 'Toggle section' },
67
+ tour: { close: 'Close tour' },
68
+ };
69
+ /**
70
+ * Locale context. Components read from this via `useContext(LocaleContext)`.
71
+ * English defaults are provided — apps that don't call `provide()` get English for free.
72
+ */
73
+ export const LocaleContext = createContext(en);
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Resolve the text direction for an element by walking up the DOM tree.
3
+ * Returns 'rtl' or 'ltr' (default).
4
+ */
5
+ export declare function resolveDir(el: Element): 'ltr' | 'rtl';
6
+ /**
7
+ * Map an arrow key to its logical direction, accounting for RTL.
8
+ * In RTL, ArrowLeft and ArrowRight swap; vertical arrows are unchanged.
9
+ */
10
+ export declare function flipArrow(key: string, el: Element | null): string;
11
+ //# sourceMappingURL=direction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"direction.d.ts","sourceRoot":"","sources":["../../src/utils/direction.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,OAAO,GAAG,KAAK,GAAG,KAAK,CAKrD;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,GAAG,IAAI,GAAG,MAAM,CAMjE"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Resolve the text direction for an element by walking up the DOM tree.
3
+ * Returns 'rtl' or 'ltr' (default).
4
+ */
5
+ export function resolveDir(el) {
6
+ const ancestor = el.closest('[dir]');
7
+ if (ancestor)
8
+ return ancestor.getAttribute('dir') === 'rtl' ? 'rtl' : 'ltr';
9
+ if (typeof document !== 'undefined' && document.documentElement.dir === 'rtl')
10
+ return 'rtl';
11
+ return 'ltr';
12
+ }
13
+ /**
14
+ * Map an arrow key to its logical direction, accounting for RTL.
15
+ * In RTL, ArrowLeft and ArrowRight swap; vertical arrows are unchanged.
16
+ */
17
+ export function flipArrow(key, el) {
18
+ if (key !== 'ArrowLeft' && key !== 'ArrowRight')
19
+ return key;
20
+ if (!el)
21
+ return key;
22
+ const rtl = resolveDir(el) === 'rtl';
23
+ if (!rtl)
24
+ return key;
25
+ return key === 'ArrowLeft' ? 'ArrowRight' : 'ArrowLeft';
26
+ }
@@ -15,4 +15,5 @@ export type { FloatingOptions, Placement } from './floating';
15
15
  export { typeaheadAccumulate, typeaheadMatch, typeaheadMatchByItems, isTypeaheadKey, TYPEAHEAD_TIMEOUT_MS, } from './typeahead';
16
16
  export { TreeCollection } from './tree-collection';
17
17
  export type { TreeNode } from './tree-collection';
18
+ export { resolveDir, flipArrow } from './direction';
18
19
  //# sourceMappingURL=index.d.ts.map