@wirabyte/ui 2.0.0 → 2.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.
Files changed (108) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/config/options.d.ts +7 -0
  3. package/config/wu-config.service.d.ts +10 -0
  4. package/datepicker/datepicker.component.d.ts +2 -1
  5. package/esm2022/asidemenu/asidemenu.component.mjs +3 -3
  6. package/esm2022/chat/chat.component.mjs +2 -2
  7. package/esm2022/config/options.mjs +1 -1
  8. package/esm2022/config/wu-config.service.mjs +14 -1
  9. package/esm2022/datepicker/datepicker.component.mjs +4 -3
  10. package/esm2022/scheduler/scheduler.component.mjs +8 -7
  11. package/esm2022/sitefooter/sitefooter.component.mjs +2 -2
  12. package/esm2022/textarea/textarea.directive.mjs +19 -5
  13. package/esm2022/thai/thai.pipes.mjs +2 -2
  14. package/fesm2022/wirabyte-ui-asidemenu.mjs +2 -2
  15. package/fesm2022/wirabyte-ui-asidemenu.mjs.map +1 -1
  16. package/fesm2022/wirabyte-ui-chat.mjs +1 -1
  17. package/fesm2022/wirabyte-ui-chat.mjs.map +1 -1
  18. package/fesm2022/wirabyte-ui-config.mjs +13 -0
  19. package/fesm2022/wirabyte-ui-config.mjs.map +1 -1
  20. package/fesm2022/wirabyte-ui-datepicker.mjs +4 -3
  21. package/fesm2022/wirabyte-ui-datepicker.mjs.map +1 -1
  22. package/fesm2022/wirabyte-ui-scheduler.mjs +7 -6
  23. package/fesm2022/wirabyte-ui-scheduler.mjs.map +1 -1
  24. package/fesm2022/wirabyte-ui-sitefooter.mjs +1 -1
  25. package/fesm2022/wirabyte-ui-sitefooter.mjs.map +1 -1
  26. package/fesm2022/wirabyte-ui-textarea.mjs +18 -4
  27. package/fesm2022/wirabyte-ui-textarea.mjs.map +1 -1
  28. package/fesm2022/wirabyte-ui-thai.mjs +1 -1
  29. package/fesm2022/wirabyte-ui-thai.mjs.map +1 -1
  30. package/package.json +41 -41
  31. package/scheduler/scheduler.component.d.ts +1 -1
  32. package/textarea/textarea.directive.d.ts +1 -0
  33. package/themes/mali/amber.css +1 -1
  34. package/themes/mali/blue.css +1 -1
  35. package/themes/mali/cyan.css +1 -1
  36. package/themes/mali/emerald.css +1 -1
  37. package/themes/mali/fuchsia.css +1 -1
  38. package/themes/mali/green.css +1 -1
  39. package/themes/mali/indigo.css +1 -1
  40. package/themes/mali/lime.css +1 -1
  41. package/themes/mali/orange.css +1 -1
  42. package/themes/mali/pink.css +1 -1
  43. package/themes/mali/purple.css +1 -1
  44. package/themes/mali/red.css +1 -1
  45. package/themes/mali/rose.css +1 -1
  46. package/themes/mali/sky.css +1 -1
  47. package/themes/mali/teal.css +1 -1
  48. package/themes/mali/theme.css +1 -1
  49. package/themes/mali/violet.css +1 -1
  50. package/themes/mali/wira.css +1 -1
  51. package/themes/mali/yellow.css +1 -1
  52. package/themes/material/amber.css +1 -1
  53. package/themes/material/blue.css +1 -1
  54. package/themes/material/cyan.css +1 -1
  55. package/themes/material/emerald.css +1 -1
  56. package/themes/material/fuchsia.css +1 -1
  57. package/themes/material/green.css +1 -1
  58. package/themes/material/indigo.css +1 -1
  59. package/themes/material/lime.css +1 -1
  60. package/themes/material/orange.css +1 -1
  61. package/themes/material/pink.css +1 -1
  62. package/themes/material/purple.css +1 -1
  63. package/themes/material/red.css +1 -1
  64. package/themes/material/rose.css +1 -1
  65. package/themes/material/sky.css +1 -1
  66. package/themes/material/teal.css +1 -1
  67. package/themes/material/theme.css +1 -1
  68. package/themes/material/violet.css +1 -1
  69. package/themes/material/wira.css +1 -1
  70. package/themes/material/yellow.css +1 -1
  71. package/themes/phet/amber.css +1 -1
  72. package/themes/phet/blue.css +1 -1
  73. package/themes/phet/cyan.css +1 -1
  74. package/themes/phet/emerald.css +1 -1
  75. package/themes/phet/fuchsia.css +1 -1
  76. package/themes/phet/green.css +1 -1
  77. package/themes/phet/indigo.css +1 -1
  78. package/themes/phet/lime.css +1 -1
  79. package/themes/phet/orange.css +1 -1
  80. package/themes/phet/pink.css +1 -1
  81. package/themes/phet/purple.css +1 -1
  82. package/themes/phet/red.css +1 -1
  83. package/themes/phet/rose.css +1 -1
  84. package/themes/phet/sky.css +1 -1
  85. package/themes/phet/teal.css +1 -1
  86. package/themes/phet/theme.css +1 -1
  87. package/themes/phet/violet.css +1 -1
  88. package/themes/phet/wira.css +1 -1
  89. package/themes/phet/yellow.css +1 -1
  90. package/themes/sila/amber.css +1 -1
  91. package/themes/sila/blue.css +1 -1
  92. package/themes/sila/cyan.css +1 -1
  93. package/themes/sila/emerald.css +1 -1
  94. package/themes/sila/fuchsia.css +1 -1
  95. package/themes/sila/green.css +1 -1
  96. package/themes/sila/indigo.css +1 -1
  97. package/themes/sila/lime.css +1 -1
  98. package/themes/sila/orange.css +1 -1
  99. package/themes/sila/pink.css +1 -1
  100. package/themes/sila/purple.css +1 -1
  101. package/themes/sila/red.css +1 -1
  102. package/themes/sila/rose.css +1 -1
  103. package/themes/sila/sky.css +1 -1
  104. package/themes/sila/teal.css +1 -1
  105. package/themes/sila/theme.css +1 -1
  106. package/themes/sila/violet.css +1 -1
  107. package/themes/sila/wira.css +1 -1
  108. package/themes/sila/yellow.css +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  รุ่นของ `@wirabyte/ui` แยก major ตามช่วง Angular: `1.x` = 15–17, `2.x` = 18–20, `3.x` = 21 ขึ้นไป ทุก major ออกจาก source ชุดเดียวกัน หัวข้อด้านล่างจึงใช้กับทุก major ยกเว้นที่ระบุไว้ ส่วน `@wirabyte/icons` ออกพร้อมกันแต่ใช้เลขของตัวเอง
