@tempots/beatui 0.6.0 → 0.8.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.
Files changed (58) hide show
  1. package/dist/ar-zUaskoUZ.js +44 -0
  2. package/dist/beatui.css +1 -1
  3. package/dist/de-C0vbdZdj.js +44 -0
  4. package/dist/es-BALLrljC.js +44 -0
  5. package/dist/fa-4g9jzgMM.js +44 -0
  6. package/dist/fr-CzyXyFEo.js +44 -0
  7. package/dist/he-CBxtA7rr.js +44 -0
  8. package/dist/hi-B6LQz-RO.js +44 -0
  9. package/dist/index.es.js +2515 -2318
  10. package/dist/index.umd.js +40 -40
  11. package/dist/it-CFHKs1al.js +44 -0
  12. package/dist/ja-D6tNi1ze.js +45 -0
  13. package/dist/ko-71CknADn.js +44 -0
  14. package/dist/nl-CnSz3Cp_.js +45 -0
  15. package/dist/pl-og-2JJLB.js +45 -0
  16. package/dist/pt-M61qKkTf.js +44 -0
  17. package/dist/ru-CIn0tYwk.js +45 -0
  18. package/dist/tr-BXwpkxgd.js +44 -0
  19. package/dist/types/beatui-i18n/default.d.ts +42 -0
  20. package/dist/types/beatui-i18n/index.d.ts +2 -0
  21. package/dist/types/beatui-i18n/locales/ar.d.ts +3 -0
  22. package/dist/types/beatui-i18n/locales/de.d.ts +3 -0
  23. package/dist/types/beatui-i18n/locales/en.d.ts +41 -0
  24. package/dist/types/beatui-i18n/locales/es.d.ts +3 -0
  25. package/dist/types/beatui-i18n/locales/fa.d.ts +3 -0
  26. package/dist/types/beatui-i18n/locales/fr.d.ts +3 -0
  27. package/dist/types/beatui-i18n/locales/he.d.ts +3 -0
  28. package/dist/types/beatui-i18n/locales/hi.d.ts +3 -0
  29. package/dist/types/beatui-i18n/locales/it.d.ts +3 -0
  30. package/dist/types/beatui-i18n/locales/ja.d.ts +3 -0
  31. package/dist/types/beatui-i18n/locales/ko.d.ts +3 -0
  32. package/dist/types/beatui-i18n/locales/nl.d.ts +3 -0
  33. package/dist/types/beatui-i18n/locales/pl.d.ts +3 -0
  34. package/dist/types/beatui-i18n/locales/pt.d.ts +3 -0
  35. package/dist/types/beatui-i18n/locales/ru.d.ts +3 -0
  36. package/dist/types/beatui-i18n/locales/tr.d.ts +3 -0
  37. package/dist/types/beatui-i18n/locales/ur.d.ts +3 -0
  38. package/dist/types/beatui-i18n/locales/vi.d.ts +3 -0
  39. package/dist/types/beatui-i18n/locales/zh.d.ts +3 -0
  40. package/dist/types/beatui-i18n/translations.d.ts +40 -0
  41. package/dist/types/components/beatui.d.ts +2 -0
  42. package/dist/types/components/i18n/index.d.ts +3 -0
  43. package/dist/types/components/i18n/locale-direction.d.ts +4 -0
  44. package/dist/types/components/i18n/locale-selector.d.ts +12 -0
  45. package/dist/types/{i18n → components/i18n}/locale.d.ts +8 -1
  46. package/dist/types/components/i18n/make-i18nprovider.d.ts +8 -0
  47. package/dist/types/components/navigation/index.d.ts +0 -1
  48. package/dist/types/components/overlay/drawer.d.ts +1 -1
  49. package/dist/types/i18n/direction.d.ts +117 -0
  50. package/dist/types/i18n/index.d.ts +6 -3
  51. package/dist/types/i18n/translate.d.ts +2 -2
  52. package/dist/types/index.d.ts +3 -0
  53. package/dist/types/tokens/colors.d.ts +1 -1
  54. package/dist/ur-B7AcyGH1.js +44 -0
  55. package/dist/vi-CaJ4-itr.js +44 -0
  56. package/dist/zh-cAmOB1FQ.js +44 -0
  57. package/package.json +2 -2
  58. package/dist/types/components/navigation/menu/menu.d.ts +0 -6
