@sveltia/ui 0.41.3 → 0.42.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 (100) hide show
  1. package/dist/components/alert/alert.svelte +39 -31
  2. package/dist/components/alert/alert.svelte.d.ts +8 -0
  3. package/dist/components/alert/infobar.svelte +58 -46
  4. package/dist/components/alert/infobar.svelte.d.ts +8 -0
  5. package/dist/components/bottom-navigation/bottom-navigation.svelte +21 -15
  6. package/dist/components/button/button-group.svelte +10 -6
  7. package/dist/components/button/button-group.svelte.d.ts +8 -0
  8. package/dist/components/button/button.svelte +274 -175
  9. package/dist/components/button/floating-action-button-wrapper.svelte +23 -18
  10. package/dist/components/button/select-button-group.svelte +60 -41
  11. package/dist/components/button/select-button-group.svelte.d.ts +8 -0
  12. package/dist/components/button/split-button.svelte +25 -18
  13. package/dist/components/calendar/calendar.svelte +103 -80
  14. package/dist/components/checkbox/checkbox-group.svelte +25 -19
  15. package/dist/components/checkbox/checkbox-group.svelte.d.ts +8 -0
  16. package/dist/components/checkbox/checkbox.svelte +93 -65
  17. package/dist/components/checkbox/checkbox.svelte.d.ts +2 -2
  18. package/dist/components/dialog/dialog.svelte +105 -87
  19. package/dist/components/dialog/prompt-dialog.svelte +5 -3
  20. package/dist/components/disclosure/disclosure.svelte +34 -21
  21. package/dist/components/divider/divider.svelte +21 -14
  22. package/dist/components/divider/divider.svelte.d.ts +8 -0
  23. package/dist/components/divider/spacer.svelte +13 -8
  24. package/dist/components/drawer/drawer.svelte +343 -190
  25. package/dist/components/grid/grid-body.svelte +16 -14
  26. package/dist/components/grid/grid-cell.svelte +5 -3
  27. package/dist/components/grid/grid-col-header.svelte +5 -3
  28. package/dist/components/grid/grid-foot.svelte +5 -3
  29. package/dist/components/grid/grid-head.svelte +5 -3
  30. package/dist/components/grid/grid-row-header.svelte +6 -4
  31. package/dist/components/grid/grid-row.svelte +6 -4
  32. package/dist/components/grid/grid.svelte +21 -12
  33. package/dist/components/grid/grid.svelte.d.ts +8 -0
  34. package/dist/components/icon/icon.svelte +7 -5
  35. package/dist/components/listbox/listbox.svelte +81 -61
  36. package/dist/components/listbox/listbox.svelte.d.ts +8 -0
  37. package/dist/components/listbox/option-group.svelte +15 -11
  38. package/dist/components/listbox/option.svelte +54 -39
  39. package/dist/components/menu/menu-item-group.svelte +5 -3
  40. package/dist/components/menu/menu-item.svelte +67 -51
  41. package/dist/components/menu/menu.svelte +24 -17
  42. package/dist/components/menu/menu.svelte.d.ts +8 -0
  43. package/dist/components/progressbar/progressbar.svelte +27 -15
  44. package/dist/components/progressbar/progressbar.svelte.d.ts +8 -0
  45. package/dist/components/radio/radio-group.svelte +43 -31
  46. package/dist/components/radio/radio-group.svelte.d.ts +8 -0
  47. package/dist/components/radio/radio.svelte +81 -63
  48. package/dist/components/resizable-pane/resizable-handle.svelte +63 -48
  49. package/dist/components/resizable-pane/resizable-handle.svelte.d.ts +8 -0
  50. package/dist/components/resizable-pane/resizable-pane-group.svelte +18 -14
  51. package/dist/components/select/combobox.svelte +139 -113
  52. package/dist/components/select/select-tags.svelte +73 -57
  53. package/dist/components/slider/slider.svelte +94 -74
  54. package/dist/components/switch/switch.svelte +118 -81
  55. package/dist/components/switch/switch.svelte.d.ts +8 -0
  56. package/dist/components/table/table-body.svelte +16 -14
  57. package/dist/components/table/table-cell.svelte +5 -3
  58. package/dist/components/table/table-col-header.svelte +5 -3
  59. package/dist/components/table/table-foot.svelte +5 -3
  60. package/dist/components/table/table-head.svelte +5 -3
  61. package/dist/components/table/table-row-header.svelte +6 -4
  62. package/dist/components/table/table-row.svelte +6 -4
  63. package/dist/components/table/table.svelte +21 -13
  64. package/dist/components/table/table.svelte.d.ts +8 -0
  65. package/dist/components/tabs/tab-box.svelte +9 -6
  66. package/dist/components/tabs/tab-list.svelte +94 -73
  67. package/dist/components/tabs/tab-list.svelte.d.ts +8 -0
  68. package/dist/components/tabs/tab-panel.svelte +11 -7
  69. package/dist/components/tabs/tab-panels.svelte +19 -14
  70. package/dist/components/text-editor/code-editor.svelte +10 -7
  71. package/dist/components/text-editor/core.js +3 -0
  72. package/dist/components/text-editor/lexical-root.svelte +221 -160
  73. package/dist/components/text-editor/text-editor.svelte +25 -18
  74. package/dist/components/text-editor/toolbar/insert-link-button.svelte +2 -1
  75. package/dist/components/text-editor/toolbar/toolbar-wrapper.svelte +44 -37
  76. package/dist/components/text-field/number-input.svelte +87 -68
  77. package/dist/components/text-field/password-input.svelte +52 -42
  78. package/dist/components/text-field/search-bar.svelte +64 -53
  79. package/dist/components/text-field/secret-input.svelte +61 -46
  80. package/dist/components/text-field/text-area.svelte +80 -68
  81. package/dist/components/text-field/text-input.svelte +139 -107
  82. package/dist/components/toast/toast.svelte +104 -89
  83. package/dist/components/toolbar/toolbar.svelte +73 -54
  84. package/dist/components/toolbar/toolbar.svelte.d.ts +8 -0
  85. package/dist/components/typography/truncated-text.svelte +9 -7
  86. package/dist/components/util/app-shell.svelte +40 -493
  87. package/dist/components/util/empty-state.svelte +13 -11
  88. package/dist/components/util/group.svelte +8 -3
  89. package/dist/components/util/group.svelte.d.ts +8 -0
  90. package/dist/components/util/modal.svelte +59 -48
  91. package/dist/components/util/popup.svelte +87 -67
  92. package/dist/index.d.ts +1 -0
  93. package/dist/index.js +1 -4
  94. package/dist/locales/en.yaml +50 -3
  95. package/dist/locales/ja.yaml +49 -2
  96. package/dist/services/i18n.d.ts +6 -0
  97. package/dist/services/i18n.js +19 -14
  98. package/dist/typedefs.d.ts +5 -1
  99. package/dist/typedefs.js +2 -1
  100. package/package.json +23 -23