4
4
 
5
+ ## 1.1.0 · 2.1.0 · 3.1.0
6
+
7
+ **ของใหม่**
8
+
9
+ - นาฬิกากลางของแอป: `provideWiraUI({ now: () => serverTime.now() })` ให้ทุก component ใช้เวลานี้เป็น "ตอนนี้" แทนนาฬิกาเครื่องผู้ใช้ ได้แก่ วันนี้และเดือนแรกที่แสดงใน DatePicker, วันนี้และเส้นเวลาปัจจุบันใน Scheduler, pipe `wuTimeAgo`, ป้ายวันในแชท และปีใน SiteFooter เปลี่ยนภายหลังได้ที่ `WuConfig.clock` และอ่านด้วย `WuConfig.now()` ส่วนตัวจับเวลา (หน่วงการค้นหา อายุของ toast) ยังใช้นาฬิกาเครื่อง (WUI-024)
10
+
11
+ **แก้บั๊ก**
12
+
13
+ - Textarea ที่ใช้ `autoResize` ไม่ทำให้เบราว์เซอร์แจ้ง error "ResizeObserver loop completed with undelivered notifications" แล้ว เดิมเกิดเมื่อเปิด dialog หรือ panel ที่ช่องมีข้อความอยู่ก่อน และแอปที่ส่ง error ของหน้าเว็บเข้า `ErrorHandler` จะเห็นเป็น `ERROR` ใน console (WUI-022) ตอนนี้ช่องยังขยายตามข้อความตั้งแต่เฟรมแรกที่แสดงเหมือนเดิม
14
+ - Aside Menu บนมือถือ: ปุ่มปิดอยู่มุมบนด้านท้ายแถวเดียวกับโลโก้ และส่วน start กว้างเต็มหัวเมนู เดิมเมื่อ start สูง (โลโก้ นาฬิกา การ์ดผู้ใช้) ปุ่มไปอยู่กึ่งกลางความสูงและกินความกว้างทุกแถว ควรเว้นท้ายแถวแรกของ start ไว้ให้ปุ่ม (WUI-023)
15
+
5
16
  ## 1.0.0 · 2.0.0 · 3.0.0 · @wirabyte/icons 1.0.0
