@sveltia/ui 0.41.5 → 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.
- package/dist/components/alert/alert.svelte +36 -30
- package/dist/components/alert/infobar.svelte +55 -45
- package/dist/components/bottom-navigation/bottom-navigation.svelte +21 -15
- package/dist/components/button/button-group.svelte +7 -5
- package/dist/components/button/button.svelte +274 -175
- package/dist/components/button/floating-action-button-wrapper.svelte +23 -18
- package/dist/components/button/select-button-group.svelte +57 -41
- package/dist/components/button/split-button.svelte +25 -18
- package/dist/components/calendar/calendar.svelte +103 -80
- package/dist/components/checkbox/checkbox-group.svelte +22 -19
- package/dist/components/checkbox/checkbox.svelte +91 -63
- package/dist/components/dialog/dialog.svelte +105 -87
- package/dist/components/dialog/prompt-dialog.svelte +5 -3
- package/dist/components/disclosure/disclosure.svelte +34 -21
- package/dist/components/divider/divider.svelte +18 -14
- package/dist/components/divider/spacer.svelte +13 -8
- package/dist/components/drawer/drawer.svelte +343 -190
- package/dist/components/grid/grid-body.svelte +16 -14
- package/dist/components/grid/grid-cell.svelte +5 -3
- package/dist/components/grid/grid-col-header.svelte +5 -3
- package/dist/components/grid/grid-foot.svelte +5 -3
- package/dist/components/grid/grid-head.svelte +5 -3
- package/dist/components/grid/grid-row-header.svelte +6 -4
- package/dist/components/grid/grid-row.svelte +6 -4
- package/dist/components/grid/grid.svelte +18 -12
- package/dist/components/icon/icon.svelte +7 -5
- package/dist/components/listbox/listbox.svelte +78 -61
- package/dist/components/listbox/option-group.svelte +15 -11
- package/dist/components/listbox/option.svelte +54 -39
- package/dist/components/menu/menu-item-group.svelte +5 -3
- package/dist/components/menu/menu-item.svelte +67 -51
- package/dist/components/menu/menu.svelte +21 -17
- package/dist/components/progressbar/progressbar.svelte +24 -15
- package/dist/components/radio/radio-group.svelte +40 -31
- package/dist/components/radio/radio.svelte +81 -63
- package/dist/components/resizable-pane/resizable-handle.svelte +60 -48
- package/dist/components/resizable-pane/resizable-pane-group.svelte +18 -14
- package/dist/components/select/combobox.svelte +135 -112
- package/dist/components/select/select-tags.svelte +73 -57
- package/dist/components/slider/slider.svelte +94 -74
- package/dist/components/switch/switch.svelte +115 -81
- package/dist/components/table/table-body.svelte +16 -14
- package/dist/components/table/table-cell.svelte +5 -3
- package/dist/components/table/table-col-header.svelte +5 -3
- package/dist/components/table/table-foot.svelte +5 -3
- package/dist/components/table/table-head.svelte +5 -3
- package/dist/components/table/table-row-header.svelte +6 -4
- package/dist/components/table/table-row.svelte +6 -4
- package/dist/components/table/table.svelte +18 -12
- package/dist/components/tabs/tab-box.svelte +9 -6
- package/dist/components/tabs/tab-list.svelte +91 -73
- package/dist/components/tabs/tab-panel.svelte +11 -7
- package/dist/components/tabs/tab-panels.svelte +19 -14
- package/dist/components/text-editor/code-editor.svelte +10 -7
- package/dist/components/text-editor/lexical-root.svelte +221 -160
- package/dist/components/text-editor/text-editor.svelte +25 -18
- package/dist/components/text-editor/toolbar/toolbar-wrapper.svelte +44 -37
- package/dist/components/text-field/number-input.svelte +87 -68
- package/dist/components/text-field/password-input.svelte +52 -42
- package/dist/components/text-field/search-bar.svelte +64 -53
- package/dist/components/text-field/secret-input.svelte +61 -46
- package/dist/components/text-field/text-area.svelte +80 -68
- package/dist/components/text-field/text-input.svelte +138 -106
- package/dist/components/toast/toast.svelte +104 -89
- package/dist/components/toolbar/toolbar.svelte +70 -54
- package/dist/components/typography/truncated-text.svelte +9 -7
- package/dist/components/util/app-shell.svelte +40 -493
- package/dist/components/util/empty-state.svelte +13 -11
- package/dist/components/util/group.svelte +5 -3
- package/dist/components/util/modal.svelte +59 -48
- package/dist/components/util/popup.svelte +87 -67
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -4
- package/dist/services/i18n.d.ts +6 -0
- package/dist/services/i18n.js +19 -14
- package/package.json +20 -20
|
@@ -217,51 +217,62 @@
|
|
|
217
217
|
</dialog>
|
|
218
218
|
{/snippet}
|
|
219
219
|
|
|
220
|
-
<style>
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
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
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
.
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
:
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
:
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
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';
|
package/dist/services/i18n.d.ts
CHANGED
|
@@ -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;
|
package/dist/services/i18n.js
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import { addMessages, init } from '@sveltia/i18n';
|
|
2
|
-
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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 });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltia/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.0",
|
|
4
4
|
"description": "A collection of Svelte components and utilities for building user interfaces.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,36 +33,36 @@
|
|
|
33
33
|
"!dist/**/*.test.*"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@lexical/code": "^0.
|
|
37
|
-
"@lexical/code-prism": "^0.
|
|
38
|
-
"@lexical/dragon": "^0.
|
|
39
|
-
"@lexical/extension": "^0.
|
|
40
|
-
"@lexical/history": "^0.
|
|
41
|
-
"@lexical/link": "^0.
|
|
42
|
-
"@lexical/list": "^0.
|
|
43
|
-
"@lexical/markdown": "^0.
|
|
44
|
-
"@lexical/rich-text": "^0.
|
|
45
|
-
"@lexical/selection": "^0.
|
|
46
|
-
"@lexical/table": "^0.
|
|
47
|
-
"@lexical/utils": "^0.
|
|
36
|
+
"@lexical/code": "^0.47.0",
|
|
37
|
+
"@lexical/code-prism": "^0.47.0",
|
|
38
|
+
"@lexical/dragon": "^0.47.0",
|
|
39
|
+
"@lexical/extension": "^0.47.0",
|
|
40
|
+
"@lexical/history": "^0.47.0",
|
|
41
|
+
"@lexical/link": "^0.47.0",
|
|
42
|
+
"@lexical/list": "^0.47.0",
|
|
43
|
+
"@lexical/markdown": "^0.47.0",
|
|
44
|
+
"@lexical/rich-text": "^0.47.0",
|
|
45
|
+
"@lexical/selection": "^0.47.0",
|
|
46
|
+
"@lexical/table": "^0.47.0",
|
|
47
|
+
"@lexical/utils": "^0.47.0",
|
|
48
48
|
"@sveltia/i18n": "^1.1.2",
|
|
49
49
|
"@sveltia/utils": "^0.10.7",
|
|
50
|
-
"lexical": "^0.
|
|
51
|
-
"prismjs": "^1.30.0"
|
|
52
|
-
"yaml": "^2.9.0"
|
|
50
|
+
"lexical": "^0.47.0",
|
|
51
|
+
"prismjs": "^1.30.0"
|
|
53
52
|
},
|
|
54
53
|
"devDependencies": {
|
|
54
|
+
"@rollup/plugin-yaml": "^5.0.0",
|
|
55
55
|
"@sveltejs/adapter-auto": "^7.0.1",
|
|
56
56
|
"@sveltejs/kit": "^2.69.2",
|
|
57
57
|
"@sveltejs/package": "^2.5.8",
|
|
58
58
|
"@sveltejs/vite-plugin-svelte": "^7.2.0",
|
|
59
59
|
"@vitest/coverage-v8": "^4.1.10",
|
|
60
60
|
"cspell": "^10.0.1",
|
|
61
|
-
"eslint": "^9.39.
|
|
61
|
+
"eslint": "^9.39.5",
|
|
62
62
|
"eslint-config-airbnb-extended": "^3.1.0",
|
|
63
63
|
"eslint-config-prettier": "^10.1.8",
|
|
64
64
|
"eslint-plugin-import": "^2.32.0",
|
|
65
|
-
"eslint-plugin-jsdoc": "^63.0.
|
|
65
|
+
"eslint-plugin-jsdoc": "^63.0.13",
|
|
66
66
|
"eslint-plugin-package-json": "^1.5.0",
|
|
67
67
|
"eslint-plugin-svelte": "^3.20.0",
|
|
68
68
|
"globals": "^17.7.0",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"oxlint": "^1.73.0",
|
|
71
71
|
"postcss": "^8.5.16",
|
|
72
72
|
"postcss-html": "^1.8.1",
|
|
73
|
-
"prettier": "^3.9.
|
|
73
|
+
"prettier": "^3.9.5",
|
|
74
74
|
"prettier-plugin-svelte": "^4.1.1",
|
|
75
75
|
"sass": "^1.101.0",
|
|
76
76
|
"stylelint": "^17.14.0",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"svelte-check": "^4.7.2",
|
|
81
81
|
"svelte-preprocess": "^6.0.5",
|
|
82
82
|
"tslib": "^2.8.1",
|
|
83
|
-
"vite": "^8.1.
|
|
83
|
+
"vite": "^8.1.4",
|
|
84
84
|
"vitest": "^4.1.10"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|