@@ -217,51 +217,62 @@
217
217
  </dialog>
218
218
  {/snippet}
219
219
 
220
- <style>dialog {
221
- position: fixed;
222
- inset: 0;
223
- z-index: 9999999;
224
- display: flex;
225
- justify-content: center;
226
- align-items: center;
227
- overflow: hidden;
228
- outline: 0;
229
- margin: 0;
230
- border: 0;
231
- padding: 0;
232
- width: 100dvw;
233
- max-width: 100dvw;
234
- height: 100dvh;
235
- max-height: 100dvh;
236
- color: var(--sui-primary-foreground-color);
237
- background: transparent;
238
- -webkit-user-select: none;
239
- user-select: none;
240
- touch-action: none;
241
- pointer-events: all;
242
- cursor: default;
243
- }
244
- dialog::backdrop {
245
- background: transparent;
246
- }
247
- dialog.backdrop {
248
- background-color: var(--sui-popup-backdrop-color);
249
- }
250
- dialog.open {
251
- transition-duration: 50ms;
252
- opacity: 1;
253
- }
254
- dialog:not(.open) {
255
- transition-duration: 400ms;
256
- opacity: 0;
257
- }
258
- dialog[hidden] {
259
- transition-duration: 1ms !important;
260
- }
261
- dialog:not(.active) {
262
- pointer-events: none !important;
263
- }
264
- dialog:not(.active) :global(*) {
265
- transition-duration: 0ms !important;
266
- pointer-events: none !important;
267
- }</style>
220
+ <style lang="scss">
221
+ dialog {
222
+ position: fixed;
223
+ inset: 0;
224
+ z-index: 9999999;
225
+ display: flex;
226
+ justify-content: center;
227
+ align-items: center;
228
+ overflow: hidden;
229
+ outline: 0;
230
+ margin: 0;
231
+ border: 0;
232
+ padding: 0;
233
+ width: 100dvw;
234
+ max-width: 100dvw;
235
+ height: 100dvh;
236
+ max-height: 100dvh;
237
+ color: var(--sui-primary-foreground-color);
238
+ background: transparent;
239
+ -webkit-user-select: none;
240
+ user-select: none;
241
+ touch-action: none;
242
+ pointer-events: all;
243
+ cursor: default;
244
+
245
+ &::backdrop {
246
+ background: transparent;
247
+ }
248
+
249
+ &.backdrop {
250
+ background-color: var(--sui-popup-backdrop-color);
251
+ }
252
+
253
+ &.open {
254
+ transition-duration: 50ms;
255
+ opacity: 1;
256
+ }
257
+
258
+ &:not(.open) {
259
+ transition-duration: 400ms;
260
+ opacity: 0;
261
+ }
262
+
263
+ &[hidden] {
264
+ transition-duration: 1ms !important;
265
+ }
266
+
267
+ &:not(.active) {
268
+ pointer-events: none !important;
269
+
270
+ :global {
271
+ * {
272
+ transition-duration: 0ms !important;
273
+ pointer-events: none !important;
274
+ }
275
+ }
276
+ }
277
+ }
278
+ </style>
@@ -201,70 +201,90 @@
201
201
  </Modal>
