svelte-comp 1.2.2 → 1.2.5
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/lib/CodeView.svelte +29 -29
- package/dist/lib/Pagination.svelte +22 -1
- package/dist/lib/SearchInput.svelte +15 -6
- package/dist/lib/SearchInput.svelte.d.ts +3 -2
- package/dist/lib/ThemeToggle.svelte +1 -1
- package/dist/lib/lang.d.ts +9 -0
- package/dist/lib/lang.js +9 -0
- package/package.json +1 -1
package/dist/lib/CodeView.svelte
CHANGED
|
@@ -146,12 +146,12 @@
|
|
|
146
146
|
</script>
|
|
147
147
|
|
|
148
148
|
<div
|
|
149
|
-
class={cx(
|
|
150
|
-
"cv-root w-full h-full min-h-0 flex flex-col border border-[var(--border-color-default)] bg-[var(--color-bg-surface)]",
|
|
151
|
-
"text-[var(--color-text-default)]",
|
|
152
|
-
externalClass
|
|
153
|
-
)}
|
|
154
|
-
>
|
|
149
|
+
class={cx(
|
|
150
|
+
"cv-root w-full h-full min-h-0 flex flex-col border border-[var(--border-color-default)] bg-[var(--color-bg-surface)]",
|
|
151
|
+
"text-[var(--color-text-default)]",
|
|
152
|
+
externalClass
|
|
153
|
+
)}
|
|
154
|
+
>
|
|
155
155
|
{#if title}
|
|
156
156
|
<div
|
|
157
157
|
class={cx(
|
|
@@ -176,29 +176,29 @@
|
|
|
176
176
|
</div>
|
|
177
177
|
{/if}
|
|
178
178
|
|
|
179
|
-
<div
|
|
180
|
-
class={cx(
|
|
181
|
-
"cv-body flex flex-1 min-h-0 font-mono",
|
|
182
|
-
TEXT[sz],
|
|
183
|
-
LINE_HEIGHT[sz]
|
|
184
|
-
)}
|
|
185
|
-
>
|
|
186
|
-
{#if showLineNumbers}
|
|
187
|
-
<div
|
|
188
|
-
bind:this={gutterEl}
|
|
189
|
-
class={cx(
|
|
190
|
-
"select-none px-3 py-[12px] border-r border-[var(--border-color-default)]",
|
|
191
|
-
"text-[var(--color-text-muted)] text-right overflow-hidden",
|
|
192
|
-
"cv-gutter bg-[var(--color-bg-surface)] tabular-nums h-full min-h-0"
|
|
193
|
-
)}
|
|
194
|
-
>
|
|
195
|
-
{#each lines as _, i (i)}
|
|
196
|
-
<div class={LINE_HEIGHT[sz]}>{i + 1}</div>
|
|
197
|
-
{/each}
|
|
198
|
-
</div>
|
|
199
|
-
{/if}
|
|
200
|
-
|
|
201
|
-
<div class="cv-editor relative flex-1 min-h-0">
|
|
179
|
+
<div
|
|
180
|
+
class={cx(
|
|
181
|
+
"cv-body flex flex-1 min-h-0 font-mono",
|
|
182
|
+
TEXT[sz],
|
|
183
|
+
LINE_HEIGHT[sz]
|
|
184
|
+
)}
|
|
185
|
+
>
|
|
186
|
+
{#if showLineNumbers}
|
|
187
|
+
<div
|
|
188
|
+
bind:this={gutterEl}
|
|
189
|
+
class={cx(
|
|
190
|
+
"select-none px-3 py-[12px] border-r border-[var(--border-color-default)]",
|
|
191
|
+
"text-[var(--color-text-muted)] text-right overflow-hidden",
|
|
192
|
+
"cv-gutter bg-[var(--color-bg-surface)] tabular-nums h-full min-h-0"
|
|
193
|
+
)}
|
|
194
|
+
>
|
|
195
|
+
{#each lines as _, i (i)}
|
|
196
|
+
<div class={LINE_HEIGHT[sz]}>{i + 1}</div>
|
|
197
|
+
{/each}
|
|
198
|
+
</div>
|
|
199
|
+
{/if}
|
|
200
|
+
|
|
201
|
+
<div class="cv-editor relative flex-1 min-h-0">
|
|
202
202
|
<div
|
|
203
203
|
bind:this={highlightEl}
|
|
204
204
|
class={cx("cv-highlight cv-layer", TEXT[sz], LINE_HEIGHT[sz])}
|
|
@@ -65,13 +65,14 @@
|
|
|
65
65
|
</script>
|
|
66
66
|
|
|
67
67
|
<div class={wrapperClass}>
|
|
68
|
-
<span>Page {currentPage} of {totalPages}</span>
|
|
68
|
+
<span class="pagination-count">Page {currentPage} of {totalPages}</span>
|
|
69
69
|
|
|
70
70
|
<Button
|
|
71
71
|
onClick={prevPage}
|
|
72
72
|
disabled={currentPage === 1}
|
|
73
73
|
sz="xs"
|
|
74
74
|
variant="secondary"
|
|
75
|
+
class="pagination-btn"
|
|
75
76
|
>
|
|
76
77
|
<
|
|
77
78
|
</Button>
|
|
@@ -82,6 +83,7 @@
|
|
|
82
83
|
sz="xs"
|
|
83
84
|
variant={currentPage === page ? "primary" : "secondary"}
|
|
84
85
|
aria-current={currentPage === page ? "page" : undefined}
|
|
86
|
+
class="pagination-btn"
|
|
85
87
|
>
|
|
86
88
|
{page}
|
|
87
89
|
</Button>
|
|
@@ -92,7 +94,26 @@
|
|
|
92
94
|
disabled={currentPage === totalPages}
|
|
93
95
|
sz="xs"
|
|
94
96
|
variant="secondary"
|
|
97
|
+
class="pagination-btn"
|
|
95
98
|
>
|
|
96
99
|
>
|
|
97
100
|
</Button>
|
|
98
101
|
</div>
|
|
102
|
+
|
|
103
|
+
<style>
|
|
104
|
+
@media (max-width: 640px) {
|
|
105
|
+
:global(.pagination-btn) {
|
|
106
|
+
font-size: 10px;
|
|
107
|
+
line-height: 1;
|
|
108
|
+
height: 20px;
|
|
109
|
+
padding: 0 6px;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@media (max-width: 480px) {
|
|
114
|
+
:global(.pagination-count) {
|
|
115
|
+
display: none;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
</style>
|
|
119
|
+
|
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @prop label {string} - Label text rendered above the field
|
|
7
7
|
*
|
|
8
|
-
* @prop placeholder {string} - Placeholder text
|
|
9
|
-
* @default "Search"
|
|
8
|
+
* @prop placeholder {string} - Placeholder text (localized by default)
|
|
10
9
|
*
|
|
11
10
|
* @prop value {string} - Controlled field value (bindable)
|
|
12
11
|
* @default ""
|
|
@@ -24,27 +23,37 @@
|
|
|
24
23
|
*
|
|
25
24
|
* @note Renders a leading search icon and uses `Field` with `type="search"` and `clearable`.
|
|
26
25
|
*/
|
|
26
|
+
import { getContext } from "svelte";
|
|
27
27
|
import Field from "./Field.svelte";
|
|
28
|
+
import type { FieldVariant, SizeKey } from "./types";
|
|
29
|
+
import { TEXTS } from "./lang";
|
|
28
30
|
|
|
29
31
|
type Props = {
|
|
30
32
|
label?: string;
|
|
31
33
|
placeholder?: string;
|
|
32
34
|
value?: string;
|
|
33
|
-
sz?:
|
|
34
|
-
variant?:
|
|
35
|
+
sz?: SizeKey;
|
|
36
|
+
variant?: FieldVariant;
|
|
35
37
|
class?: string;
|
|
36
38
|
[key: string]: unknown;
|
|
37
39
|
};
|
|
38
40
|
|
|
39
41
|
let {
|
|
40
42
|
label,
|
|
41
|
-
placeholder
|
|
43
|
+
placeholder,
|
|
42
44
|
value = $bindable(''),
|
|
43
45
|
sz = 'sm',
|
|
44
46
|
variant = 'filled',
|
|
45
47
|
class: externalClass = '',
|
|
46
48
|
...rest
|
|
47
49
|
}: Props = $props();
|
|
50
|
+
|
|
51
|
+
const langCtx =
|
|
52
|
+
getContext<{ value: keyof typeof TEXTS } | undefined>("lang") ?? null;
|
|
53
|
+
const langKey = $derived(langCtx?.value ?? "en");
|
|
54
|
+
const L = $derived(TEXTS[langKey].components.searchInput);
|
|
55
|
+
|
|
56
|
+
const placeholderFinal = $derived(placeholder ?? L.placeholder);
|
|
48
57
|
</script>
|
|
49
58
|
|
|
50
59
|
{#snippet leading()}
|
|
@@ -75,7 +84,7 @@
|
|
|
75
84
|
type="search"
|
|
76
85
|
clearable={true}
|
|
77
86
|
{leading}
|
|
78
|
-
{
|
|
87
|
+
placeholder={placeholderFinal}
|
|
79
88
|
class={`search-input w-full max-w-[520px] [&_input]:pl-10 ${externalClass}`}
|
|
80
89
|
{...rest}
|
|
81
90
|
/>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import type { FieldVariant, SizeKey } from "./types";
|
|
1
2
|
type Props = {
|
|
2
3
|
label?: string;
|
|
3
4
|
placeholder?: string;
|
|
4
5
|
value?: string;
|
|
5
|
-
sz?:
|
|
6
|
-
variant?:
|
|
6
|
+
sz?: SizeKey;
|
|
7
|
+
variant?: FieldVariant;
|
|
7
8
|
class?: string;
|
|
8
9
|
[key: string]: unknown;
|
|
9
10
|
};
|
package/dist/lib/lang.d.ts
CHANGED
|
@@ -29,6 +29,9 @@ export declare const TEXTS: {
|
|
|
29
29
|
readonly fileCount: "{n} file(s) selected";
|
|
30
30
|
readonly totalSize: "Total size";
|
|
31
31
|
};
|
|
32
|
+
readonly searchInput: {
|
|
33
|
+
readonly placeholder: "Search";
|
|
34
|
+
};
|
|
32
35
|
readonly menu: {
|
|
33
36
|
readonly subtitle: "Menu with size options";
|
|
34
37
|
};
|
|
@@ -78,6 +81,9 @@ export declare const TEXTS: {
|
|
|
78
81
|
readonly fileCount: "{n} файл(ов) выбрано";
|
|
79
82
|
readonly totalSize: "Общий размер";
|
|
80
83
|
};
|
|
84
|
+
readonly searchInput: {
|
|
85
|
+
readonly placeholder: "?????";
|
|
86
|
+
};
|
|
81
87
|
readonly menu: {
|
|
82
88
|
readonly subtitle: "Меню с вариантами размеров";
|
|
83
89
|
};
|
|
@@ -127,6 +133,9 @@ export declare const TEXTS: {
|
|
|
127
133
|
readonly fileCount: "{n} archivo(s) seleccionado(s)";
|
|
128
134
|
readonly totalSize: "Tamaño total";
|
|
129
135
|
};
|
|
136
|
+
readonly searchInput: {
|
|
137
|
+
readonly placeholder: "Buscar";
|
|
138
|
+
};
|
|
130
139
|
readonly menu: {
|
|
131
140
|
readonly subtitle: "Menú con opciones de tamaño";
|
|
132
141
|
};
|
package/dist/lib/lang.js
CHANGED
|
@@ -29,6 +29,9 @@ var enTexts = {
|
|
|
29
29
|
fileCount: "{n} file(s) selected",
|
|
30
30
|
totalSize: "Total size",
|
|
31
31
|
},
|
|
32
|
+
searchInput: {
|
|
33
|
+
placeholder: "Search",
|
|
34
|
+
},
|
|
32
35
|
menu: { subtitle: "Menu with size options" },
|
|
33
36
|
primaryColorSelect: { text: "Primary color" },
|
|
34
37
|
timePicker: {
|
|
@@ -74,6 +77,9 @@ var ruTexts = {
|
|
|
74
77
|
fileCount: "{n} файл(ов) выбрано",
|
|
75
78
|
totalSize: "Общий размер",
|
|
76
79
|
},
|
|
80
|
+
searchInput: {
|
|
81
|
+
placeholder: "?????",
|
|
82
|
+
},
|
|
77
83
|
menu: { subtitle: "Меню с вариантами размеров" },
|
|
78
84
|
primaryColorSelect: { text: "Основной цвет" },
|
|
79
85
|
timePicker: {
|
|
@@ -119,6 +125,9 @@ var esTexts = {
|
|
|
119
125
|
fileCount: "{n} archivo(s) seleccionado(s)",
|
|
120
126
|
totalSize: "Tamaño total",
|
|
121
127
|
},
|
|
128
|
+
searchInput: {
|
|
129
|
+
placeholder: "Buscar",
|
|
130
|
+
},
|
|
122
131
|
menu: { subtitle: "Menú con opciones de tamaño" },
|
|
123
132
|
primaryColorSelect: { text: "Color primario" },
|
|
124
133
|
timePicker: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-comp",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "A comprehensive component library built on Svelte 5 (runes) with design tokens (tailwind), accessibility focus, and TypeScript support",
|
|
6
6
|
"devDependencies": {
|