@refinitiv-ui/phrasebook 5.3.1-alpha.0 → 5.5.0-alpha.1

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 +13 -1
  2. package/package.json +15 -54
  3. package/lib/index.d.ts +0 -2
  4. package/lib/index.js +0 -1
  5. package/lib/locale/de/calendar.d.ts +0 -18
  6. package/lib/locale/de/calendar.js +0 -20
  7. package/lib/locale/de/color-dialog.d.ts +0 -8
  8. package/lib/locale/de/color-dialog.js +0 -11
  9. package/lib/locale/de/combo-box.d.ts +0 -6
  10. package/lib/locale/de/combo-box.js +0 -8
  11. package/lib/locale/de/dialog.d.ts +0 -5
  12. package/lib/locale/de/dialog.js +0 -8
  13. package/lib/locale/de/pagination.d.ts +0 -6
  14. package/lib/locale/de/pagination.js +0 -20
  15. package/lib/locale/de/password-field.d.ts +0 -5
  16. package/lib/locale/de/password-field.js +0 -7
  17. package/lib/locale/de/search-field.d.ts +0 -4
  18. package/lib/locale/de/search-field.js +0 -6
  19. package/lib/locale/de/shared.d.ts +0 -7
  20. package/lib/locale/de/shared.js +0 -10
  21. package/lib/locale/de/time-picker.d.ts +0 -10
  22. package/lib/locale/de/time-picker.js +0 -12
  23. package/lib/locale/de/tree-select.d.ts +0 -13
  24. package/lib/locale/de/tree-select.js +0 -13
  25. package/lib/locale/en/calendar.d.ts +0 -18
  26. package/lib/locale/en/calendar.js +0 -20
  27. package/lib/locale/en/color-dialog.d.ts +0 -8
  28. package/lib/locale/en/color-dialog.js +0 -11
  29. package/lib/locale/en/combo-box.d.ts +0 -6
  30. package/lib/locale/en/combo-box.js +0 -8
  31. package/lib/locale/en/dialog.d.ts +0 -5
  32. package/lib/locale/en/dialog.js +0 -7
  33. package/lib/locale/en/pagination.d.ts +0 -6
  34. package/lib/locale/en/pagination.js +0 -20
  35. package/lib/locale/en/password-field.d.ts +0 -5
  36. package/lib/locale/en/password-field.js +0 -7
  37. package/lib/locale/en/search-field.d.ts +0 -4
  38. package/lib/locale/en/search-field.js +0 -6
  39. package/lib/locale/en/shared.d.ts +0 -7
  40. package/lib/locale/en/shared.js +0 -10
  41. package/lib/locale/en/time-picker.d.ts +0 -10
  42. package/lib/locale/en/time-picker.js +0 -12
  43. package/lib/locale/en/tree-select.d.ts +0 -13
  44. package/lib/locale/en/tree-select.js +0 -13
  45. package/lib/locale/ja/calendar.d.ts +0 -18
  46. package/lib/locale/ja/calendar.js +0 -20
  47. package/lib/locale/ja/color-dialog.d.ts +0 -8
  48. package/lib/locale/ja/color-dialog.js +0 -11
  49. package/lib/locale/ja/combo-box.d.ts +0 -6
  50. package/lib/locale/ja/combo-box.js +0 -8
  51. package/lib/locale/ja/dialog.d.ts +0 -5
  52. package/lib/locale/ja/dialog.js +0 -8
  53. package/lib/locale/ja/pagination.d.ts +0 -6
  54. package/lib/locale/ja/pagination.js +0 -20
  55. package/lib/locale/ja/password-field.d.ts +0 -5
  56. package/lib/locale/ja/password-field.js +0 -7
  57. package/lib/locale/ja/search-field.d.ts +0 -4
  58. package/lib/locale/ja/search-field.js +0 -6
  59. package/lib/locale/ja/shared.d.ts +0 -7
  60. package/lib/locale/ja/shared.js +0 -10
  61. package/lib/locale/ja/time-picker.d.ts +0 -10
  62. package/lib/locale/ja/time-picker.js +0 -12
  63. package/lib/locale/ja/tree-select.d.ts +0 -13
  64. package/lib/locale/ja/tree-select.js +0 -13
  65. package/lib/locale/zh/calendar.d.ts +0 -18
  66. package/lib/locale/zh/calendar.js +0 -20
  67. package/lib/locale/zh/color-dialog.d.ts +0 -8
  68. package/lib/locale/zh/color-dialog.js +0 -11
  69. package/lib/locale/zh/combo-box.d.ts +0 -6
  70. package/lib/locale/zh/combo-box.js +0 -8
  71. package/lib/locale/zh/dialog.d.ts +0 -5
  72. package/lib/locale/zh/dialog.js +0 -8
  73. package/lib/locale/zh/pagination.d.ts +0 -6
  74. package/lib/locale/zh/pagination.js +0 -20
  75. package/lib/locale/zh/password-field.d.ts +0 -5
  76. package/lib/locale/zh/password-field.js +0 -7
  77. package/lib/locale/zh/search-field.d.ts +0 -4
  78. package/lib/locale/zh/search-field.js +0 -6
  79. package/lib/locale/zh/shared.d.ts +0 -7
  80. package/lib/locale/zh/shared.js +0 -10
  81. package/lib/locale/zh/time-picker.d.ts +0 -10
  82. package/lib/locale/zh/time-picker.js +0 -12
  83. package/lib/locale/zh/tree-select.d.ts +0 -13
  84. package/lib/locale/zh/tree-select.js +0 -13
  85. package/lib/locale/zh-hant/calendar.d.ts +0 -18
  86. package/lib/locale/zh-hant/calendar.js +0 -20
  87. package/lib/locale/zh-hant/color-dialog.d.ts +0 -8
  88. package/lib/locale/zh-hant/color-dialog.js +0 -11
  89. package/lib/locale/zh-hant/combo-box.d.ts +0 -6
  90. package/lib/locale/zh-hant/combo-box.js +0 -8
  91. package/lib/locale/zh-hant/dialog.d.ts +0 -5
  92. package/lib/locale/zh-hant/dialog.js +0 -8
  93. package/lib/locale/zh-hant/pagination.d.ts +0 -6
  94. package/lib/locale/zh-hant/pagination.js +0 -20
  95. package/lib/locale/zh-hant/password-field.d.ts +0 -5
  96. package/lib/locale/zh-hant/password-field.js +0 -7
  97. package/lib/locale/zh-hant/search-field.d.ts +0 -4
  98. package/lib/locale/zh-hant/search-field.js +0 -6
  99. package/lib/locale/zh-hant/shared.d.ts +0 -7
  100. package/lib/locale/zh-hant/shared.js +0 -10
  101. package/lib/locale/zh-hant/time-picker.d.ts +0 -10
  102. package/lib/locale/zh-hant/time-picker.js +0 -12
  103. package/lib/locale/zh-hant/tree-select.d.ts +0 -13
  104. package/lib/locale/zh-hant/tree-select.js +0 -13
  105. package/lib/translation.d.ts +0 -52
  106. package/lib/translation.js +0 -84
  107. package/lib/types.d.ts +0 -4
  108. package/lib/types.js +0 -1