202
202
  {/if}
203
203
 
204
- <style>.content {
205
- position: absolute;
206
- overflow-y: auto;
207
- outline-width: 0 !important;
208
- width: auto;
209
- color: var(--sui-primary-foreground-color);
210
- background-color: var(--sui-secondary-background-color-translucent);
211
- box-shadow: 0 8px 16px var(--sui-popup-shadow-color);
212
- -webkit-backdrop-filter: blur(16px);
213
- backdrop-filter: blur(16px);
214
- transition-property: opacity, transform;
215
- }
216
- .content.menu {
217
- border-width: var(--sui-menu-border-width, 1px);
218
- border-style: var(--sui-menu-border-style, solid);
219
- border-color: var(--sui-menu-border-width, var(--sui-secondary-border-color));
220
- border-radius: var(--sui-menu-border-radius, 4px);
221
- padding: var(--sui-menu-padding, 4px);
222
- }
223
- .content.menu :global(.sui.menu) {
224
- border-width: 0;
225
- border-radius: 0;
226
- padding: 0;
227
- background-color: transparent;
228
- }
229
- .content.listbox {
230
- border-width: var(--sui-listbox-border-width, 1px);
231
- border-style: var(--sui-listbox-border-style, solid);
232
- border-color: var(--sui-listbox-border-width, var(--sui-secondary-border-color));
233
- border-radius: var(--sui-listbox-border-radius, 4px);
234
- padding: var(--sui-listbox-padding, 4px);
235
- }
236
- .content.listbox :global(.sui.listbox) {
237
- border-width: 0;
238
- border-radius: 0;
239
- padding: 0;
240
- background-color: transparent;
241
- }
242
- .content.touch {
243
- position: static;
244
- border-width: 0 !important;
245
- border-radius: 4px !important;
246
- padding: 8px;
247
- min-width: 320px !important;
248
- max-width: calc(100dvw - 32px) !important;
249
- max-height: calc(100dvh - 32px) !important;
250
- }
251
- :global(dialog.open) .content.touch {
252
- transform: scale(100%) !important;
253
- }
254
- :global(dialog:not(.open)) .content.touch {
255
- transform: scale(90%);
256
- }
257
- .content.touch.combobox :global(.sui.listbox) {
258
- gap: 4px;
259
- padding: 8px 4px !important;
260
- }
261
- :global(dialog.open) .content {
262
- transition-duration: 50ms;
263
- opacity: 1;
264
- transform: translateY(2px);
265
- }
266
- :global(dialog:not(.open)) .content {
267
- transition-duration: 300ms;
268
- opacity: 0;
269
- transform: translateY(-8px);
270
- }</style>
204
+ <style lang="scss">
205
+ .content {
206
+ position: absolute;
207
+ overflow-y: auto;
208
+ outline-width: 0 !important;
209
+ width: auto;
210
+ color: var(--sui-primary-foreground-color);
211
+ background-color: var(--sui-secondary-background-color-translucent);
212
+ box-shadow: 0 8px 16px var(--sui-popup-shadow-color);
213
+ -webkit-backdrop-filter: blur(16px);
214
+ backdrop-filter: blur(16px);
215
+ transition-property: opacity, transform;
216
+
217
+ &.menu {
218
+ border-width: var(--sui-menu-border-width, 1px);
219
+ border-style: var(--sui-menu-border-style, solid);
220
+ border-color: var(--sui-menu-border-width, var(--sui-secondary-border-color));
221
+ border-radius: var(--sui-menu-border-radius, 4px);
222
+ padding: var(--sui-menu-padding, 4px);
223
+
224
+ :global {
225
+ .sui.menu {
226
+ border-width: 0;
227
+ border-radius: 0;
228
+ padding: 0;
229
+ background-color: transparent;
230
+ }
231
+ }
232
+ }
233
+
234
+ &.listbox {
235
+ border-width: var(--sui-listbox-border-width, 1px);
236
+ border-style: var(--sui-listbox-border-style, solid);
237
+ border-color: var(--sui-listbox-border-width, var(--sui-secondary-border-color));
238
+ border-radius: var(--sui-listbox-border-radius, 4px);
239
+ padding: var(--sui-listbox-padding, 4px);
240
+
241
+ :global {
242
+ .sui.listbox {
243
+ border-width: 0;
244
+ border-radius: 0;
245
+ padding: 0;
246
+ background-color: transparent;
247
+ }
248
+ }
249
+ }
250
+
251
+ &.touch {
252
+ position: static;
253
+ border-width: 0 !important;
254
+ border-radius: 4px !important;
255
+ padding: 8px;
256
+ min-width: 320px !important;
257
+ max-width: calc(100dvw - 32px) !important;
258
+ max-height: calc(100dvh - 32px) !important;
259
+
260
+ :global(dialog.open) & {
261
+ transform: scale(100%) !important;
262
+ }
263
+
264
+ :global(dialog:not(.open)) & {
265
+ transform: scale(90%);
266
+ }
267
+
268
+ &.combobox {
269
+ :global {
270
+ .sui.listbox {
271
+ gap: 4px;
272
+ padding: 8px 4px !important;
273
+ }
274
+ }
275
+ }
276
+ }
277
+
278
+ :global(dialog.open) & {
279
+ transition-duration: 50ms;
280
+ opacity: 1;
281
+ transform: translateY(2px);
282
+ }
283
+
284
+ :global(dialog:not(.open)) & {
285
+ transition-duration: 300ms;
286
+ opacity: 0;
287
+ transform: translateY(-8px);
288
+ }
289
+ }
290
+ </style>
package/dist/index.d.ts CHANGED
@@ -78,3 +78,4 @@ export { default as EmptyState } from "./components/util/empty-state.svelte";
78
78
  export { default as Group } from "./components/util/group.svelte";
