@sveltia/ui 0.29.0 → 0.30.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.
- package/dist/components/calendar/calendar.svelte +3 -3
- package/dist/components/checkbox/checkbox.svelte +2 -1
- package/dist/components/menu/menu-item.svelte +2 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -2
- package/dist/services/i18n.d.ts +5 -0
- package/dist/services/i18n.js +15 -0
- package/package.json +3 -3
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
-->
|
|
5
5
|
<script>
|
|
6
6
|
import { _ } from 'svelte-i18n';
|
|
7
|
-
import {
|
|
7
|
+
import { isRTL } from '../../services/i18n';
|
|
8
8
|
import Button from '../button/button.svelte';
|
|
9
9
|
import Divider from '../divider/divider.svelte';
|
|
10
10
|
import Spacer from '../divider/spacer.svelte';
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
//
|
|
100
100
|
}}
|
|
101
101
|
>
|
|
102
|
-
<Icon name={
|
|
102
|
+
<Icon name={$isRTL ? 'chevron_left' : 'chevron_right'} />
|
|
103
103
|
</Button>
|
|
104
104
|
</div>
|
|
105
105
|
<div role="none" class="grid">
|
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
firstDay = firstDay;
|
|
144
144
|
}}
|
|
145
145
|
>
|
|
146
|
-
<Icon name={
|
|
146
|
+
<Icon name={$isRTL ? 'chevron_left' : 'chevron_right'} />
|
|
147
147
|
</Button>
|
|
148
148
|
</div>
|
|
149
149
|
<div role="listbox" class="grid">
|
|
@@ -119,7 +119,6 @@
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
checked = indeterminate ? true : !checked;
|
|
122
|
-
onChange?.(new CustomEvent('Change', { detail: { checked } }));
|
|
123
122
|
|
|
124
123
|
if (checked) {
|
|
125
124
|
if (!group.includes(value)) {
|
|
@@ -128,6 +127,8 @@
|
|
|
128
127
|
} else if (group.includes(value)) {
|
|
129
128
|
group = group.filter((v) => v !== value);
|
|
130
129
|
}
|
|
130
|
+
|
|
131
|
+
onChange?.(new CustomEvent('Change', { detail: { checked } }));
|
|
131
132
|
}}
|
|
132
133
|
>
|
|
133
134
|
{#snippet startIcon()}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
-->
|
|
6
6
|
<script>
|
|
7
7
|
import { onMount } from 'svelte';
|
|
8
|
-
import {
|
|
8
|
+
import { isRTL } from '../../services/i18n';
|
|
9
9
|
import Button from '../button/button.svelte';
|
|
10
10
|
import Icon from '../icon/icon.svelte';
|
|
11
11
|
import Popup from '../util/popup.svelte';
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
{#if chevronIcon}
|
|
130
130
|
{@render chevronIcon()}
|
|
131
131
|
{:else}
|
|
132
|
-
<Icon name={
|
|
132
|
+
<Icon name={$isRTL ? 'chevron_left' : 'chevron_right'} />
|
|
133
133
|
{/if}
|
|
134
134
|
</span>
|
|
135
135
|
{/if}
|
package/dist/index.d.ts
CHANGED
|
@@ -73,6 +73,7 @@ export { default as AppShell } from "./components/util/app-shell.svelte";
|
|
|
73
73
|
export { default as EmptyState } from "./components/util/empty-state.svelte";
|
|
74
74
|
export { default as Group } from "./components/util/group.svelte";
|
|
75
75
|
export { default as Modal } from "./components/util/modal.svelte";
|
|
76
|
-
export { initLocales };
|
|
77
76
|
export * from "./typedefs";
|
|
78
77
|
import { initLocales } from './services/i18n';
|
|
78
|
+
import { isRTL } from './services/i18n';
|
|
79
|
+
export { initLocales, isRTL };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { initLocales } from './services/i18n';
|
|
1
|
+
import { initLocales, isRTL } from './services/i18n';
|
|
2
2
|
|
|
3
3
|
initLocales();
|
|
4
4
|
|
|
@@ -77,7 +77,7 @@ export { default as AppShell } from './components/util/app-shell.svelte';
|
|
|
77
77
|
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
|
-
export { initLocales };
|
|
80
|
+
export { initLocales, isRTL };
|
|
81
81
|
|
|
82
82
|
// eslint-disable-next-line import/export
|
|
83
83
|
export * from './typedefs';
|
package/dist/services/i18n.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the current document is in RTL mode.
|
|
3
|
+
* @type {import('svelte/store').Writable<boolean>}
|
|
4
|
+
*/
|
|
5
|
+
export const isRTL: import("svelte/store").Writable<boolean>;
|
|
1
6
|
export function initLocales({ fallbackLocale, initialLocale }?: {
|
|
2
7
|
fallbackLocale?: string | undefined;
|
|
3
8
|
initialLocale?: string | undefined;
|
package/dist/services/i18n.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { addMessages, locale as appLocale, init } from 'svelte-i18n';
|
|
2
|
+
import { writable } from 'svelte/store';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Whether the current document is in RTL mode.
|
|
6
|
+
* @type {import('svelte/store').Writable<boolean>}
|
|
7
|
+
*/
|
|
8
|
+
export const isRTL = writable(false);
|
|
2
9
|
|
|
3
10
|
/**
|
|
4
11
|
* Load strings and initialize the locales.
|
|
@@ -44,4 +51,12 @@ if (!import.meta.env.SSR) {
|
|
|
44
51
|
appLocale.subscribe((value) => {
|
|
45
52
|
document.documentElement.dir = getDirection(value);
|
|
46
53
|
});
|
|
54
|
+
|
|
55
|
+
// Update `isRTL` store based on the current document direction.
|
|
56
|
+
new MutationObserver(() => {
|
|
57
|
+
isRTL.set(document.dir === 'rtl');
|
|
58
|
+
}).observe(document.documentElement, {
|
|
59
|
+
attributes: true,
|
|
60
|
+
attributeFilter: ['dir'],
|
|
61
|
+
});
|
|
47
62
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltia/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@sveltejs/adapter-auto": "^6.1.1",
|
|
31
|
-
"@sveltejs/kit": "^2.
|
|
31
|
+
"@sveltejs/kit": "^2.44.0",
|
|
32
32
|
"@sveltejs/package": "^2.5.4",
|
|
33
33
|
"@sveltejs/vite-plugin-svelte": "^6.2.1",
|
|
34
34
|
"cspell": "^9.2.1",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"stylelint": "^16.25.0",
|
|
47
47
|
"stylelint-config-recommended-scss": "^16.0.2",
|
|
48
48
|
"stylelint-scss": "^6.12.1",
|
|
49
|
-
"svelte": "^5.39.
|
|
49
|
+
"svelte": "^5.39.9",
|
|
50
50
|
"svelte-check": "^4.3.2",
|
|
51
51
|
"svelte-preprocess": "^6.0.3",
|
|
52
52
|
"tslib": "^2.8.1",
|