@14ch/svelte-ui 0.0.12 → 0.0.13
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/assets/styles/variables.scss +0 -6
- package/dist/components/Button.svelte +75 -73
- package/dist/components/Button.svelte.d.ts +2 -2
- package/dist/components/Checkbox.svelte +78 -77
- package/dist/components/Checkbox.svelte.d.ts +4 -4
- package/dist/components/CheckboxGroup.svelte +42 -26
- package/dist/components/CheckboxGroup.svelte.d.ts +2 -2
- package/dist/components/ColorPicker.svelte +63 -61
- package/dist/components/ColorPicker.svelte.d.ts +2 -2
- package/dist/components/Combobox.svelte +71 -76
- package/dist/components/Combobox.svelte.d.ts +2 -2
- package/dist/components/ConfirmDialog.svelte +24 -22
- package/dist/components/ConfirmDialog.svelte.d.ts +2 -2
- package/dist/components/Datepicker.svelte +121 -81
- package/dist/components/Datepicker.svelte.d.ts +6 -4
- package/dist/components/DatepickerCalendar.svelte +23 -18
- package/dist/components/DatepickerCalendar.svelte.d.ts +2 -2
- package/dist/components/Dialog.svelte +30 -28
- package/dist/components/Dialog.svelte.d.ts +2 -2
- package/dist/components/Drawer.svelte +31 -29
- package/dist/components/Drawer.svelte.d.ts +2 -2
- package/dist/components/Fab.svelte +56 -54
- package/dist/components/Fab.svelte.d.ts +2 -2
- package/dist/components/FileUploader.svelte +51 -49
- package/dist/components/FileUploader.svelte.d.ts +2 -2
- package/dist/components/Icon.svelte +29 -27
- package/dist/components/Icon.svelte.d.ts +2 -2
- package/dist/components/IconButton.svelte +81 -79
- package/dist/components/IconButton.svelte.d.ts +2 -2
- package/dist/components/ImageUploader.svelte +53 -51
- package/dist/components/ImageUploader.svelte.d.ts +2 -2
- package/dist/components/ImageUploaderPreview.svelte +33 -20
- package/dist/components/ImageUploaderPreview.svelte.d.ts +2 -2
- package/dist/components/Input.svelte +97 -93
- package/dist/components/Input.svelte.d.ts +2 -2
- package/dist/components/LoadingSpinner.svelte +14 -13
- package/dist/components/LoadingSpinner.svelte.d.ts +2 -2
- package/dist/components/Modal.svelte +26 -24
- package/dist/components/Modal.svelte.d.ts +2 -2
- package/dist/components/Pagination.svelte +20 -28
- package/dist/components/Pagination.svelte.d.ts +2 -2
- package/dist/components/Popup.svelte +46 -46
- package/dist/components/Popup.svelte.d.ts +3 -3
- package/dist/components/PopupMenu.svelte +90 -90
- package/dist/components/PopupMenu.svelte.d.ts +2 -2
- package/dist/components/PopupMenuButton.svelte +61 -61
- package/dist/components/PopupMenuButton.svelte.d.ts +2 -2
- package/dist/components/Radio.svelte +64 -63
- package/dist/components/Radio.svelte.d.ts +2 -2
- package/dist/components/RadioGroup.svelte +38 -26
- package/dist/components/RadioGroup.svelte.d.ts +2 -2
- package/dist/components/SegmentedControl.svelte +71 -69
- package/dist/components/SegmentedControl.svelte.d.ts +4 -4
- package/dist/components/Select.svelte +65 -65
- package/dist/components/Select.svelte.d.ts +2 -2
- package/dist/components/Slider.svelte +65 -64
- package/dist/components/Slider.svelte.d.ts +5 -5
- package/dist/components/Snackbar.svelte +10 -9
- package/dist/components/Snackbar.svelte.d.ts +2 -2
- package/dist/components/SnackbarItem.svelte +28 -28
- package/dist/components/SnackbarItem.svelte.d.ts +2 -2
- package/dist/components/Switch.svelte +62 -62
- package/dist/components/Switch.svelte.d.ts +4 -4
- package/dist/components/Tab.svelte +31 -20
- package/dist/components/Tab.svelte.d.ts +3 -2
- package/dist/components/TabItem.svelte +20 -19
- package/dist/components/TabItem.svelte.d.ts +2 -2
- package/dist/components/Textarea.svelte +82 -82
- package/dist/components/Textarea.svelte.d.ts +5 -5
- package/dist/components/skeleton/Skeleton.svelte +16 -14
- package/dist/components/skeleton/Skeleton.svelte.d.ts +2 -2
- package/dist/components/skeleton/SkeletonAvatar.svelte +9 -5
- package/dist/components/skeleton/SkeletonAvatar.svelte.d.ts +2 -2
- package/dist/components/skeleton/SkeletonBox.svelte +11 -11
- package/dist/components/skeleton/SkeletonBox.svelte.d.ts +2 -2
- package/dist/components/skeleton/SkeletonButton.svelte +10 -5
- package/dist/components/skeleton/SkeletonButton.svelte.d.ts +2 -2
- package/dist/components/skeleton/SkeletonHeading.svelte +8 -11
- package/dist/components/skeleton/SkeletonHeading.svelte.d.ts +2 -2
- package/dist/components/skeleton/SkeletonMedia.svelte +10 -6
- package/dist/components/skeleton/SkeletonMedia.svelte.d.ts +2 -2
- package/dist/components/skeleton/SkeletonText.svelte +9 -13
- package/dist/components/skeleton/SkeletonText.svelte.d.ts +2 -2
- package/dist/index.d.ts +41 -0
- package/dist/utils/formatText.js +4 -1
- package/package.json +1 -1
|
@@ -3,16 +3,34 @@
|
|
|
3
3
|
<script lang="ts">
|
|
4
4
|
import TabItem from './TabItem.svelte';
|
|
5
5
|
import type { MenuItem } from '../types/menuItem';
|
|
6
|
+
import { afterNavigate } from '$app/navigation';
|
|
6
7
|
|
|
7
8
|
// =========================================================================
|
|
8
9
|
// Props, States & Constants
|
|
9
10
|
// =========================================================================
|
|
11
|
+
export type TabProps = {
|
|
12
|
+
// 基本プロパティ
|
|
13
|
+
tabItems: MenuItem[];
|
|
14
|
+
pathPrefix?: string;
|
|
15
|
+
customPathMatcher?: (currentPath: string, itemHref: string, item: MenuItem) => boolean;
|
|
16
|
+
currentPath?: string;
|
|
17
|
+
|
|
18
|
+
// スタイル/レイアウト
|
|
19
|
+
textColor?: string;
|
|
20
|
+
selectedTextColor?: string;
|
|
21
|
+
selectedBarColor?: string;
|
|
22
|
+
|
|
23
|
+
// ARIA/アクセシビリティ
|
|
24
|
+
ariaLabel?: string;
|
|
25
|
+
ariaLabelledby?: string;
|
|
26
|
+
};
|
|
10
27
|
|
|
11
28
|
let {
|
|
12
29
|
// 基本プロパティ
|
|
13
30
|
tabItems = [],
|
|
14
31
|
pathPrefix = '',
|
|
15
32
|
customPathMatcher,
|
|
33
|
+
currentPath,
|
|
16
34
|
|
|
17
35
|
// スタイル/レイアウト
|
|
18
36
|
textColor = 'var(--svelte-ui-text-subtle-color)',
|
|
@@ -22,34 +40,30 @@
|
|
|
22
40
|
// ARIA/アクセシビリティ
|
|
23
41
|
ariaLabel = 'Tabs',
|
|
24
42
|
ariaLabelledby
|
|
25
|
-
}:
|
|
26
|
-
// 基本プロパティ
|
|
27
|
-
tabItems: MenuItem[];
|
|
28
|
-
pathPrefix?: string;
|
|
29
|
-
customPathMatcher?: (currentPath: string, itemHref: string, item: MenuItem) => boolean;
|
|
30
|
-
|
|
31
|
-
// スタイル/レイアウト
|
|
32
|
-
textColor?: string;
|
|
33
|
-
selectedTextColor?: string;
|
|
34
|
-
selectedBarColor?: string;
|
|
43
|
+
}: TabProps = $props();
|
|
35
44
|
|
|
36
|
-
|
|
37
|
-
ariaLabel?: string;
|
|
38
|
-
ariaLabelledby?: string;
|
|
39
|
-
} = $props();
|
|
45
|
+
let resolvedCurrentPath = $state('');
|
|
40
46
|
|
|
41
47
|
// =========================================================================
|
|
42
48
|
// Methods
|
|
43
49
|
// =========================================================================
|
|
44
|
-
|
|
45
|
-
// ブラウザ標準APIを使用した現在パス取得
|
|
46
50
|
const getCurrentPath = () => {
|
|
51
|
+
// アプリ側から現在パスが明示的に渡されていればそれを優先(SSR対応)
|
|
52
|
+
if (currentPath && currentPath !== '') {
|
|
53
|
+
return currentPath;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// それ以外の場合はクライアント実行時のみ window.location から取得
|
|
47
57
|
if (typeof window !== 'undefined') {
|
|
48
58
|
return window.location.pathname;
|
|
49
59
|
}
|
|
50
60
|
return '';
|
|
51
61
|
};
|
|
52
62
|
|
|
63
|
+
afterNavigate(() => {
|
|
64
|
+
resolvedCurrentPath = getCurrentPath();
|
|
65
|
+
});
|
|
66
|
+
|
|
53
67
|
// パスの正規化処理
|
|
54
68
|
const normalizePath = (path: string): string => {
|
|
55
69
|
if (!pathPrefix) return path;
|
|
@@ -131,16 +145,13 @@
|
|
|
131
145
|
// $derived
|
|
132
146
|
// =========================================================================
|
|
133
147
|
|
|
134
|
-
// 現在のパスを取得
|
|
135
|
-
const currentPath = $derived(getCurrentPath());
|
|
136
|
-
|
|
137
148
|
// アクティブなタブのインデックスを現在のパスに基づいて計算
|
|
138
149
|
const selectedTabIndex = $derived.by(() => {
|
|
139
150
|
for (let i = 0; i < tabItems.length; i++) {
|
|
140
151
|
const item = tabItems[i];
|
|
141
152
|
if (!item.href) continue;
|
|
142
153
|
|
|
143
|
-
if (matchPath(
|
|
154
|
+
if (matchPath(resolvedCurrentPath, item.href, item)) {
|
|
144
155
|
return i;
|
|
145
156
|
}
|
|
146
157
|
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import type { MenuItem } from '../types/menuItem';
|
|
2
|
-
type
|
|
2
|
+
export type TabProps = {
|
|
3
3
|
tabItems: MenuItem[];
|
|
4
4
|
pathPrefix?: string;
|
|
5
5
|
customPathMatcher?: (currentPath: string, itemHref: string, item: MenuItem) => boolean;
|
|
6
|
+
currentPath?: string;
|
|
6
7
|
textColor?: string;
|
|
7
8
|
selectedTextColor?: string;
|
|
8
9
|
selectedBarColor?: string;
|
|
9
10
|
ariaLabel?: string;
|
|
10
11
|
ariaLabelledby?: string;
|
|
11
12
|
};
|
|
12
|
-
declare const Tab: import("svelte").Component
|
|
13
|
+
declare const Tab: import("svelte").Component<TabProps, {}, "">;
|
|
13
14
|
type Tab = ReturnType<typeof Tab>;
|
|
14
15
|
export default Tab;
|
|
@@ -8,6 +8,25 @@
|
|
|
8
8
|
// =========================================================================
|
|
9
9
|
// Props, States & Constants
|
|
10
10
|
// =========================================================================
|
|
11
|
+
export type TabItemProps = {
|
|
12
|
+
// 基本プロパティ
|
|
13
|
+
tabItem: MenuItem;
|
|
14
|
+
|
|
15
|
+
// スタイル/レイアウト
|
|
16
|
+
textColor: string;
|
|
17
|
+
selectedTextColor: string;
|
|
18
|
+
selectedBarColor: string;
|
|
19
|
+
|
|
20
|
+
// アイコン関連
|
|
21
|
+
iconFilled?: boolean;
|
|
22
|
+
iconWeight?: IconWeight;
|
|
23
|
+
iconGrade?: IconGrade;
|
|
24
|
+
iconOpticalSize?: IconOpticalSize;
|
|
25
|
+
iconVariant?: IconVariant;
|
|
26
|
+
|
|
27
|
+
// 状態/動作
|
|
28
|
+
isSelected?: boolean;
|
|
29
|
+
};
|
|
11
30
|
|
|
12
31
|
let {
|
|
13
32
|
// 基本プロパティ
|
|
@@ -27,25 +46,7 @@
|
|
|
27
46
|
|
|
28
47
|
// 状態/動作
|
|
29
48
|
isSelected = false
|
|
30
|
-
}:
|
|
31
|
-
// 基本プロパティ
|
|
32
|
-
tabItem: MenuItem;
|
|
33
|
-
|
|
34
|
-
// スタイル/レイアウト
|
|
35
|
-
textColor: string;
|
|
36
|
-
selectedTextColor: string;
|
|
37
|
-
selectedBarColor: string;
|
|
38
|
-
|
|
39
|
-
// アイコン関連
|
|
40
|
-
iconFilled?: boolean;
|
|
41
|
-
iconWeight?: IconWeight;
|
|
42
|
-
iconGrade?: IconGrade;
|
|
43
|
-
iconOpticalSize?: IconOpticalSize;
|
|
44
|
-
iconVariant?: IconVariant;
|
|
45
|
-
|
|
46
|
-
// 状態/動作
|
|
47
|
-
isSelected?: boolean;
|
|
48
|
-
} = $props();
|
|
49
|
+
}: TabItemProps = $props();
|
|
49
50
|
</script>
|
|
50
51
|
|
|
51
52
|
<a
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MenuItem } from '../types/menuItem';
|
|
2
2
|
import type { IconVariant, IconWeight, IconGrade, IconOpticalSize } from '../types/icon';
|
|
3
|
-
type
|
|
3
|
+
export type TabItemProps = {
|
|
4
4
|
tabItem: MenuItem;
|
|
5
5
|
textColor: string;
|
|
6
6
|
selectedTextColor: string;
|
|
@@ -12,6 +12,6 @@ type $$ComponentProps = {
|
|
|
12
12
|
iconVariant?: IconVariant;
|
|
13
13
|
isSelected?: boolean;
|
|
14
14
|
};
|
|
15
|
-
declare const TabItem: import("svelte").Component
|
|
15
|
+
declare const TabItem: import("svelte").Component<TabItemProps, {}, "">;
|
|
16
16
|
type TabItem = ReturnType<typeof TabItem>;
|
|
17
17
|
export default TabItem;
|
|
@@ -19,6 +19,85 @@
|
|
|
19
19
|
// =========================================================================
|
|
20
20
|
// Props, States & Constants
|
|
21
21
|
// =========================================================================
|
|
22
|
+
export type TextareaProps = {
|
|
23
|
+
// 基本プロパティ
|
|
24
|
+
name?: string;
|
|
25
|
+
value: string;
|
|
26
|
+
placeholder?: string;
|
|
27
|
+
|
|
28
|
+
// HTML属性系
|
|
29
|
+
id?: string | null;
|
|
30
|
+
tabindex?: number | null;
|
|
31
|
+
maxlength?: number | null;
|
|
32
|
+
autocomplete?: HTMLTextareaAttributes['autocomplete'];
|
|
33
|
+
wrap?: 'soft' | 'hard' | null;
|
|
34
|
+
spellcheck?: boolean | null;
|
|
35
|
+
autocapitalize?: 'off' | 'none' | 'on' | 'sentences' | 'words' | 'characters' | null;
|
|
36
|
+
textareaAttributes?: HTMLTextareaAttributes | undefined;
|
|
37
|
+
|
|
38
|
+
// スタイル/レイアウト
|
|
39
|
+
rows?: number;
|
|
40
|
+
minHeight?: string | number | null;
|
|
41
|
+
maxHeight?: string | number | null;
|
|
42
|
+
inline?: boolean;
|
|
43
|
+
focusStyle?: 'background' | 'outline' | 'none';
|
|
44
|
+
fullWidth?: boolean;
|
|
45
|
+
fullHeight?: boolean;
|
|
46
|
+
width?: string | number | null;
|
|
47
|
+
rounded?: boolean;
|
|
48
|
+
customStyle?: string;
|
|
49
|
+
|
|
50
|
+
// 状態/動作
|
|
51
|
+
disabled?: boolean;
|
|
52
|
+
autoResize?: boolean;
|
|
53
|
+
resizable?: boolean;
|
|
54
|
+
clearable?: boolean;
|
|
55
|
+
clearButtonAriaLabel?: string;
|
|
56
|
+
readonly?: boolean;
|
|
57
|
+
required?: boolean;
|
|
58
|
+
iconVariant?: IconVariant;
|
|
59
|
+
linkify?: boolean;
|
|
60
|
+
|
|
61
|
+
// フォーカスイベント
|
|
62
|
+
onfocus?: FocusHandler;
|
|
63
|
+
onblur?: FocusHandler;
|
|
64
|
+
|
|
65
|
+
// キーボードイベント
|
|
66
|
+
onkeydown?: KeyboardHandler;
|
|
67
|
+
onkeyup?: KeyboardHandler;
|
|
68
|
+
|
|
69
|
+
// マウスイベント
|
|
70
|
+
onclick?: MouseHandler;
|
|
71
|
+
onmousedown?: MouseHandler;
|
|
72
|
+
onmouseup?: MouseHandler;
|
|
73
|
+
onmouseenter?: MouseHandler;
|
|
74
|
+
onmouseleave?: MouseHandler;
|
|
75
|
+
onmouseover?: MouseHandler;
|
|
76
|
+
onmouseout?: MouseHandler;
|
|
77
|
+
oncontextmenu?: MouseHandler;
|
|
78
|
+
onauxclick?: MouseHandler;
|
|
79
|
+
|
|
80
|
+
// タッチイベント
|
|
81
|
+
ontouchstart?: TouchHandler;
|
|
82
|
+
ontouchend?: TouchHandler;
|
|
83
|
+
ontouchmove?: TouchHandler;
|
|
84
|
+
ontouchcancel?: TouchHandler;
|
|
85
|
+
|
|
86
|
+
// ポインターイベント
|
|
87
|
+
onpointerdown?: PointerHandler;
|
|
88
|
+
onpointerup?: PointerHandler;
|
|
89
|
+
onpointerenter?: PointerHandler;
|
|
90
|
+
onpointerleave?: PointerHandler;
|
|
91
|
+
onpointermove?: PointerHandler;
|
|
92
|
+
onpointercancel?: PointerHandler;
|
|
93
|
+
|
|
94
|
+
// 入力イベント
|
|
95
|
+
onchange?: (value: string) => void;
|
|
96
|
+
oninput?: (value: string) => void;
|
|
97
|
+
|
|
98
|
+
// その他
|
|
99
|
+
[key: string]: any;
|
|
100
|
+
};
|
|
22
101
|
|
|
23
102
|
let {
|
|
24
103
|
// 基本プロパティ
|
|
@@ -98,94 +177,14 @@
|
|
|
98
177
|
|
|
99
178
|
// その他
|
|
100
179
|
...restProps
|
|
101
|
-
}:
|
|
102
|
-
// 基本プロパティ
|
|
103
|
-
name?: string;
|
|
104
|
-
value: string;
|
|
105
|
-
placeholder?: string;
|
|
106
|
-
|
|
107
|
-
// HTML属性系
|
|
108
|
-
id?: string | null;
|
|
109
|
-
tabindex?: number | null;
|
|
110
|
-
maxlength?: number | null;
|
|
111
|
-
autocomplete?: HTMLTextareaAttributes['autocomplete'];
|
|
112
|
-
wrap?: 'soft' | 'hard' | null;
|
|
113
|
-
spellcheck?: boolean | null;
|
|
114
|
-
autocapitalize?: 'off' | 'none' | 'on' | 'sentences' | 'words' | 'characters' | null;
|
|
115
|
-
textareaAttributes?: HTMLTextareaAttributes | undefined;
|
|
116
|
-
|
|
117
|
-
// スタイル/レイアウト
|
|
118
|
-
rows?: number;
|
|
119
|
-
minHeight?: string | number | null;
|
|
120
|
-
maxHeight?: string | number | null;
|
|
121
|
-
inline?: boolean;
|
|
122
|
-
focusStyle?: 'background' | 'outline' | 'none';
|
|
123
|
-
fullWidth?: boolean;
|
|
124
|
-
fullHeight?: boolean;
|
|
125
|
-
width?: string | number | null;
|
|
126
|
-
rounded?: boolean;
|
|
127
|
-
customStyle?: string;
|
|
128
|
-
|
|
129
|
-
// 状態/動作
|
|
130
|
-
disabled?: boolean;
|
|
131
|
-
autoResize?: boolean;
|
|
132
|
-
resizable?: boolean;
|
|
133
|
-
clearable?: boolean;
|
|
134
|
-
clearButtonAriaLabel?: string;
|
|
135
|
-
readonly?: boolean;
|
|
136
|
-
required?: boolean;
|
|
137
|
-
iconVariant?: IconVariant;
|
|
138
|
-
linkify?: boolean;
|
|
139
|
-
|
|
140
|
-
// フォーカスイベント
|
|
141
|
-
onfocus?: FocusHandler;
|
|
142
|
-
onblur?: FocusHandler;
|
|
143
|
-
|
|
144
|
-
// キーボードイベント
|
|
145
|
-
onkeydown?: KeyboardHandler;
|
|
146
|
-
onkeyup?: KeyboardHandler;
|
|
147
|
-
|
|
148
|
-
// マウスイベント
|
|
149
|
-
onclick?: MouseHandler;
|
|
150
|
-
onmousedown?: MouseHandler;
|
|
151
|
-
onmouseup?: MouseHandler;
|
|
152
|
-
onmouseenter?: MouseHandler;
|
|
153
|
-
onmouseleave?: MouseHandler;
|
|
154
|
-
onmouseover?: MouseHandler;
|
|
155
|
-
onmouseout?: MouseHandler;
|
|
156
|
-
oncontextmenu?: MouseHandler;
|
|
157
|
-
onauxclick?: MouseHandler;
|
|
158
|
-
|
|
159
|
-
// タッチイベント
|
|
160
|
-
ontouchstart?: TouchHandler;
|
|
161
|
-
ontouchend?: TouchHandler;
|
|
162
|
-
ontouchmove?: TouchHandler;
|
|
163
|
-
ontouchcancel?: TouchHandler;
|
|
164
|
-
|
|
165
|
-
// ポインターイベント
|
|
166
|
-
onpointerdown?: PointerHandler;
|
|
167
|
-
onpointerup?: PointerHandler;
|
|
168
|
-
onpointerenter?: PointerHandler;
|
|
169
|
-
onpointerleave?: PointerHandler;
|
|
170
|
-
onpointermove?: PointerHandler;
|
|
171
|
-
onpointercancel?: PointerHandler;
|
|
172
|
-
|
|
173
|
-
// 入力イベント
|
|
174
|
-
onchange?: BivariantValueHandler<string>;
|
|
175
|
-
oninput?: BivariantValueHandler<string>;
|
|
176
|
-
|
|
177
|
-
// その他
|
|
178
|
-
[key: string]: any;
|
|
179
|
-
} = $props();
|
|
180
|
+
}: TextareaProps = $props();
|
|
180
181
|
|
|
181
182
|
let ref: HTMLTextAreaElement | null = null;
|
|
182
183
|
let isFocused: boolean = $state(false);
|
|
183
184
|
|
|
184
185
|
// =========================================================================
|
|
185
|
-
|
|
186
186
|
// Methods
|
|
187
187
|
// =========================================================================
|
|
188
|
-
|
|
189
188
|
const clear = (): void => {
|
|
190
189
|
if (disabled || readonly) return;
|
|
191
190
|
value = '';
|
|
@@ -663,7 +662,8 @@
|
|
|
663
662
|
}
|
|
664
663
|
|
|
665
664
|
textarea[readonly] {
|
|
666
|
-
|
|
665
|
+
/* Match Input behavior: readonly fields keep the same background,
|
|
666
|
+
* but use a default cursor to indicate non-editable. */
|
|
667
667
|
cursor: default;
|
|
668
668
|
}
|
|
669
669
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { HTMLTextareaAttributes } from 'svelte/elements';
|
|
2
2
|
import type { IconVariant } from '../types/icon';
|
|
3
|
-
import type { FocusHandler, KeyboardHandler, MouseHandler, TouchHandler, PointerHandler
|
|
4
|
-
type
|
|
3
|
+
import type { FocusHandler, KeyboardHandler, MouseHandler, TouchHandler, PointerHandler } from '../types/eventHandlers';
|
|
4
|
+
export type TextareaProps = {
|
|
5
5
|
name?: string;
|
|
6
6
|
value: string;
|
|
7
7
|
placeholder?: string;
|
|
@@ -55,11 +55,11 @@ type $$ComponentProps = {
|
|
|
55
55
|
onpointerleave?: PointerHandler;
|
|
56
56
|
onpointermove?: PointerHandler;
|
|
57
57
|
onpointercancel?: PointerHandler;
|
|
58
|
-
onchange?:
|
|
59
|
-
oninput?:
|
|
58
|
+
onchange?: (value: string) => void;
|
|
59
|
+
oninput?: (value: string) => void;
|
|
60
60
|
[key: string]: any;
|
|
61
61
|
};
|
|
62
|
-
declare const Textarea: import("svelte").Component
|
|
62
|
+
declare const Textarea: import("svelte").Component<TextareaProps, {
|
|
63
63
|
focus: () => void;
|
|
64
64
|
}, "value">;
|
|
65
65
|
type Textarea = ReturnType<typeof Textarea>;
|
|
@@ -13,8 +13,17 @@
|
|
|
13
13
|
import { DEFAULT_PATTERN_CONFIG, PRESET_PATTERNS } from '../../constants/skeleton';
|
|
14
14
|
|
|
15
15
|
// =========================================================================
|
|
16
|
-
// Props
|
|
16
|
+
// Props, States & Constants
|
|
17
17
|
// =========================================================================
|
|
18
|
+
export type SkeletonProps = {
|
|
19
|
+
patterns?: SkeletonPatternConfig[];
|
|
20
|
+
repeat?: number;
|
|
21
|
+
repeatGap?: string | number;
|
|
22
|
+
patternGap?: string | number;
|
|
23
|
+
className?: string;
|
|
24
|
+
customStyle?: string;
|
|
25
|
+
animated?: boolean;
|
|
26
|
+
};
|
|
18
27
|
|
|
19
28
|
let {
|
|
20
29
|
// 基本プロパティ
|
|
@@ -25,22 +34,11 @@
|
|
|
25
34
|
className = '',
|
|
26
35
|
customStyle = '',
|
|
27
36
|
animated = true
|
|
28
|
-
}:
|
|
29
|
-
patterns?: SkeletonPatternConfig[];
|
|
30
|
-
repeat?: number;
|
|
31
|
-
repeatGap?: string | number;
|
|
32
|
-
patternGap?: string | number;
|
|
33
|
-
className?: string;
|
|
34
|
-
customStyle?: string;
|
|
35
|
-
animated?: boolean;
|
|
36
|
-
} = $props();
|
|
37
|
+
}: SkeletonProps = $props();
|
|
37
38
|
|
|
38
39
|
// =========================================================================
|
|
39
|
-
//
|
|
40
|
+
// Methods
|
|
40
41
|
// =========================================================================
|
|
41
|
-
|
|
42
|
-
const containerClasses = $derived(['skeleton', className].filter(Boolean).join(' '));
|
|
43
|
-
|
|
44
42
|
// パターン設定をマージ
|
|
45
43
|
const mergedPatterns = $derived.by(() => {
|
|
46
44
|
return patterns
|
|
@@ -97,6 +95,10 @@
|
|
|
97
95
|
.flat();
|
|
98
96
|
});
|
|
99
97
|
|
|
98
|
+
// =========================================================================
|
|
99
|
+
// $derived
|
|
100
|
+
// =========================================================================
|
|
101
|
+
const containerClasses = $derived(['skeleton', className].filter(Boolean).join(' '));
|
|
100
102
|
const repeatGapStyle = $derived(getStyleFromNumber(repeatGap));
|
|
101
103
|
const patternGapStyle = $derived(getStyleFromNumber(patternGap));
|
|
102
104
|
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SkeletonPatternConfig } from '../../types/skeleton';
|
|
2
|
-
type
|
|
2
|
+
export type SkeletonProps = {
|
|
3
3
|
patterns?: SkeletonPatternConfig[];
|
|
4
4
|
repeat?: number;
|
|
5
5
|
repeatGap?: string | number;
|
|
@@ -8,6 +8,6 @@ type $$ComponentProps = {
|
|
|
8
8
|
customStyle?: string;
|
|
9
9
|
animated?: boolean;
|
|
10
10
|
};
|
|
11
|
-
declare const Skeleton: import("svelte").Component
|
|
11
|
+
declare const Skeleton: import("svelte").Component<SkeletonProps, {}, "">;
|
|
12
12
|
type Skeleton = ReturnType<typeof Skeleton>;
|
|
13
13
|
export default Skeleton;
|
|
@@ -12,18 +12,22 @@
|
|
|
12
12
|
} from '../../constants/skeleton';
|
|
13
13
|
|
|
14
14
|
// =========================================================================
|
|
15
|
-
// Props
|
|
15
|
+
// Props, States & Constants
|
|
16
16
|
// =========================================================================
|
|
17
|
+
export type SkeletonAvatarProps = {
|
|
18
|
+
avatarConfig?: Partial<SkeletonAvatarConfig>;
|
|
19
|
+
animated?: boolean;
|
|
20
|
+
};
|
|
17
21
|
|
|
18
22
|
let {
|
|
19
23
|
// 基本プロパティ
|
|
20
24
|
avatarConfig = {},
|
|
21
25
|
animated = true
|
|
22
|
-
}:
|
|
23
|
-
avatarConfig?: Partial<SkeletonAvatarConfig>;
|
|
24
|
-
animated?: boolean;
|
|
25
|
-
} = $props();
|
|
26
|
+
}: SkeletonAvatarProps = $props();
|
|
26
27
|
|
|
28
|
+
// =========================================================================
|
|
29
|
+
// $derived
|
|
30
|
+
// =========================================================================
|
|
27
31
|
// マージされた設定
|
|
28
32
|
const mergedAvatarImageConfig = $derived({
|
|
29
33
|
...DEFAULT_AVATAR_IMAGE_CONFIG,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { SkeletonAvatarConfig } from '../../types/skeleton';
|
|
2
|
-
type
|
|
2
|
+
export type SkeletonAvatarProps = {
|
|
3
3
|
avatarConfig?: Partial<SkeletonAvatarConfig>;
|
|
4
4
|
animated?: boolean;
|
|
5
5
|
};
|
|
6
|
-
declare const SkeletonAvatar: import("svelte").Component
|
|
6
|
+
declare const SkeletonAvatar: import("svelte").Component<SkeletonAvatarProps, {}, "">;
|
|
7
7
|
type SkeletonAvatar = ReturnType<typeof SkeletonAvatar>;
|
|
8
8
|
export default SkeletonAvatar;
|
|
@@ -5,8 +5,17 @@
|
|
|
5
5
|
import { DEFAULT_BOX_CONFIG } from '../../constants/skeleton';
|
|
6
6
|
|
|
7
7
|
// =========================================================================
|
|
8
|
-
// Props
|
|
8
|
+
// Props, States & Constants
|
|
9
9
|
// =========================================================================
|
|
10
|
+
export type SkeletonBoxProps = {
|
|
11
|
+
width?: string | number;
|
|
12
|
+
height?: string | number;
|
|
13
|
+
aspectRatio?: string | number;
|
|
14
|
+
radius?: string | number;
|
|
15
|
+
animated?: boolean;
|
|
16
|
+
className?: string;
|
|
17
|
+
customStyle?: string;
|
|
18
|
+
};
|
|
10
19
|
|
|
11
20
|
let {
|
|
12
21
|
// 基本プロパティ
|
|
@@ -17,20 +26,11 @@
|
|
|
17
26
|
animated = true,
|
|
18
27
|
className = '',
|
|
19
28
|
customStyle = ''
|
|
20
|
-
}:
|
|
21
|
-
width?: string | number;
|
|
22
|
-
height?: string | number;
|
|
23
|
-
aspectRatio?: string | number;
|
|
24
|
-
radius?: string | number;
|
|
25
|
-
animated?: boolean;
|
|
26
|
-
className?: string;
|
|
27
|
-
customStyle?: string;
|
|
28
|
-
} = $props();
|
|
29
|
+
}: SkeletonBoxProps = $props();
|
|
29
30
|
|
|
30
31
|
// =========================================================================
|
|
31
32
|
// $derived
|
|
32
33
|
// =========================================================================
|
|
33
|
-
|
|
34
34
|
const containerClasses = $derived(
|
|
35
35
|
['skeleton-box', animated && 'skeleton-box--animated', className].filter(Boolean).join(' ')
|
|
36
36
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type
|
|
1
|
+
export type SkeletonBoxProps = {
|
|
2
2
|
width?: string | number;
|
|
3
3
|
height?: string | number;
|
|
4
4
|
aspectRatio?: string | number;
|
|
@@ -7,6 +7,6 @@ type $$ComponentProps = {
|
|
|
7
7
|
className?: string;
|
|
8
8
|
customStyle?: string;
|
|
9
9
|
};
|
|
10
|
-
declare const SkeletonBox: import("svelte").Component
|
|
10
|
+
declare const SkeletonBox: import("svelte").Component<SkeletonBoxProps, {}, "">;
|
|
11
11
|
type SkeletonBox = ReturnType<typeof SkeletonBox>;
|
|
12
12
|
export default SkeletonBox;
|
|
@@ -6,14 +6,19 @@
|
|
|
6
6
|
import type { SkeletonButtonConfig } from '../../types/skeleton';
|
|
7
7
|
import { DEFAULT_BUTTON_CONFIG } from '../../constants/skeleton';
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
// =========================================================================
|
|
10
|
+
// Props, States & Constants
|
|
11
|
+
// =========================================================================
|
|
12
|
+
export type SkeletonButtonProps = {
|
|
13
13
|
buttonConfig?: Partial<SkeletonButtonConfig>;
|
|
14
14
|
animated?: boolean;
|
|
15
|
-
}
|
|
15
|
+
};
|
|
16
16
|
|
|
17
|
+
let { buttonConfig = {}, animated = true }: SkeletonButtonProps = $props();
|
|
18
|
+
|
|
19
|
+
// =========================================================================
|
|
20
|
+
// $derived
|
|
21
|
+
// =========================================================================
|
|
17
22
|
// マージされた設定
|
|
18
23
|
const mergedButtonConfig = $derived({
|
|
19
24
|
...DEFAULT_BUTTON_CONFIG,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { SkeletonButtonConfig } from '../../types/skeleton';
|
|
2
|
-
type
|
|
2
|
+
export type SkeletonButtonProps = {
|
|
3
3
|
buttonConfig?: Partial<SkeletonButtonConfig>;
|
|
4
4
|
animated?: boolean;
|
|
5
5
|
};
|
|
6
|
-
declare const SkeletonButton: import("svelte").Component
|
|
6
|
+
declare const SkeletonButton: import("svelte").Component<SkeletonButtonProps, {}, "">;
|
|
7
7
|
type SkeletonButton = ReturnType<typeof SkeletonButton>;
|
|
8
8
|
export default SkeletonButton;
|
|
@@ -7,27 +7,24 @@
|
|
|
7
7
|
import { DEFAULT_HEADING_CONFIG } from '../../constants/skeleton';
|
|
8
8
|
|
|
9
9
|
// =========================================================================
|
|
10
|
-
// Props
|
|
10
|
+
// Props, States & Constants
|
|
11
11
|
// =========================================================================
|
|
12
|
-
|
|
13
|
-
let {
|
|
14
|
-
headingConfig = {},
|
|
15
|
-
animated = true
|
|
16
|
-
}: {
|
|
12
|
+
export type SkeletonHeadingProps = {
|
|
17
13
|
headingConfig?: Partial<SkeletonHeadingConfig>;
|
|
18
14
|
animated?: boolean;
|
|
19
|
-
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
let { headingConfig = {}, animated = true }: SkeletonHeadingProps = $props();
|
|
20
18
|
|
|
19
|
+
// =========================================================================
|
|
20
|
+
// $derived
|
|
21
|
+
// =========================================================================
|
|
21
22
|
// マージされた設定
|
|
22
23
|
const mergedHeadingConfig = $derived({
|
|
23
24
|
...DEFAULT_HEADING_CONFIG,
|
|
24
25
|
...headingConfig
|
|
25
26
|
});
|
|
26
27
|
|
|
27
|
-
// =========================================================================
|
|
28
|
-
// $derived
|
|
29
|
-
// =========================================================================
|
|
30
|
-
|
|
31
28
|
const widthStyle = $derived(getStyleFromNumber(mergedHeadingConfig.width));
|
|
32
29
|
const fontSizeStyle = $derived(
|
|
33
30
|
mergedHeadingConfig.fontSize
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { SkeletonHeadingConfig } from '../../types/skeleton';
|
|
2
|
-
type
|
|
2
|
+
export type SkeletonHeadingProps = {
|
|
3
3
|
headingConfig?: Partial<SkeletonHeadingConfig>;
|
|
4
4
|
animated?: boolean;
|
|
5
5
|
};
|
|
6
|
-
declare const SkeletonHeading: import("svelte").Component
|
|
6
|
+
declare const SkeletonHeading: import("svelte").Component<SkeletonHeadingProps, {}, "">;
|
|
7
7
|
type SkeletonHeading = ReturnType<typeof SkeletonHeading>;
|
|
8
8
|
export default SkeletonHeading;
|
|
@@ -11,16 +11,20 @@
|
|
|
11
11
|
DEFAULT_TEXT_CONFIG_MEDIA
|
|
12
12
|
} from '../../constants/skeleton';
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}: {
|
|
14
|
+
// =========================================================================
|
|
15
|
+
// Props, States & Constants
|
|
16
|
+
// =========================================================================
|
|
17
|
+
export type SkeletonMediaProps = {
|
|
19
18
|
width?: string | number;
|
|
20
19
|
mediaConfig?: Partial<SkeletonMediaConfig>;
|
|
21
20
|
animated?: boolean;
|
|
22
|
-
}
|
|
21
|
+
};
|
|
23
22
|
|
|
23
|
+
let { width = '100%', mediaConfig = {}, animated = true }: SkeletonMediaProps = $props();
|
|
24
|
+
|
|
25
|
+
// =========================================================================
|
|
26
|
+
// $derived
|
|
27
|
+
// =========================================================================
|
|
24
28
|
// マージされた設定
|
|
25
29
|
const mergedMediaConfig = $derived({
|
|
26
30
|
...DEFAULT_MEDIA_CONFIG,
|