svelte-comp 1.1.5 → 1.2.2
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/README.md +11 -3
- package/dist/lang.d.ts +1081 -0
- package/dist/lang.js +1096 -0
- package/dist/lib/CodeView.svelte +34 -22
- package/dist/lib/CodeView.svelte.d.ts +4 -0
- package/dist/lib/Dialog.svelte +10 -1
- package/dist/lib/SearchInput.svelte +97 -0
- package/dist/lib/SearchInput.svelte.d.ts +12 -0
- package/dist/lib/Table.svelte +14 -2
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +1 -0
- package/package.json +4 -4
package/dist/lib/CodeView.svelte
CHANGED
|
@@ -30,6 +30,9 @@
|
|
|
30
30
|
* @options xs|sm|md|lg|xl
|
|
31
31
|
* @default md
|
|
32
32
|
*
|
|
33
|
+
* @prop class {string} - Extra classes applied to the root container
|
|
34
|
+
* @default ""
|
|
35
|
+
*
|
|
33
36
|
* @note Uses Prism for syntax highlighting; HTML/CSS/TXT grammars are bundled by default.
|
|
34
37
|
* @note Editable mode renders a transparent textarea above a highlighted code layer, mirroring real editors.
|
|
35
38
|
* @note Cursor-line highlight is overlaid using CSS variables and scroll-position tracking.
|
|
@@ -59,6 +62,7 @@
|
|
|
59
62
|
editable?: boolean;
|
|
60
63
|
activeLine?: boolean;
|
|
61
64
|
sz?: SizeKey;
|
|
65
|
+
class?: string;
|
|
62
66
|
};
|
|
63
67
|
|
|
64
68
|
let {
|
|
@@ -70,6 +74,7 @@
|
|
|
70
74
|
editable = false,
|
|
71
75
|
activeLine = false,
|
|
72
76
|
sz = "md",
|
|
77
|
+
class: externalClass = "",
|
|
73
78
|
}: Props = $props();
|
|
74
79
|
|
|
75
80
|
let textareaEl = $state<HTMLTextAreaElement | null>(null);
|
|
@@ -141,11 +146,12 @@
|
|
|
141
146
|
</script>
|
|
142
147
|
|
|
143
148
|
<div
|
|
144
|
-
class={cx(
|
|
145
|
-
"w-full border border-[var(--border-color-default)] bg-[var(--color-bg-surface)]",
|
|
146
|
-
"text-[var(--color-text-default)]"
|
|
147
|
-
|
|
148
|
-
|
|
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
155
|
{#if title}
|
|
150
156
|
<div
|
|
151
157
|
class={cx(
|
|
@@ -170,23 +176,29 @@
|
|
|
170
176
|
</div>
|
|
171
177
|
{/if}
|
|
172
178
|
|
|
173
|
-
<div
|
|
174
|
-
{
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
{
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
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">
|
|
190
202
|
<div
|
|
191
203
|
bind:this={highlightEl}
|
|
192
204
|
class={cx("cv-highlight cv-layer", TEXT[sz], LINE_HEIGHT[sz])}
|
|
@@ -28,6 +28,9 @@
|
|
|
28
28
|
* @options xs|sm|md|lg|xl
|
|
29
29
|
* @default md
|
|
30
30
|
*
|
|
31
|
+
* @prop class {string} - Extra classes applied to the root container
|
|
32
|
+
* @default ""
|
|
33
|
+
*
|
|
31
34
|
* @note Uses Prism for syntax highlighting; HTML/CSS/TXT grammars are bundled by default.
|
|
32
35
|
* @note Editable mode renders a transparent textarea above a highlighted code layer, mirroring real editors.
|
|
33
36
|
* @note Cursor-line highlight is overlaid using CSS variables and scroll-position tracking.
|
|
@@ -54,6 +57,7 @@ type Props = {
|
|
|
54
57
|
editable?: boolean;
|
|
55
58
|
activeLine?: boolean;
|
|
56
59
|
sz?: SizeKey;
|
|
60
|
+
class?: string;
|
|
57
61
|
};
|
|
58
62
|
declare const CodeView: import("svelte").Component<Props, {}, "code">;
|
|
59
63
|
type CodeView = ReturnType<typeof CodeView>;
|
package/dist/lib/Dialog.svelte
CHANGED
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
const panelBase =
|
|
103
|
-
"bg-[var(--color-bg-surface)] rounded-[var(--radius-lg)] shadow-lg min-w-80 max-w-md w-full border border-[var(--border-color-default)]";
|
|
103
|
+
"fusion-dialog bg-[var(--color-bg-surface)] rounded-[var(--radius-lg)] shadow-lg min-w-80 max-w-md w-full border border-[var(--border-color-default)]";
|
|
104
104
|
|
|
105
105
|
const paddingBySize: Record<SizeKey, string> = {
|
|
106
106
|
xs: "p-[var(--spacing-sm)]",
|
|
@@ -224,3 +224,12 @@
|
|
|
224
224
|
</div>
|
|
225
225
|
{/if}
|
|
226
226
|
{/if}
|
|
227
|
+
<style>
|
|
228
|
+
:global(.fusion-dialog h3) {
|
|
229
|
+
color: var(--color-text-default);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
:global(.fusion-dialog p) {
|
|
233
|
+
color: var(--color-text-muted);
|
|
234
|
+
}
|
|
235
|
+
</style>
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* @component SearchInput
|
|
4
|
+
* @description Search input field with a leading search icon.
|
|
5
|
+
*
|
|
6
|
+
* @prop label {string} - Label text rendered above the field
|
|
7
|
+
*
|
|
8
|
+
* @prop placeholder {string} - Placeholder text
|
|
9
|
+
* @default "Search"
|
|
10
|
+
*
|
|
11
|
+
* @prop value {string} - Controlled field value (bindable)
|
|
12
|
+
* @default ""
|
|
13
|
+
*
|
|
14
|
+
* @prop sz {SizeKey} - Size preset for spacing and typography
|
|
15
|
+
* @options xs|sm|md|lg|xl
|
|
16
|
+
* @default sm
|
|
17
|
+
*
|
|
18
|
+
* @prop variant {FieldVariant} - Visual style variant
|
|
19
|
+
* @options default|filled|neutral
|
|
20
|
+
* @default filled
|
|
21
|
+
*
|
|
22
|
+
* @prop class {string} - Additional classes applied to the Field root
|
|
23
|
+
* @default ""
|
|
24
|
+
*
|
|
25
|
+
* @note Renders a leading search icon and uses `Field` with `type="search"` and `clearable`.
|
|
26
|
+
*/
|
|
27
|
+
import Field from "./Field.svelte";
|
|
28
|
+
|
|
29
|
+
type Props = {
|
|
30
|
+
label?: string;
|
|
31
|
+
placeholder?: string;
|
|
32
|
+
value?: string;
|
|
33
|
+
sz?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
34
|
+
variant?: 'default' | 'filled' | 'neutral';
|
|
35
|
+
class?: string;
|
|
36
|
+
[key: string]: unknown;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
let {
|
|
40
|
+
label,
|
|
41
|
+
placeholder = 'Search',
|
|
42
|
+
value = $bindable(''),
|
|
43
|
+
sz = 'sm',
|
|
44
|
+
variant = 'filled',
|
|
45
|
+
class: externalClass = '',
|
|
46
|
+
...rest
|
|
47
|
+
}: Props = $props();
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
{#snippet leading()}
|
|
51
|
+
<span class="ml-1 inline-flex h-6 w-6 items-center justify-center text-[var(--color-text-muted)]">
|
|
52
|
+
<svg
|
|
53
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
54
|
+
width="20"
|
|
55
|
+
height="20"
|
|
56
|
+
viewBox="0 0 24 24"
|
|
57
|
+
fill="none"
|
|
58
|
+
stroke="currentColor"
|
|
59
|
+
stroke-width="2"
|
|
60
|
+
stroke-linecap="round"
|
|
61
|
+
stroke-linejoin="round"
|
|
62
|
+
class="lucide lucide-search-icon lucide-search"
|
|
63
|
+
>
|
|
64
|
+
<path d="m21 21-4.34-4.34" />
|
|
65
|
+
<circle cx="11" cy="11" r="8" />
|
|
66
|
+
</svg>
|
|
67
|
+
</span>
|
|
68
|
+
{/snippet}
|
|
69
|
+
|
|
70
|
+
<Field
|
|
71
|
+
{label}
|
|
72
|
+
bind:value
|
|
73
|
+
{sz}
|
|
74
|
+
{variant}
|
|
75
|
+
type="search"
|
|
76
|
+
clearable={true}
|
|
77
|
+
{leading}
|
|
78
|
+
{placeholder}
|
|
79
|
+
class={`search-input w-full max-w-[520px] [&_input]:pl-10 ${externalClass}`}
|
|
80
|
+
{...rest}
|
|
81
|
+
/>
|
|
82
|
+
|
|
83
|
+
<style>
|
|
84
|
+
:global(.search-input input[type="search"]) {
|
|
85
|
+
-webkit-appearance: none;
|
|
86
|
+
appearance: none;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
:global(.search-input input[type="search"]::-webkit-search-cancel-button),
|
|
90
|
+
:global(.search-input input[type="search"]::-webkit-search-decoration),
|
|
91
|
+
:global(.search-input input[type="search"]::-webkit-search-results-button),
|
|
92
|
+
:global(.search-input input[type="search"]::-webkit-search-results-decoration) {
|
|
93
|
+
-webkit-appearance: none;
|
|
94
|
+
appearance: none;
|
|
95
|
+
display: none;
|
|
96
|
+
}
|
|
97
|
+
</style>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
label?: string;
|
|
3
|
+
placeholder?: string;
|
|
4
|
+
value?: string;
|
|
5
|
+
sz?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
6
|
+
variant?: 'default' | 'filled' | 'neutral';
|
|
7
|
+
class?: string;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
};
|
|
10
|
+
declare const SearchInput: import("svelte").Component<Props, {}, "value">;
|
|
11
|
+
type SearchInput = ReturnType<typeof SearchInput>;
|
|
12
|
+
export default SearchInput;
|
package/dist/lib/Table.svelte
CHANGED
|
@@ -171,6 +171,13 @@
|
|
|
171
171
|
const alignTd = (a?: CellAlign) =>
|
|
172
172
|
a === "end" ? "text-right" : a === "start" ? "text-left" : "text-center";
|
|
173
173
|
|
|
174
|
+
const alignTh = (a?: CellAlign) =>
|
|
175
|
+
a === "end"
|
|
176
|
+
? "justify-end"
|
|
177
|
+
: a === "center"
|
|
178
|
+
? "justify-center"
|
|
179
|
+
: "justify-start";
|
|
180
|
+
|
|
174
181
|
const wrapperClass = $derived(cx("overflow-x-auto", externalClass));
|
|
175
182
|
const tableTextSize = $derived(TEXT[sz]);
|
|
176
183
|
const currentVariant = $derived(variant);
|
|
@@ -225,7 +232,10 @@
|
|
|
225
232
|
>
|
|
226
233
|
<button
|
|
227
234
|
type="button"
|
|
228
|
-
class=
|
|
235
|
+
class={cx(
|
|
236
|
+
"flex w-full items-center gap-2 select-none hover:bg-[var(--color-bg-hover)] rounded-none px-1 py-0.5 border border-transparent focus-visible:border-[var(--border-color-focus)] focus-visible:ring-2 focus-visible:ring-[var(--border-color-focus)] focus-visible:outline-none",
|
|
237
|
+
alignTh(col.align)
|
|
238
|
+
)}
|
|
229
239
|
onclick={() => toggleSort(col)}
|
|
230
240
|
onkeydown={(e) => {
|
|
231
241
|
if (e.key === "Enter" || e.key === " ") {
|
|
@@ -235,7 +245,9 @@
|
|
|
235
245
|
}}
|
|
236
246
|
aria-label={`Sort by ${col.label}`}
|
|
237
247
|
>
|
|
238
|
-
<span class="truncate min-w-0
|
|
248
|
+
<span class={cx("truncate min-w-0", alignTd(col.align))}>
|
|
249
|
+
{col.label}
|
|
250
|
+
</span>
|
|
239
251
|
<svg
|
|
240
252
|
class={cx(
|
|
241
253
|
"h-4 w-4 opacity-60 transition-transform",
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export { default as PrimaryColorSelect } from "./PrimaryColorSelect.svelte";
|
|
|
18
18
|
export { default as ProgressBar } from "./ProgressBar.svelte";
|
|
19
19
|
export { default as ProgressCircle } from "./ProgressCircle.svelte";
|
|
20
20
|
export { default as Radio } from "./Radio.svelte";
|
|
21
|
+
export { default as SearchInput } from "./SearchInput.svelte";
|
|
21
22
|
export { default as Select } from "./Select.svelte";
|
|
22
23
|
export { default as Slider } from "./Slider.svelte";
|
|
23
24
|
export { default as Splitter } from "./Splitter.svelte";
|
package/dist/lib/index.js
CHANGED
|
@@ -19,6 +19,7 @@ export { default as PrimaryColorSelect } from "./PrimaryColorSelect.svelte";
|
|
|
19
19
|
export { default as ProgressBar } from "./ProgressBar.svelte";
|
|
20
20
|
export { default as ProgressCircle } from "./ProgressCircle.svelte";
|
|
21
21
|
export { default as Radio } from "./Radio.svelte";
|
|
22
|
+
export { default as SearchInput } from "./SearchInput.svelte";
|
|
22
23
|
export { default as Select } from "./Select.svelte";
|
|
23
24
|
export { default as Slider } from "./Slider.svelte";
|
|
24
25
|
export { default as Splitter } from "./Splitter.svelte";
|
package/package.json
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
+
"name": "svelte-comp",
|
|
3
|
+
"version": "1.2.2",
|
|
4
|
+
"license": "MIT",
|
|
2
5
|
"description": "A comprehensive component library built on Svelte 5 (runes) with design tokens (tailwind), accessibility focus, and TypeScript support",
|
|
3
6
|
"devDependencies": {
|
|
4
7
|
"@sveltejs/package": "^2.5.7",
|
|
@@ -34,8 +37,6 @@
|
|
|
34
37
|
"tailwind",
|
|
35
38
|
"ui-library"
|
|
36
39
|
],
|
|
37
|
-
"license": "MIT",
|
|
38
|
-
"name": "svelte-comp",
|
|
39
40
|
"peerDependencies": {
|
|
40
41
|
"svelte": "^5.0.0"
|
|
41
42
|
},
|
|
@@ -46,6 +47,5 @@
|
|
|
46
47
|
},
|
|
47
48
|
"svelte": "./dist/lib/index.js",
|
|
48
49
|
"type": "module",
|
|
49
|
-
"types": "./dist/lib/index.d.ts"
|
|
50
|
-
"version": "1.1.5"
|
|
50
|
+
"types": "./dist/lib/index.d.ts"
|
|
51
51
|
}
|