79
79
  export { default as Modal } from "./components/util/modal.svelte";
80
80
  export * from "./typedefs.js";
81
+ export { initLocales, resources } from "./services/i18n.js";
package/dist/index.js CHANGED
@@ -1,7 +1,3 @@
1
- import { initLocales } from './services/i18n.js';
2
-
3
- initLocales();
4
-
5
1
  export { default as Alert } from './components/alert/alert.svelte';
6
2
  export { default as Infobar } from './components/alert/infobar.svelte';
7
3
  export { default as BottomNavigation } from './components/bottom-navigation/bottom-navigation.svelte';
@@ -81,6 +77,7 @@ export { default as AppShell } from './components/util/app-shell.svelte';
81
77
  export { default as EmptyState } from './components/util/empty-state.svelte';
82
78
  export { default as Group } from './components/util/group.svelte';
83
79
  export { default as Modal } from './components/util/modal.svelte';
80
+ export { initLocales, resources } from './services/i18n.js';
84
81
 
85
82
  // eslint-disable-next-line import/export
86
83
  export * from './typedefs.js';
@@ -1,45 +1,85 @@
1
+ # Dialog action button labels
1
2
  ok: OK
2
3
  cancel: Cancel
3
4
  close: Close
5
+
6
+ # Button to clear content, e.g. search input or calendar date
4
7
  clear: Clear