6
17
 
7
18
  รุ่นจริงรุ่นแรก ติดตั้งได้ด้วย `ng add @wirabyte/ui` (Angular 21 ขึ้นไป), `@wirabyte/ui@2` (18–20) หรือ `@wirabyte/ui@1` (15–17) โดยไม่ต้องระบุ tag แล้ว รวมทุกข้อที่พบจากการใช้จริงกับแอปแรก (รหัส WUI-001 ถึง WUI-021)
@@ -44,6 +44,13 @@ export interface WiraUIOptions {
44
44
  scale?: WuScale;
45
45
  /** Waits before searching for the whole app: `{ autoComplete: 300, filter: 300 }`. Default 0 (no wait). */
46
46
  delays?: WuDelays;
47
+ /**
48
+ * The clock every component treats as "now": today in the datepicker and the scheduler, the scheduler's current-time
49
+ * line, `wuTimeAgo`, the chat's day labels, the year in the site footer. Default: the device clock. Give the
50
+ * server's time when the device clock cannot be trusted: `now: () => serverTime.now()`. Change it later through
51
+ * `WuConfig.clock`. Timers (debounces, toast life) keep measuring with the device clock.
52
+ */
53
+ now?: () => Date;
47
54
  /**
48
55
  * Where the theme's fonts come from. `'google'` (the default) adds the Google Fonts stylesheet for the body and
49
56
  * heading fonts the theme ends up with (Kanit, Sarabun, Anuphan …) unless the page already links it, so a theme set
@@ -10,6 +10,16 @@ export declare class WuConfig {
10
10
  translation: WuLocale;
11
11
  /** Waits before searching, in ms (`provideWiraUI({ delays })`); 0 = no wait. */
12
12
  delays: Required<WuDelays>;
13
+ /**
14
+ * Where "now" comes from (`provideWiraUI({ now })`; default: the device clock). Assign another function at run
15
+ * time, say once the server time is known: components read it each time they need the time.
16
+ */
17
+ clock: () => Date;
18
+ /**
19
+ * Now, by `clock`: what the datepicker, scheduler, chat, footer and `wuTimeAgo` call "now" and "today". A clock
20
+ * that returns no valid date falls back to the device clock. Always a new Date, so callers may change it.
21
+ */
22
+ now(): Date;
13
23
  /** Emits after `setTranslation()` so components can refresh their labels. */
14
24
  readonly translationChange: Subject<WuLocale>;
15
25
  setTranslation(partial: Partial<WuLocale>): void;
@@ -121,6 +121,8 @@ export declare class WuDatePicker implements ControlValueAccessor, OnChanges, On
121
121
  private readonly rootRef;
122
122
  private readonly inputRef;
123
123
  private readonly panelRef;
124
+ private readonly config;
125
+ /** Today and the first month shown come from the app's clock (`provideWiraUI({ now })`), not the device's. */
124
126
  readonly state: DatePickerState;
125
127
  open: boolean;
126
128
  focused: boolean;
@@ -149,7 +151,6 @@ export declare class WuDatePicker implements ControlValueAccessor, OnChanges, On
149
151
  private popup;
150
152
  private repeat;
151
153
  private readonly autoId;
152
- private readonly config;
153
154
  private readonly cdr;
154
155
  private readonly host;
155
156
  private readonly doc;