@@ -1,10 +0,0 @@
1
- declare const translations: {
2
- BEFORE_MIDDAY: string;
3
- AFTER_MIDDAY: string;
4
- TOGGLE_TIME_PERIOD: string;
5
- SELECT_HOURS: string;
6
- SELECT_MINUTES: string;
7
- SELECT_SECONDS: string;
8
- SELECTED: string;
9
- };
10
- export default translations;
@@ -1,12 +0,0 @@
1
- import { Phrasebook } from '../../translation.js';
2
- const translations = {
3
- BEFORE_MIDDAY: 'Before Midday',
4
- AFTER_MIDDAY: 'After Midday',
5
- TOGGLE_TIME_PERIOD: 'Toggle Time Period',
6
- SELECT_HOURS: '{value, select, null {Select hours} other {{value, plural, =1 {# hour} other {# hours}}}}',
7
- SELECT_MINUTES: '{value, select, null {Select minutes} other {{value, plural, =1 {# minute} other {# minutes}}}}',
8
- SELECT_SECONDS: '{value, select, null {Select seconds} other {{value, plural, =1 {# second} other {# seconds}}}}',
9
- SELECTED: '{value, select, null {Selected none. Choose time} other {Selected time is: {showSeconds, select, true {{amPm, select, true {{value, time, ::hmsa}} other {{value, time, ::Hms}}}} other {{amPm, select, true {{value, time, ::hma}} other {{value, time, ::Hm}}}}}}}'
10
- };
11
- Phrasebook.define('zh-hant', 'ef-time-picker', translations);
12
- export default translations;
@@ -1,13 +0,0 @@
1
- import './shared.js';
2
- declare const translations: {
3
- FULL_LIST: string;
4
- SELECTED: string;
5
- EXPAND_COLLAPSE: string;
6
- SELECT_CONTROL: string;
7
- DONE: string;
8
- SELECTED_NUM: string;
9
- MATCHES_NUM: string;
10
- MULTIPLE_ITEMS: string;
11
- NO_OPTIONS: string;
12
- };
13
- export default translations;
@@ -1,13 +0,0 @@
1
- // Component docs https://elf.int.refinitiv.com/elements/tree-select.html
2
- import { Phrasebook } from '../../translation.js';
3
- import './shared.js';
4
- import comboboxTranslations from './combo-box';
5
- const translations = Object.assign(Object.assign({}, comboboxTranslations), {
6
- // used as a toggle control
7
- FULL_LIST: '完整列表', SELECTED: '已選項列表', EXPAND_COLLAPSE: '{expansion, select, true {全部收起} other {全部展開}}', SELECT_CONTROL: '{selected, select, true {取消全選} other {全選}}',
8
- // button control
9
- DONE: '完成',
10
- // selection/filter feedback
11
- SELECTED_NUM: '{numSelected, plural, =0 {} =1 {已選 1 項。} other {已選 # 項。}}', MATCHES_NUM: '{numMatched, plural, =0 {未找到結果。} =1 {找到了 1 個結果。} other {找到了 # 個結果。}}' });
12
- Phrasebook.define('zh-Hant', 'ef-tree-select', translations);
13
- export default translations;
@@ -1,52 +0,0 @@
1
- import type { Translations } from './types';
2
- declare class ObserverKey {
3
- }
4
- declare type ObserverCallback = (locale: string) => void;
5
- declare abstract class Phrasebook {
6
- private static localeMap;
7
- private static observables;
8
- private static publish;
9
- /**
10
- * Start observing changes to translations
11
- * @param scope The scope to observe
12
- * @param callback A callback run when the scope has changed
13
- * @returns An observe key used to disconnet
14
- */
15
- static observe(scope: string, callback: ObserverCallback): ObserverKey;
16
- /**
17
- * Stop observing and disconnect a callback
18
- * @param key A key to stop observing the scope
19
- * @returns {void}
20
- */
21
- static disconnect(key: ObserverKey): void;
22
- /**
23
- * Define shared scope translations.
24
- * Shared scope are available globally across all translation keys.
25
- * @param locale Locale
26
- * @param translations Translations
27
- * @returns {void}
28
- */
29
- static define(locale: string, translations: Translations): void;
30
- /**
31
- * Define scoped translations.
32
- * @param locale Locale
33
- * @param scope Scope
34
- * @param translations Translations
35
- * @returns {void}
36
- */
37
- static define(locale: string, scope: string, translations: Translations): void;
38
- /**
39
- * Get translation for locale and scope.
40
- * @param locale Locale to get
41
- * @param scope Scope to get
42
- * @returns translation or null
43
- */
44
- static get(locale: string, scope: string): null | Translations;
45
- /**
46
- * Get a list of supported locales per scope
47
- * @param [scope=SHARED_SCOPE] A scope to check. If none provided a shared scope is returned
48
- * @returns list of supported locales
49
- */
50
- static supported(scope?: string): string[];
51
- }
52
- export { ObserverKey, ObserverCallback, Phrasebook };
@@ -1,84 +0,0 @@
1
- const SHARED_SCOPE = '__shared__'; /* unique scope identifier */
2
- class ObserverKey {
3
- }
4
- class Phrasebook {
5
- static publish(publishLocale, publishScope) {
6
- const callbackFn = (observable) => {
7
- const { callback, scope } = observable;
8
- // for shared scope all observed must be updated
9
- if (publishScope === SHARED_SCOPE || publishScope === scope) {
10
- callback(publishLocale);
11
- }
12
- };
13
- this.observables.forEach(callbackFn);
14
- }
15
- /**
16
- * Start observing changes to translations
17
- * @param scope The scope to observe
18
- * @param callback A callback run when the scope has changed
19
- * @returns An observe key used to disconnet
20
- */
21
- static observe(scope, callback) {
22
- const key = new ObserverKey();
23
- this.observables.set(key, {
24
- scope,
25
- callback
26
- });
27
- return key;
28
- }
29
- /**
30
- * Stop observing and disconnect a callback
31
- * @param key A key to stop observing the scope
32
- * @returns {void}
33
- */
34
- static disconnect(key) {
35
- this.observables.delete(key);
36
- }
37
- static define(locale, scope, translations = scope) {
38
- if (scope === SHARED_SCOPE) {
39
- throw new Error(`${SHARED_SCOPE} scope name is reserved`);
40
- }
41
- if (!locale || !scope || !translations) {
42
- throw new Error('Translations must define locale, scope and translations collection');
43
- }
44
- scope = typeof scope !== 'string' ? SHARED_SCOPE : scope;
45
- const translationMap = this.localeMap[locale] || {};
46
- translationMap[scope] = translations;
47
- this.localeMap[locale] = translationMap;
48
- this.publish(locale, scope);
49
- }
50
- /**
51
- * Get translation for locale and scope.
52
- * @param locale Locale to get
53
- * @param scope Scope to get
54
- * @returns translation or null
55
- */
56
- static get(locale, scope) {
57
- const translationsMap = this.localeMap[locale];
58
- if (!translationsMap) {
59
- return null;
60
- }
61
- return Object.assign({}, translationsMap[SHARED_SCOPE] || {}, translationsMap[scope] || {});
62
- }
63
- /**
64
- * Get a list of supported locales per scope
65
- * @param [scope=SHARED_SCOPE] A scope to check. If none provided a shared scope is returned
66
- * @returns list of supported locales
67
- */
68
- static supported(scope = SHARED_SCOPE) {
69
- const locales = [];
70
- const localeMap = this.localeMap;
71
- let translation;
72
- let locale;
73
- for (locale in localeMap) {
74
- translation = localeMap[locale];
75
- if (translation[scope]) {
76
- locales.push(locale);
77
- }
78
- }
79
- return locales;
80
- }
81
- }
82
- Phrasebook.localeMap = {};
83
- Phrasebook.observables = new Map();
84
- export { ObserverKey, Phrasebook };
package/lib/types.d.ts DELETED
@@ -1,4 +0,0 @@
1
- declare type Translations = {
2
- [key: string]: string;
3
- };
4
- export { Translations };
package/lib/types.js DELETED
@@ -1 +0,0 @@
1
- export {};