8
+
9
+ # Text editor dialog buttons for link/image insertion
5
10
  insert: Insert
6
11
  update: Update
7
12
  remove: Remove
13
+
14
+ # Combobox dropdown toggle button aria-labels
8
15
  collapse: Collapse
9
16
  expand: Expand
17
+
18
+ # Infobar/toast dismiss button label
10
19
  dismiss: Dismiss
20
+
21
+ # Calendar component
11
22
  calendar:
23
+ # View switcher group aria-labels and navigation button aria-labels
12
24
  year: Year
13
25
  previous_decade: Previous Decade
14
26
  next_decade: Next Decade
15
27
  month: Month
16
28
  previous_month: Previous Month
17
29
  next_month: Next Month
30
+ # “Today” button label in footer
18
31
  today: Today
32
+
33
+ # Split button component
19
34
  split_button:
35
+ # Wrapper aria-label, e.g. “Save Options” when primary button is “Save”
20
36
  x_options: "{$name} Options"
37
+ # Dropdown toggle aria-label
21
38
  more_options: More Options
39
+
40
+ # Combobox component
22
41
  combobox:
42
+ # Placeholder when no option is selected
23
43
  select_an_option: Select an option…
44
+ # Filter input aria-label
24
45
  filter_options: Filter Options
46
+ # Empty state message when filter has no matches
25
47
  no_matching_options: No matching options found
48
+
49
+ # Number input component
26
50
  number_input:
27
- decrease: Decrease
51
+ # Spin button aria-labels for incrementing/decrementing the number value
28
52
  increase: Increase
53
+ decrease: Decrease
54
+
55
+ # Password input component
29
56
  password_input:
57
+ # Visibility toggle button aria-labels
30
58
  show_password: Show Password
31
59
  hide_password: Hide Password
60
+
61
+ # Secret input component (API keys, tokens, etc.)
32
62
  secret_input:
63
+ # Visibility toggle button aria-labels
33
64
  show_secret: Show Secret
34
65
  hide_secret: Hide Secret
66
+
67
+ # Select tags component (multi-select)
35
68
  select_tags:
36
- selected_options: Selected options
69
+ # Listbox aria-label
70
+ selected_options: Selected Options
71
+ # Remove button aria-label, e.g. “Remove Option 1”
37
72
  remove_x: "Remove {$name}"
73
+
74
+ # Text editor component
38
75
  text_editor:
76
+ # Toolbar aria-labels
39
77
  text_editor: Text Editor
40
78
  code_editor: Code Editor
79
+ # Block style menu button and menu aria-labels
41
80
  text_style_options: Text Style Options
42
81
  show_text_style_options: Show Text Style Options
82
+ # Block style menu items
43
83
  paragraph: Paragraph
44
84
  heading_1: Heading 1
45
85
  heading_2: Heading 2
@@ -51,16 +91,23 @@ text_editor:
51
91
  numbered_list: Numbered List
52
92
  blockquote: Block Quote
53
93
  code_block: Code Block
94
+ # Inline style button aria-labels
54
95
  bold: Bold
55
96
  italic: Italic
56
97
  strikethrough: Strikethrough
57
98
  code: Code
58
99
  link: Link
100
+ # Link dialog title
59
101
  insert_link: Insert Link
60
102
  update_link: Update Link
103
+ # Link dialog input field labels
61
104
  text: Text
62
105
  url: URL
106
+ # Markdown mode toggle button aria-label
63
107
  edit_in_markdown: Edit in Markdown
64
- converter_error: There was an error while enabling rich text mode. Please use the plain text editor instead.
108
+ # Error message when rich text conversion fails
109
+ converter_error: Unable to enable rich text mode. Please use the plain text editor instead.
110
+ # Language selector aria-label
65
111
  language: Language
112
+ # Plain text mode option in language selector
66
113
  plain_text: Plain Text
@@ -1,45 +1,85 @@
1
+ # Dialog action button labels
1
2
  ok: OK
2
3
  cancel: キャンセル
3
4
  close: 閉じる
5
+
6
+ # Button to clear content, e.g. search input or calendar date
4
7
  clear: クリア