@@ -4,7 +4,7 @@ export interface DrawerOptions {
4
4
  /** Size of the drawer */
5
5
  size?: Value<'sm' | 'md' | 'lg' | 'xl'>;
6
6
  /** Side of the viewport/element to anchor the drawer to */
7
- side?: Value<'top' | 'right' | 'bottom' | 'left'>;
7
+ side?: Value<'top' | 'right' | 'bottom' | 'left' | 'inline-start' | 'inline-end'>;
8
8
  /** Whether the drawer can be closed by clicking outside or pressing escape */
9
9
  dismissable?: Value<boolean>;
10
10
  /** Whether to show the close button in header (only applies if header is provided) */
@@ -0,0 +1,117 @@
1
+ /**
2
+ * @fileoverview Direction utilities for RTL/LTR support
3
+ *
4
+ * Provides utilities for detecting and managing text directionality
5
+ * based on locale and user preferences.
6
+ */
7
+ /**
8
+ * Text direction values
9
+ */
10
+ export type DirectionValue = 'ltr' | 'rtl';
11
+ /**
12
+ * Direction preference options
13
+ * - 'auto': Automatically detect from locale
14
+ * - 'ltr': Force left-to-right
15
+ * - 'rtl': Force right-to-left
16
+ */
17
+ export type DirectionPreference = 'auto' | 'ltr' | 'rtl';
18
+ /**
19
+ * Detects text direction from a locale string
20
+ *
21
+ * @param locale - Locale string (e.g., 'en-US', 'ar-SA', 'he-IL')
22
+ * @returns Direction value ('ltr' or 'rtl')
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * getDirectionFromLocale('en-US') // 'ltr'
27
+ * getDirectionFromLocale('ar-SA') // 'rtl'
28
+ * getDirectionFromLocale('he') // 'rtl'
29
+ * ```
30
+ */
31
+ export declare function getDirectionFromLocale(locale: string): DirectionValue;
32
+ /**
33
+ * Resolves the final direction based on preference and locale
34
+ *
35
+ * @param preference - User's direction preference
36
+ * @param locale - Current locale string
37
+ * @returns Final direction value
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * resolveDirection('auto', 'ar-SA') // 'rtl'
42
+ * resolveDirection('ltr', 'ar-SA') // 'ltr' (forced)
43
+ * resolveDirection('rtl', 'en-US') // 'rtl' (forced)
44
+ * ```
45
+ */
46
+ export declare function resolveDirection(preference: DirectionPreference, locale: string): DirectionValue;
47
+ /**
48
+ * Generates CSS class name for direction
49
+ *
50
+ * @param direction - Direction value
51
+ * @returns CSS class name
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * getDirectionClassName('ltr') // 'b-ltr'
56
+ * getDirectionClassName('rtl') // 'b-rtl'
57
+ * ```
58
+ */
59
+ export declare function getDirectionClassName(direction: DirectionValue): string;
60
+ /**
61
+ * Checks if a locale is RTL
62
+ *
63
+ * @param locale - Locale string to check
64
+ * @returns True if the locale is RTL
65
+ *
66
+ * @example
67
+ * ```typescript
68
+ * isRTLLocale('ar-SA') // true
69
+ * isRTLLocale('en-US') // false
70
+ * ```
71
+ */
72
+ export declare function isRTLLocale(locale: string): boolean;
73
+ /**
74
+ * Gets the opposite direction
75
+ *
76
+ * @param direction - Current direction
77
+ * @returns Opposite direction
78
+ *
79
+ * @example
80
+ * ```typescript
81
+ * getOppositeDirection('ltr') // 'rtl'
82
+ * getOppositeDirection('rtl') // 'ltr'
83
+ * ```
84
+ */
85
+ export declare function getOppositeDirection(direction: DirectionValue): DirectionValue;
86
+ /**
87
+ * Direction-aware logical property mappings
88
+ * Maps logical properties to physical properties based on direction
89
+ */
90
+ export declare const LOGICAL_PROPERTY_MAP: {
91
+ readonly ltr: {
92
+ readonly 'inline-start': "left";
93
+ readonly 'inline-end': "right";
94
+ readonly 'block-start': "top";
95
+ readonly 'block-end': "bottom";
96
+ };
97
+ readonly rtl: {
98
+ readonly 'inline-start': "right";
99
+ readonly 'inline-end': "left";
100
+ readonly 'block-start': "top";
101
+ readonly 'block-end': "bottom";
102
+ };
103
+ };
104
+ /**
105
+ * Gets physical property name from logical property based on direction
106
+ *
107
+ * @param logicalProperty - Logical property name
108
+ * @param direction - Text direction
109
+ * @returns Physical property name
110
+ *
111
+ * @example
112
+ * ```typescript
113
+ * getPhysicalProperty('inline-start', 'ltr') // 'left'
114
+ * getPhysicalProperty('inline-start', 'rtl') // 'right'
115
+ * ```
116
+ */
117
+ export declare function getPhysicalProperty(logicalProperty: keyof typeof LOGICAL_PROPERTY_MAP.ltr, direction: DirectionValue): string;
@@ -3,6 +3,7 @@
3
3
  *
4
4
  * Provides reactive internationalization support with:
5
5
  * - Locale management with persistent storage
6
+ * - Text direction (RTL/LTR) support with automatic detection
6
7
  * - Dynamic translation loading with type safety
7
8
  * - Reactive updates throughout the application
8
9
  *
@@ -11,8 +12,10 @@
11
12
  * import { html, prop, Provide, Use } from '@tempots/dom'
12
13
  * import { Locale, makeMessages } from '@tempots/beatui'
13
14
  *
14
- * // Set up locale provider
15
- * const app = Provide(Locale, {}, () => Use(Locale, ({ locale, setLocale }) => {
15
+ * // Set up locale provider with direction support
16
+ * const app = Provide(Locale, {}, () => Use(Locale, ({
17
+ * locale, setLocale, direction, setDirectionPreference
18
+ * }) => {
16
19
  * // Create translation system
17
20
  * const { t } = makeMessages({
18
21
  * locale,
@@ -30,4 +33,4 @@
30
33
  * ```
31
34
  */
32
35
  export * from './translate';
33
- export * from './locale';
36
+ export * from './direction';
@@ -10,7 +10,7 @@ type WrapInValue<T extends unknown[]> = {
10
10
  * Transforms a messages object into a computed version where each message function
11
11
  * returns a reactive Signal instead of a direct value.
12
12
  */
13
- type MessagesToComputed<M extends object> = {
13
+ export type ReactiveMessages<M extends object> = {
14
14
  [K in keyof M]: M[K] extends (...args: infer Args) => infer R ? (...args: WrapInValue<Args>) => Signal<R> : never;
15
15
  };
16
16
  /**
@@ -77,6 +77,6 @@ export declare function makeMessages<M extends object>({ locale, defaultLocale,
77
77
  /** Clean up all resources and event listeners */
78
78
  dispose: () => void;
79
79
  /** Translation functions that return reactive signals */
80
- t: MessagesToComputed<M>;
80
+ t: ReactiveMessages<M>;
81
81
  };
82
82
  export {};
@@ -1,7 +1,10 @@
1
1
  export { Use } from '@tempots/dom';
2
+ export * from './beatui-i18n';
3
+ export * from './components/beatui';
2
4
  export * from './components/button';
3
5
  export * from './components/data';
4
6
  export * from './components/form';
7
+ export * from './components/i18n';
5
8
  export * from './components/layout';
6
9
  export * from './components/misc';
7
10
  export * from './components/navigation';
@@ -5,7 +5,7 @@ export declare const colorShades: ColorShade[];
5
5
  export type SemanticColorName = 'primary' | 'secondary' | 'base' | 'success' | 'warning' | 'error' | 'info';
6
6
  export type ThemeColorName = ColorName | SemanticColorName;
7
7
  export declare const semanticColorNames: readonly ["primary", "secondary", "base", "success", "warning", "error", "info"];
8
- export declare const themeColorNames: ("primary" | "secondary" | "base" | "success" | "warning" | "error" | "info" | "red" | "orange" | "amber" | "yellow" | "lime" | "green" | "emerald" | "teal" | "cyan" | "sky" | "blue" | "indigo" | "violet" | "purple" | "fuchsia" | "pink" | "rose" | "slate" | "gray" | "zinc" | "neutral" | "stone")[];
8
+ export declare const themeColorNames: ("error" | "base" | "success" | "primary" | "secondary" | "warning" | "info" | "red" | "orange" | "amber" | "yellow" | "lime" | "green" | "emerald" | "teal" | "cyan" | "sky" | "blue" | "indigo" | "violet" | "purple" | "fuchsia" | "pink" | "rose" | "slate" | "gray" | "zinc" | "neutral" | "stone")[];
9
9
  export declare const semanticColors: Record<SemanticColorName, ColorName>;
10
10
  export type BackgroundColorName = 'background' | 'surface' | 'subtle' | 'elevated' | 'raised' | 'overlay';
11
11
  export declare const bgColors: {
@@ -0,0 +1,44 @@
1
+ const e = {
2
+ loadingExtended: () => "لوڈ ہو رہا ہے، براہ کرم انتظار کریں",
3
+ loadingShort: () => "لوڈ ہو رہا ہے...",
4
+ locale: () => "زبان",
5
+ iconDescription: () => "آئیکن",
6
+ loadingIcon: () => "لوڈنگ آئیکن",
7
+ failedToLoadIcon: () => "آئیکن لوڈ کرنے میں ناکام",
8
+ editLabel: () => "ترمیم",
9
+ selectOne: () => "ایک منتخب کریں",
10
+ passwordPlaceholderText: () => "خفیہ پاس ورڈ",
11
+ togglePasswordVisibility: () => "پاس ورڈ کی مرئیت تبدیل کریں",
12
+ toggleMenu: () => "مینو ٹوگل کریں",
13
+ toggleAside: () => "سائیڈ پینل ٹوگل کریں",
14
+ mainNavigation: () => "بنیادی نیویگیشن",
15
+ sidebar: () => "سائیڈ بار",
16
+ closeDrawer: () => "دراز بند کریں",
17
+ closeModal: () => "ماڈل بند کریں",
18
+ confirm: () => "تصدیق",
19
+ cancel: () => "منسوخ",
20
+ // languages
21
+ currentLocale: () => "اردو",
22
+ ar: () => "عربی",
23
+ de: () => "جرمن",
24
+ en: () => "انگریزی",
25
+ es: () => "ہسپانوی",
26
+ fr: () => "فرانسیسی",
27
+ he: () => "عبرانی",
28
+ hi: () => "ہندی",
29
+ it: () => "اطالوی",
30
+ ja: () => "جاپانی",
31
+ ko: () => "کوریائی",
32
+ nl: () => "ڈچ",
33
+ pl: () => "پولش",
34
+ pt: () => "پرتگالی",
35
+ ru: () => "روسی",
36
+ tr: () => "ترکی",
37
+ vi: () => "ویتنامی",
38
+ zh: () => "چینی",
39
+ fa: () => "فارسی",
40
+ ur: () => "اردو"
41
+ };
42
+ export {
43
+ e as default
44
+ };
@@ -0,0 +1,44 @@
1
+ const n = {
2
+ loadingExtended: () => "Đang tải, vui lòng đợi",
3
+ loadingShort: () => "Đang tải...",
4
+ locale: () => "Ngôn ngữ",
5
+ iconDescription: () => "Biểu tượng",
6
+ loadingIcon: () => "Biểu tượng tải",
7
+ failedToLoadIcon: () => "Không thể tải biểu tượng",
8
+ editLabel: () => "Chỉnh sửa",
9
+ selectOne: () => "Chọn một",
10
+ passwordPlaceholderText: () => "Mật khẩu bí mật",
11
+ togglePasswordVisibility: () => "Chuyển đổi hiển thị mật khẩu",
12
+ toggleMenu: () => "Chuyển đổi menu",
13
+ toggleAside: () => "Chuyển đổi bảng bên",
14
+ mainNavigation: () => "Điều hướng chính",
15
+ sidebar: () => "Thanh bên",
16
+ closeDrawer: () => "Đóng ngăn kéo",
17
+ closeModal: () => "Đóng modal",
18
+ confirm: () => "Xác nhận",
19
+ cancel: () => "Hủy",
20
+ // languages
21
+ currentLocale: () => "Tiếng Việt",
22
+ ar: () => "Tiếng Ả Rập",
23
+ de: () => "Tiếng Đức",
24
+ en: () => "Tiếng Anh",
25
+ es: () => "Tiếng Tây Ban Nha",
26
+ fr: () => "Tiếng Pháp",
27
+ hi: () => "Tiếng Hindi",
28
+ it: () => "Tiếng Ý",
29
+ ja: () => "Tiếng Nhật",
30
+ ko: () => "Tiếng Hàn",
31
+ nl: () => "Tiếng Hà Lan",
32
+ pl: () => "Tiếng Ba Lan",
33
+ pt: () => "Tiếng Bồ Đào Nha",
34
+ ru: () => "Tiếng Nga",
35
+ tr: () => "Tiếng Thổ Nhĩ Kỳ",
36
+ vi: () => "Tiếng Việt",
37
+ zh: () => "Tiếng Trung",
38
+ he: () => "Tiếng Do Thái",
39
+ fa: () => "Tiếng Ba Tư",
40
+ ur: () => "Tiếng Urdu"
41
+ };
42
+ export {
43
+ n as default
44
+ };
@@ -0,0 +1,44 @@
1
+ const e = {
2
+ loadingExtended: () => "正在加载,请稍候",
3
+ loadingShort: () => "加载中...",
4
+ locale: () => "语言",
5
+ iconDescription: () => "图标",
6
+ loadingIcon: () => "加载图标",
7
+ failedToLoadIcon: () => "图标加载失败",
8
+ editLabel: () => "编辑",
9
+ selectOne: () => "选择一个",
10
+ passwordPlaceholderText: () => "密码",
11
+ togglePasswordVisibility: () => "切换密码可见性",
12
+ toggleMenu: () => "切换菜单",
13
+ toggleAside: () => "切换侧边栏",
14
+ mainNavigation: () => "主导航",
15
+ sidebar: () => "侧边栏",
16
+ closeDrawer: () => "关闭抽屉",
17
+ closeModal: () => "关闭模态框",
18
+ confirm: () => "确认",
19
+ cancel: () => "取消",
20
+ // languages
21
+ currentLocale: () => "简体中文",
22
+ ar: () => "阿拉伯语",
23
+ de: () => "德语",
24
+ en: () => "英语",
25
+ es: () => "西班牙语",
26
+ fr: () => "法语",
27
+ hi: () => " Hindi",
28
+ it: () => "意大利语",
29
+ ja: () => "日语",
30
+ ko: () => "韩语",
31
+ nl: () => "荷兰语",
32
+ pl: () => "波兰语",
33
+ pt: () => "葡萄牙语",
34
+ ru: () => "俄语",
35
+ tr: () => "土耳其语",
36
+ vi: () => "越南语",
37
+ zh: () => "简体中文",
38
+ he: () => "希伯来语",
39
+ fa: () => "波斯语",
40
+ ur: () => "乌尔都语"
41
+ };
42
+ export {
43
+ e as default
44
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tempots/beatui",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.umd.js",
6
6
  "module": "dist/index.es.js",
@@ -56,7 +56,7 @@
56
56
  "peerDependencies": {
57
57
  "@tempots/dom": "28.2.2",
58
58
  "@tempots/std": "0.22.1",
59
- "@tempots/ui": "6.0.1"
59
+ "@tempots/ui": "6.1.0"
60
60
  },
61
61
  "peerDependenciesMeta": {
62
62
  "@tempots/dom": {
@@ -1,6 +0,0 @@
1
- import { TNode } from '@tempots/dom';
2
- export type MenuOptions = {
3
- anchor?: string | HTMLElement;
4
- position?: 'top' | 'bottom' | 'left' | 'right';
5
- };
6
- export declare function Menu(fn: (open: (options: MenuOptions) => void) => TNode, _close: () => void): TNode;