8
+
9
+ # Text editor dialog buttons for link/image insertion
5
10
  insert: 挿入
6
11
  update: 更新
7
12
  remove: 削除
13
+
14
+ # Combobox dropdown toggle button aria-labels
8
15
  collapse: 折り畳む
9
16
  expand: 広げる
17
+
18
+ # Infobar/toast dismiss button label
10
19
  dismiss: 閉じる
20
+
21
+ # Calendar component
11
22
  calendar:
23
+ # View switcher group aria-labels and navigation button aria-labels
12
24
  year: 年
13
25
  previous_decade: 前の 10 年
14
26
  next_decade: 次の 10 年
15
27
  month: 月
16
28
  previous_month: 前月
17
29
  next_month: 翌月
30
+ # "Today" button label in footer
18
31
  today: 今日
32
+
33
+ # Split button component
19
34
  split_button:
35
+ # Wrapper aria-label, e.g. "Save Options" when primary button is "Save"
20
36
  x_options: "{$name} オプション"
37
+ # Dropdown toggle aria-label
21
38
  more_options: その他のオプション
39
+
40
+ # Combobox component
22
41
  combobox:
42
+ # Placeholder when no option is selected
23
43
  select_an_option: オプションを選択…
44
+ # Filter input aria-label
24
45
  filter_options: オプションを絞り込み
46
+ # Empty state message when filter has no matches
25
47
  no_matching_options: 一致するオプションは見つかりませんでした
48
+
49
+ # Number input component
26
50
  number_input:
27
- decrease: 減らす
51
+ # Spin button aria-labels for incrementing/decrementing the number value
28
52
  increase: 増やす
53
+ decrease: 減らす
54
+
55
+ # Password input component
29
56
  password_input:
57
+ # Visibility toggle button aria-labels
30
58
  show_password: パスワードを表示
31
59
  hide_password: パスワードを隠す
60
+
61
+ # Secret input component (API keys, tokens, etc.)
32
62
  secret_input:
63
+ # Visibility toggle button aria-labels
33
64
  show_secret: シークレットを表示
34
65
  hide_secret: シークレットを隠す
66
+
67
+ # Select tags component (multi-select)
35
68
  select_tags:
69
+ # Listbox aria-label
36
70
  selected_options: 選択済みのオプション
71
+ # Remove button aria-label, e.g. "Remove Option 1"
37
72
  remove_x: "{$name} を削除"
73
+
74
+ # Text editor component
38
75
  text_editor:
76
+ # Toolbar aria-labels
39
77
  text_editor: テキストエディター
40
78
  code_editor: コードエディター
79
+ # Block style menu button and menu aria-labels
41
80
  text_style_options: テキストスタイルオプション
42
81
  show_text_style_options: テキストスタイルオプションを表示
82
+ # Block style menu items
43
83
  paragraph: 段落
44
84
  heading_1: 見出し 1
45
85
  heading_2: 見出し 2
@@ -51,16 +91,23 @@ text_editor:
51
91
  numbered_list: 番号付きリスト
52
92
  blockquote: ブロック引用
53
93
  code_block: コードブロック
94
+ # Inline style button aria-labels
54
95
  bold: 太字
55
96
  italic: 斜体
56
97
  strikethrough: 取り消し線
57
98
  code: コード
58
99
  link: リンク
100
+ # Link dialog title
59
101
  insert_link: リンクを挿入
60
102
  update_link: リンクを更新
103
+ # Link dialog input field labels
61
104
  text: テキスト
62
105
  url: URL
106
+ # Markdown mode toggle button aria-label
63
107
  edit_in_markdown: マークダウンで編集
64
- converter_error: リッチテキストモードを有効化中に問題が発生しました。代わりにプレーンテキストエディターを使用してください。
108
+ # Error message when rich text conversion fails
109
+ converter_error: リッチテキストモードを有効にできませんでした。プレーンテキストエディターを使用してください。
110
+ # Language selector aria-label
65
111
  language: 言語
112
+ # Plain text mode option in language selector
66
113
  plain_text: プレーンテキスト
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Object containing all the locale resources, with the locale names as keys and the corresponding
3
+ * strings as values.
4
+ * @type {Record<string, Record<string, string>>}
5
+ */
6
+ export const resources: Record<string, Record<string, string>>;
1
7
  export function initLocales({ fallbackLocale, initialLocale }?: {
2
8
  fallbackLocale?: string | undefined;
3
9
  initialLocale?: string | undefined;
@@ -1,8 +1,22 @@
1
1
  import { addMessages, init } from '@sveltia/i18n';
2
- import { parse as parseYaml } from 'yaml';
2
+
3
+ const rawResources = import.meta.glob('../locales/*.yaml', { eager: true, import: 'default' });
4
+
5
+ /**
6
+ * Object containing all the locale resources, with the locale names as keys and the corresponding
7
+ * strings as values.
8
+ * @type {Record<string, Record<string, string>>}
9
+ */
10
+ export const resources = Object.fromEntries(
11
+ Object.entries(rawResources).map(([path, resource]) => [
12
+ /** @type {string} */ (path.match(/.+\/(?<locale>.+?)\.yaml$/)?.groups?.locale),
13
+ /** @type {Record<string, string>} */ (resource),
14
+ ]),
15
+ );
3
16
 
4
17
  /**
5
- * Load strings and initialize the locales.
18
+ * Load strings and initialize the locales. Consumers can use this function to load the localized
19
+ * strings for their application. If `<AppShell>` is used, this function is called automatically.
6
20
  * @param {object} [init] Initialize options.
7
21
  * @param {string} [init.fallbackLocale] Fallback locale.
8
22
  * @param {string} [init.initialLocale] Initial locale.
@@ -10,18 +24,9 @@ import { parse as parseYaml } from 'yaml';
10
24
  * @see https://vitejs.dev/guide/features.html#glob-import
11
25
  */
12
26
  export const initLocales = ({ fallbackLocale = 'en', initialLocale = 'en' } = {}) => {
13
- const resources = import.meta.glob('../locales/*.yaml', {
14
- eager: true,
15
- query: '?raw',
16
- import: 'default',
17
- });
18
-
19
- Object.entries(resources).forEach(([path, resource]) => {
20
- addMessages(
21
- /** @type {string} */ (path.match(/.+\/(?<locale>.+?)\.yaml$/)?.groups?.locale),
22
- // Add `_sui` suffix to avoid collision with app localization
23
- { _sui: parseYaml(/** @type {string} */ (resource)) },
24
- );
27
+ Object.entries(resources).forEach(([locale, resource]) => {
28
+ // Add `_sui` suffix to avoid collision with app localization
29
+ addMessages(locale, { _sui: resource });
25
30
  });
26
31
 
27
32
  init({ fallbackLocale, initialLocale });
@@ -397,6 +397,10 @@ export type ComboboxProps = {
397
397
  * Use `-1` to always hide the filter.
398
398
  */
399
399
  filterThreshold?: number | undefined;
400
+ /**
401
+ * The `aria-label` attribute on the wrapper element.
402
+ */
403
+ ariaLabel?: string | undefined;
400
404
  /**
401
405
  * Primary slot content.
402
406
  */
@@ -490,7 +494,7 @@ export type TextInputProps = {
490
494
  /**
491
495
  * `aria-label` attribute.
492
496
  */
493
- "aria-label"?: string | undefined;
497
+ ariaLabel?: string | undefined;
494
498
  /**
495
499
  * Primary slot content.
496
500
  */
package/dist/typedefs.js CHANGED
@@ -139,6 +139,7 @@
139
139
  * @property {PopupPosition} [position] Where to show the dropdown menu.
140
140
  * @property {number} [filterThreshold] Number of items to start showing the filter. Default: `5`.
141
141
  * Use `-1` to always hide the filter.
142
+ * @property {string} [ariaLabel] The `aria-label` attribute on the wrapper element.
142
143
  * @property {Snippet} [children] Primary slot content.
143
144
  * @property {Snippet} [chevronIcon] Chevron icon slot content.
144
145
  * @property {(event: CustomEvent) => void} [onChange] Custom `change` event handler.
@@ -174,7 +175,7 @@
174
175
  * `aria-required` attribute.
175
176
  * @property {boolean} [invalid] Whether to mark the widget invalid. An alias of the `aria-invalid`
176
177
  * attribute.
177
- * @property {string} [aria-label] `aria-label` attribute.
178
+ * @property {string} [ariaLabel] `aria-label` attribute.
178
179
  * @property {Snippet} [children] Primary slot content.
179
180
  */
180
181