reburn-ui 0.3.16 → 0.4.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/core/charts/ChartTooltip/ChartTooltip.svelte +6 -6
- package/dist/core/components/Accordion/Accordion.svelte +2 -1
- package/dist/core/components/AppShell/AppShellAside.svelte +6 -4
- package/dist/core/components/AppShell/AppShellFooter.svelte +6 -4
- package/dist/core/components/AppShell/AppShellHeader.svelte +6 -4
- package/dist/core/components/AppShell/AppShellNavbar.svelte +6 -4
- package/dist/core/components/Checkbox/Checkbox.svelte +4 -2
- package/dist/core/components/Checkbox/CheckboxIndicator.svelte +4 -2
- package/dist/core/components/Chip/Chip.svelte +2 -1
- package/dist/core/components/Combobox/ComboboxChevron.svelte +5 -3
- package/dist/core/components/Combobox/ComboboxContext.svelte.d.ts +2 -2
- package/dist/core/components/Combobox/ComboboxFooter.svelte +5 -3
- package/dist/core/components/Combobox/ComboboxHeader.svelte +5 -3
- package/dist/core/components/Combobox/OptionsDropdown/OptionsDropdownOption.svelte +3 -2
- package/dist/core/components/Input/Input.svelte +9 -5
- package/dist/core/components/NavLink/NavLink.svelte +3 -1
- package/dist/core/components/Pill/PillGroupContext.svelte.d.ts +1 -1
- package/dist/core/components/Popover/PopoverContext.svelte.d.ts +8 -8
- package/dist/core/components/SegmentedControl/SegmentedControl.svelte +3 -3
- package/dist/core/icons/IconCheck.svelte +19 -0
- package/dist/core/icons/IconCheck.svelte.d.ts +4 -0
- package/dist/core/icons/IconChevronDown.svelte +19 -0
- package/dist/core/icons/IconChevronDown.svelte.d.ts +4 -0
- package/dist/core/icons/IconMinus.svelte +19 -0
- package/dist/core/icons/IconMinus.svelte.d.ts +4 -0
- package/dist/core/icons/types.d.ts +4 -0
- package/dist/core/icons/types.js +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/unplugin.d.ts +1 -0
- package/dist/tools/unplugin.js +9 -0
- package/package.json +28 -34
- package/dist/icons/IconContainer.svelte +0 -30
- package/dist/icons/IconContainer.svelte.d.ts +0 -11
- package/dist/icons/icon.d.ts +0 -12
- package/dist/icons/index.d.ts +0 -1
- package/dist/icons/index.js +0 -1
- package/dist/tools/icon-vite-plugin/icon-vite-plugin.d.ts +0 -2
- package/dist/tools/icon-vite-plugin/icon-vite-plugin.js +0 -110
- package/dist/tools/icon-vite-plugin/utils/generateComponentName.d.ts +0 -1
- package/dist/tools/icon-vite-plugin/utils/generateComponentName.js +0 -12
- package/dist/tools/icon-vite-plugin/utils/generateIconComponent.d.ts +0 -5
- package/dist/tools/icon-vite-plugin/utils/generateIconComponent.js +0 -46
- package/dist/tools/icon-vite-plugin/utils/serializeIconAttributes.d.ts +0 -2
- package/dist/tools/icon-vite-plugin/utils/serializeIconAttributes.js +0 -11
- package/dist/tools/utils/generateClass.d.ts +0 -1
- package/dist/tools/utils/generateClass.js +0 -4
- package/dist/tools/utils/getAttrValue.d.ts +0 -2
- package/dist/tools/utils/getAttrValue.js +0 -15
- package/dist/tools/utils/isSvelteFile.d.ts +0 -1
- package/dist/tools/utils/isSvelteFile.js +0 -3
- package/dist/tools/utils/resolveConfig.d.ts +0 -2
- package/dist/tools/utils/resolveConfig.js +0 -8
|
@@ -230,6 +230,12 @@
|
|
|
230
230
|
font-size: var(--mantine-font-size-sm);
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
+
:global(:where([data-mantine-color-scheme="light"])) .line {
|
|
234
|
+
--chart-grid-color: rgba(173, 181, 189, 0.6);
|
|
235
|
+
}
|
|
236
|
+
:global(:where([data-mantine-color-scheme="dark"])) .line {
|
|
237
|
+
--chart-grid-color: rgba(105, 105, 105, 0.6);
|
|
238
|
+
}
|
|
233
239
|
.line {
|
|
234
240
|
--dash-length: 0.125rem;
|
|
235
241
|
--dash-space: 0.25rem;
|
|
@@ -239,12 +245,6 @@
|
|
|
239
245
|
opacity: 0.5;
|
|
240
246
|
background: repeating-linear-gradient(to bottom, var(--chart-grid-color) 0, var(--chart-grid-color) var(--dash-length), transparent var(--dash-length), transparent calc(var(--dash-length) + var(--dash-space)));
|
|
241
247
|
}
|
|
242
|
-
:global(:where([data-mantine-color-scheme="light"])) .line {
|
|
243
|
-
--chart-grid-color: rgba(173, 181, 189, 0.6);
|
|
244
|
-
}
|
|
245
|
-
:global(:where([data-mantine-color-scheme="dark"])) .line {
|
|
246
|
-
--chart-grid-color: rgba(105, 105, 105, 0.6);
|
|
247
|
-
}
|
|
248
248
|
|
|
249
249
|
.dot {
|
|
250
250
|
position: absolute;
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
</script>
|
|
67
67
|
|
|
68
68
|
<script lang="ts" generics="T extends AccordionItem, Multiple extends boolean = false">
|
|
69
|
+
import IconChevronDown from '../../icons/IconChevronDown.svelte';
|
|
69
70
|
import type { Snippet } from 'svelte';
|
|
70
71
|
import { type TransitionConfig } from 'svelte/transition';
|
|
71
72
|
|
|
@@ -131,7 +132,7 @@
|
|
|
131
132
|
{#if chevron}
|
|
132
133
|
{@render chevron()}
|
|
133
134
|
{:else}
|
|
134
|
-
<
|
|
135
|
+
<IconChevronDown />
|
|
135
136
|
{/if}
|
|
136
137
|
</span>
|
|
137
138
|
|
|
@@ -38,15 +38,17 @@
|
|
|
38
38
|
height: calc(100dvh - var(--app-shell-header-offset, 0rem) - var(--app-shell-footer-offset, 0rem));
|
|
39
39
|
background-color: var(--mantine-color-body);
|
|
40
40
|
transition-property: transform, top, height;
|
|
41
|
-
inset-inline-end: 0;
|
|
42
|
-
width: var(--app-shell-aside-width);
|
|
43
|
-
transform: var(--app-shell-aside-transform);
|
|
44
|
-
z-index: var(--app-shell-aside-z-index);
|
|
45
41
|
}
|
|
46
42
|
:where([data-layout=alt]) .aside {
|
|
47
43
|
top: 0rem;
|
|
48
44
|
height: 100dvh;
|
|
49
45
|
}
|
|
46
|
+
.aside {
|
|
47
|
+
inset-inline-end: 0;
|
|
48
|
+
width: var(--app-shell-aside-width);
|
|
49
|
+
transform: var(--app-shell-aside-transform);
|
|
50
|
+
z-index: var(--app-shell-aside-z-index);
|
|
51
|
+
}
|
|
50
52
|
.aside :global(:where([dir="rtl"])) {
|
|
51
53
|
transform: var(--app-shell-aside-transform-rtl);
|
|
52
54
|
}
|
|
@@ -35,16 +35,18 @@
|
|
|
35
35
|
inset-inline: 0;
|
|
36
36
|
transition-property: transform, left, right;
|
|
37
37
|
background-color: var(--mantine-color-body);
|
|
38
|
+
}
|
|
39
|
+
:where([data-layout=alt]) .footer {
|
|
40
|
+
inset-inline-start: var(--app-shell-navbar-offset, 0rem);
|
|
41
|
+
inset-inline-end: var(--app-shell-aside-offset, 0rem);
|
|
42
|
+
}
|
|
43
|
+
.footer {
|
|
38
44
|
bottom: 0;
|
|
39
45
|
height: calc(var(--app-shell-footer-height) + env(safe-area-inset-bottom));
|
|
40
46
|
padding-bottom: env(safe-area-inset-bottom);
|
|
41
47
|
transform: var(--app-shell-footer-transform);
|
|
42
48
|
z-index: var(--app-shell-footer-z-index);
|
|
43
49
|
}
|
|
44
|
-
:where([data-layout=alt]) .footer {
|
|
45
|
-
inset-inline-start: var(--app-shell-navbar-offset, 0rem);
|
|
46
|
-
inset-inline-end: var(--app-shell-aside-offset, 0rem);
|
|
47
|
-
}
|
|
48
50
|
.footer:where([data-with-border]) {
|
|
49
51
|
border-top: 1px solid var(--app-shell-border-color);
|
|
50
52
|
}</style>
|
|
@@ -35,16 +35,18 @@
|
|
|
35
35
|
inset-inline: 0;
|
|
36
36
|
transition-property: transform, left, right;
|
|
37
37
|
background-color: var(--mantine-color-body);
|
|
38
|
+
}
|
|
39
|
+
:where([data-layout=alt]) .header {
|
|
40
|
+
inset-inline-start: var(--app-shell-navbar-offset, 0rem);
|
|
41
|
+
inset-inline-end: var(--app-shell-aside-offset, 0rem);
|
|
42
|
+
}
|
|
43
|
+
.header {
|
|
38
44
|
top: 0;
|
|
39
45
|
height: var(--app-shell-header-height);
|
|
40
46
|
background-color: var(--mantine-color-body);
|
|
41
47
|
transform: var(--app-shell-header-transform);
|
|
42
48
|
z-index: var(--app-shell-header-z-index);
|
|
43
49
|
}
|
|
44
|
-
:where([data-layout=alt]) .header {
|
|
45
|
-
inset-inline-start: var(--app-shell-navbar-offset, 0rem);
|
|
46
|
-
inset-inline-end: var(--app-shell-aside-offset, 0rem);
|
|
47
|
-
}
|
|
48
50
|
.header:where([data-with-border]) {
|
|
49
51
|
border-bottom: 1px solid var(--app-shell-border-color);
|
|
50
52
|
}</style>
|
|
@@ -38,16 +38,18 @@
|
|
|
38
38
|
height: calc(100dvh - var(--app-shell-header-offset, 0rem) - var(--app-shell-footer-offset, 0rem));
|
|
39
39
|
background-color: var(--mantine-color-body);
|
|
40
40
|
transition-property: transform, top, height;
|
|
41
|
+
}
|
|
42
|
+
:where([data-layout=alt]) .navbar {
|
|
43
|
+
top: 0rem;
|
|
44
|
+
height: 100dvh;
|
|
45
|
+
}
|
|
46
|
+
.navbar {
|
|
41
47
|
inset-inline-start: 0;
|
|
42
48
|
width: var(--app-shell-navbar-width);
|
|
43
49
|
transition-property: transform, top, height;
|
|
44
50
|
transform: var(--app-shell-navbar-transform);
|
|
45
51
|
z-index: var(--app-shell-navbar-z-index);
|
|
46
52
|
}
|
|
47
|
-
:where([data-layout=alt]) .navbar {
|
|
48
|
-
top: 0rem;
|
|
49
|
-
height: 100dvh;
|
|
50
|
-
}
|
|
51
53
|
.navbar :global(:where([dir="rtl"])) {
|
|
52
54
|
transform: var(--app-shell-navbar-transform-rtl);
|
|
53
55
|
}
|
|
@@ -56,6 +56,8 @@
|
|
|
56
56
|
</script>
|
|
57
57
|
|
|
58
58
|
<script lang="ts">
|
|
59
|
+
import IconCheck from '../../icons/IconCheck.svelte';
|
|
60
|
+
import IconMinus from '../../icons/IconMinus.svelte';
|
|
59
61
|
import { parseThemeColor } from '../../MantineProvider/color-functions/parse-theme-color.svelte.js';
|
|
60
62
|
import { theme } from '../../MantineProvider/theme.svelte.js';
|
|
61
63
|
import { getRadius, getSize } from '../../utils/get-size.js';
|
|
@@ -135,9 +137,9 @@
|
|
|
135
137
|
{#if icon}
|
|
136
138
|
{@render icon(indeterminate, 'icon')}
|
|
137
139
|
{:else if indeterminate}
|
|
138
|
-
<
|
|
140
|
+
<IconMinus class="icon" />
|
|
139
141
|
{:else}
|
|
140
|
-
<
|
|
142
|
+
<IconCheck class="icon" />
|
|
141
143
|
{/if}
|
|
142
144
|
{/if}
|
|
143
145
|
</div>
|
|
@@ -40,6 +40,8 @@
|
|
|
40
40
|
</script>
|
|
41
41
|
|
|
42
42
|
<script lang="ts">
|
|
43
|
+
import IconCheck from '../../icons/IconCheck.svelte';
|
|
44
|
+
import IconMinus from '../../icons/IconMinus.svelte';
|
|
43
45
|
import { getAutoContrastValue } from '../../MantineProvider/color-functions/get-auto-contrast-value.svelte.js';
|
|
44
46
|
import { getContrastColor } from '../../MantineProvider/color-functions/get-contrast-color.svelte.js';
|
|
45
47
|
import { getThemeColor } from '../../MantineProvider/color-functions/get-theme-color.js';
|
|
@@ -96,9 +98,9 @@
|
|
|
96
98
|
>
|
|
97
99
|
{#if _checked}
|
|
98
100
|
{#if indeterminate}
|
|
99
|
-
<
|
|
101
|
+
<IconMinus class={['icon', `icon--${variant}`]} {...dataAttributes} />
|
|
100
102
|
{:else}
|
|
101
|
-
<
|
|
103
|
+
<IconCheck class={['icon', `icon--${variant}`]} {...dataAttributes} />
|
|
102
104
|
{/if}
|
|
103
105
|
{/if}
|
|
104
106
|
</div>
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
import { theme } from '../../MantineProvider/theme.svelte.js';
|
|
59
59
|
import { getFontSize, getRadius, getSize } from '../../utils/get-size.js';
|
|
60
60
|
import { getChipGroupContext } from './ChipGroup/ChipGroupContext.svelte.js';
|
|
61
|
+
import IconCheck from '../../icons/IconCheck.svelte';
|
|
61
62
|
|
|
62
63
|
const _id = $props.id();
|
|
63
64
|
|
|
@@ -120,7 +121,7 @@
|
|
|
120
121
|
{#if icon}
|
|
121
122
|
{@render icon()}
|
|
122
123
|
{:else}
|
|
123
|
-
<
|
|
124
|
+
<IconCheck class="check-icon" />
|
|
124
125
|
{/if}
|
|
125
126
|
</span>
|
|
126
127
|
{/if}
|
|
@@ -36,9 +36,6 @@
|
|
|
36
36
|
--combobox-chevron-size-lg: calc(1.5rem * var(--mantine-scale));
|
|
37
37
|
--combobox-chevron-size-xl: calc(1.75rem * var(--mantine-scale));
|
|
38
38
|
--combobox-chevron-size: var(--combobox-chevron-size-sm);
|
|
39
|
-
width: var(--combobox-chevron-size);
|
|
40
|
-
height: var(--combobox-chevron-size);
|
|
41
|
-
color: var(--_combobox-chevron-color);
|
|
42
39
|
}
|
|
43
40
|
:global(:where([data-mantine-color-scheme="light"])) :global(.chevron-5KwWrrOy) {
|
|
44
41
|
--_combobox-chevron-color: var(--combobox-chevron-color, var(--mantine-color-gray-6));
|
|
@@ -46,6 +43,11 @@
|
|
|
46
43
|
:global(:where([data-mantine-color-scheme="dark"])) :global(.chevron-5KwWrrOy) {
|
|
47
44
|
--_combobox-chevron-color: var(--combobox-chevron-color, var(--mantine-color-dark-3));
|
|
48
45
|
}
|
|
46
|
+
:global(.chevron-5KwWrrOy) {
|
|
47
|
+
width: var(--combobox-chevron-size);
|
|
48
|
+
height: var(--combobox-chevron-size);
|
|
49
|
+
color: var(--_combobox-chevron-color);
|
|
50
|
+
}
|
|
49
51
|
|
|
50
52
|
:global(.chevron-5KwWrrOy[data-error]) {
|
|
51
53
|
color: var(--combobox-chevron-color, var(--mantine-color-error));
|
|
@@ -2,8 +2,8 @@ import { type Getter, type NonNullableGetter } from '../../context/extract.js';
|
|
|
2
2
|
import type { ComboboxProps } from './Combobox.svelte';
|
|
3
3
|
export declare const COMBOBOX_CONTEXT_KEY: unique symbol;
|
|
4
4
|
export declare class ComboboxContext {
|
|
5
|
-
store: import("./ComboboxStore.svelte").ComboboxStore;
|
|
6
|
-
onoptionsubmit: ((value: string, optionProps: import("./ComboboxOption.svelte").ComboboxOptionProps) => void) | undefined;
|
|
5
|
+
store: import("./ComboboxStore.svelte.js").ComboboxStore;
|
|
6
|
+
onoptionsubmit: ((value: string, optionProps: import("./ComboboxOption.svelte.js").ComboboxOptionProps) => void) | undefined;
|
|
7
7
|
size: string;
|
|
8
8
|
resetSelectionOnOptionHover: NonNullable<boolean | undefined>;
|
|
9
9
|
readOnly: boolean | null | undefined;
|
|
@@ -23,13 +23,15 @@
|
|
|
23
23
|
border: 0 solid transparent;
|
|
24
24
|
margin-inline: calc(var(--combobox-padding) * -1);
|
|
25
25
|
padding: var(--combobox-option-padding);
|
|
26
|
-
border-top-width: calc(0.0625rem * var(--mantine-scale));
|
|
27
|
-
margin-top: var(--combobox-padding);
|
|
28
|
-
margin-bottom: calc(var(--combobox-padding) * -1);
|
|
29
26
|
}
|
|
30
27
|
:global(:where([data-mantine-color-scheme="light"])) .footer {
|
|
31
28
|
border-color: var(--mantine-color-gray-2);
|
|
32
29
|
}
|
|
33
30
|
:global(:where([data-mantine-color-scheme="dark"])) .footer {
|
|
34
31
|
border-color: var(--mantine-color-dark-4);
|
|
32
|
+
}
|
|
33
|
+
.footer {
|
|
34
|
+
border-top-width: calc(0.0625rem * var(--mantine-scale));
|
|
35
|
+
margin-top: var(--combobox-padding);
|
|
36
|
+
margin-bottom: calc(var(--combobox-padding) * -1);
|
|
35
37
|
}</style>
|
|
@@ -23,13 +23,15 @@
|
|
|
23
23
|
border: 0 solid transparent;
|
|
24
24
|
margin-inline: calc(var(--combobox-padding) * -1);
|
|
25
25
|
padding: var(--combobox-option-padding);
|
|
26
|
-
border-bottom-width: calc(0.0625rem * var(--mantine-scale));
|
|
27
|
-
margin-bottom: var(--combobox-padding);
|
|
28
|
-
margin-top: calc(var(--combobox-padding) * -1);
|
|
29
26
|
}
|
|
30
27
|
:global(:where([data-mantine-color-scheme="light"])) .header {
|
|
31
28
|
border-color: var(--mantine-color-gray-2);
|
|
32
29
|
}
|
|
33
30
|
:global(:where([data-mantine-color-scheme="dark"])) .header {
|
|
34
31
|
border-color: var(--mantine-color-dark-4);
|
|
32
|
+
}
|
|
33
|
+
.header {
|
|
34
|
+
border-bottom-width: calc(0.0625rem * var(--mantine-scale));
|
|
35
|
+
margin-bottom: var(--combobox-padding);
|
|
36
|
+
margin-top: calc(var(--combobox-padding) * -1);
|
|
35
37
|
}</style>
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
</script>
|
|
20
20
|
|
|
21
21
|
<script lang="ts">
|
|
22
|
+
import IconCheck from '../../../icons/IconCheck.svelte';
|
|
22
23
|
import { isOptionsGroup } from './is-options-group.js';
|
|
23
24
|
|
|
24
25
|
let { data, withCheckIcon, value, checkIconPosition, renderOption }: OptionProps = $props();
|
|
@@ -45,11 +46,11 @@
|
|
|
45
46
|
{@render renderOption({ option: data, checked })}
|
|
46
47
|
{:else}
|
|
47
48
|
{#if withCheckIcon && checked && checkIconPosition === 'left'}
|
|
48
|
-
<
|
|
49
|
+
<IconCheck class="icon-71XliHqC" data-reverse={reverse} data-checked={selected} stroke-width="4" />
|
|
49
50
|
{/if}
|
|
50
51
|
<span>{data.label}</span>
|
|
51
52
|
{#if withCheckIcon && checked && checkIconPosition === 'right'}
|
|
52
|
-
<
|
|
53
|
+
<IconCheck class="icon-71XliHqC" data-reverse={reverse} data-checked={selected} stroke-width="4" />
|
|
53
54
|
{/if}
|
|
54
55
|
{/if}
|
|
55
56
|
</Combobox.Option>
|
|
@@ -301,14 +301,14 @@
|
|
|
301
301
|
--input-bg: transparent;
|
|
302
302
|
--input-bd-focus: transparent;
|
|
303
303
|
}
|
|
304
|
+
:global([data-mantine-color-scheme]) .wrapper[data-error]:not([data-variant=unstyled]) {
|
|
305
|
+
--input-bd: var(--mantine-color-error);
|
|
306
|
+
}
|
|
304
307
|
:global([data-mantine-color-scheme]) .wrapper[data-error] {
|
|
305
308
|
--input-color: var(--mantine-color-error);
|
|
306
309
|
--input-placeholder-color: var(--mantine-color-error);
|
|
307
310
|
--input-section-color: var(--mantine-color-error);
|
|
308
311
|
}
|
|
309
|
-
:global([data-mantine-color-scheme]) .wrapper[data-error]:not([data-variant=unstyled]) {
|
|
310
|
-
--input-bd: var(--mantine-color-error);
|
|
311
|
-
}
|
|
312
312
|
.wrapper :global(:where([dir="rtl"])) {
|
|
313
313
|
--input-text-align: right;
|
|
314
314
|
--left-section-border-radius: 0 var(--input-radius) var(--input-radius) 0;
|
|
@@ -339,12 +339,13 @@
|
|
|
339
339
|
cursor: var(--input-cursor);
|
|
340
340
|
overflow: var(--input-overflow);
|
|
341
341
|
/* Used as data attribute in Textarea component, does not have associated prop on the Input component */
|
|
342
|
-
/* Used as data attribute in JsonInput component, does not have associated prop on the Input component */
|
|
343
|
-
/* Required to be a separate selector to work in Firefox, can be merged with &:disabled once :has is supported */
|
|
344
342
|
}
|
|
345
343
|
.input[data-no-overflow] {
|
|
346
344
|
--input-overflow: hidden;
|
|
347
345
|
}
|
|
346
|
+
.input {
|
|
347
|
+
/* Used as data attribute in JsonInput component, does not have associated prop on the Input component */
|
|
348
|
+
}
|
|
348
349
|
.input[data-monospace] {
|
|
349
350
|
--input-font-family: var(--mantine-font-family-monospace);
|
|
350
351
|
--input-fz: calc(var(--input-fz, var(--mantine-font-size-sm)) - calc(0.125rem * var(--mantine-scale)));
|
|
@@ -372,6 +373,9 @@
|
|
|
372
373
|
background-color: var(--input-disabled-bg);
|
|
373
374
|
color: var(--input-disabled-color);
|
|
374
375
|
}
|
|
376
|
+
.input {
|
|
377
|
+
/* Required to be a separate selector to work in Firefox, can be merged with &:disabled once :has is supported */
|
|
378
|
+
}
|
|
375
379
|
.input:has(input:disabled) {
|
|
376
380
|
cursor: not-allowed;
|
|
377
381
|
opacity: 0.6;
|
|
@@ -52,6 +52,8 @@
|
|
|
52
52
|
</script>
|
|
53
53
|
|
|
54
54
|
<script lang="ts">
|
|
55
|
+
import IconChevronDown from '../../icons/IconChevronDown.svelte';
|
|
56
|
+
|
|
55
57
|
let {
|
|
56
58
|
label,
|
|
57
59
|
description,
|
|
@@ -121,7 +123,7 @@
|
|
|
121
123
|
{#if rightSection}
|
|
122
124
|
{@render rightSection?.()}
|
|
123
125
|
{:else}
|
|
124
|
-
<
|
|
126
|
+
<IconChevronDown />
|
|
125
127
|
{/if}
|
|
126
128
|
{:else}
|
|
127
129
|
{@render rightSection?.()}
|
|
@@ -6,7 +6,7 @@ interface PillGroupContextProps {
|
|
|
6
6
|
}
|
|
7
7
|
export declare class PillGroupContext {
|
|
8
8
|
#private;
|
|
9
|
-
size: MaybeGetter<(string & {}) | import("
|
|
9
|
+
size: MaybeGetter<(string & {}) | import("../../index.js").MantineSize | undefined>;
|
|
10
10
|
disabled: MaybeGetter<boolean | undefined>;
|
|
11
11
|
constructor(props: PillGroupContextProps);
|
|
12
12
|
}
|
|
@@ -33,29 +33,29 @@ export declare function getPopoverContext(): PopoverContext;
|
|
|
33
33
|
export declare class PopoverContext {
|
|
34
34
|
readonly opened: NonNullable<boolean | undefined>;
|
|
35
35
|
readonly disabled: boolean | undefined;
|
|
36
|
-
readonly width: import("./Popover.types").PopoverWidth;
|
|
36
|
+
readonly width: import("./Popover.types.js").PopoverWidth;
|
|
37
37
|
readonly withArrow: NonNullable<boolean | undefined>;
|
|
38
38
|
readonly arrowOffset: number;
|
|
39
39
|
readonly arrowSize: number;
|
|
40
40
|
readonly arrowRadius: number;
|
|
41
|
-
readonly arrowPosition: NonNullable<import("
|
|
41
|
+
readonly arrowPosition: NonNullable<import("../index.js").ArrowPosition | undefined>;
|
|
42
42
|
readonly trapFocus: NonNullable<boolean | undefined>;
|
|
43
43
|
readonly withinPortal: NonNullable<boolean | undefined>;
|
|
44
|
-
readonly portalProps: import("../Portal/Portal.svelte").BasePortalProps | undefined;
|
|
45
|
-
readonly floatingStrategy: NonNullable<import("
|
|
44
|
+
readonly portalProps: import("../Portal/Portal.svelte.js").BasePortalProps | undefined;
|
|
45
|
+
readonly floatingStrategy: NonNullable<import("../index.js").FloatingStrategy | undefined>;
|
|
46
46
|
readonly zIndex: NonNullable<string | number | undefined>;
|
|
47
47
|
readonly closeOnEscape: NonNullable<boolean | undefined>;
|
|
48
48
|
readonly returnFocus: NonNullable<boolean | undefined>;
|
|
49
|
-
readonly position: NonNullable<import("
|
|
49
|
+
readonly position: NonNullable<import("../index.js").FloatingPosition | undefined>;
|
|
50
50
|
readonly onclose: (() => void) | undefined;
|
|
51
51
|
readonly ondismiss: (() => void) | undefined;
|
|
52
52
|
readonly onopen: (() => void) | undefined;
|
|
53
|
-
readonly onpositionchange: ((position: import("
|
|
53
|
+
readonly onpositionchange: ((position: import("../index.js").FloatingPosition) => void) | undefined;
|
|
54
54
|
readonly withRoles: NonNullable<boolean | undefined>;
|
|
55
55
|
readonly id: string;
|
|
56
56
|
readonly toggle: () => void;
|
|
57
|
-
readonly radius: NonNullable<import("
|
|
58
|
-
readonly shadow: import("
|
|
57
|
+
readonly radius: NonNullable<import("../../index.js").MantineRadius | undefined>;
|
|
58
|
+
readonly shadow: import("../../index.js").MantineShadow | undefined;
|
|
59
59
|
readonly transitionProps: {
|
|
60
60
|
duration?: number;
|
|
61
61
|
transition?: string;
|
|
@@ -243,6 +243,9 @@
|
|
|
243
243
|
:global(:where([data-mantine-color-scheme="dark"])) .label:where([data-active]) {
|
|
244
244
|
color: var(--sc-label-color, var(--mantine-color-white));
|
|
245
245
|
}
|
|
246
|
+
.root:where([data-initialized]) .label:where([data-active])::before {
|
|
247
|
+
display: none;
|
|
248
|
+
}
|
|
246
249
|
.label:where([data-active])::before {
|
|
247
250
|
content: "";
|
|
248
251
|
inset: 0;
|
|
@@ -250,9 +253,6 @@
|
|
|
250
253
|
position: absolute;
|
|
251
254
|
border-radius: var(--sc-radius, var(--mantine-radius-default));
|
|
252
255
|
}
|
|
253
|
-
.root:where([data-initialized]) .label:where([data-active])::before {
|
|
254
|
-
display: none;
|
|
255
|
-
}
|
|
256
256
|
:global(:where([data-mantine-color-scheme="light"])) .label:where([data-active])::before {
|
|
257
257
|
box-shadow: var(--sc-shadow, none);
|
|
258
258
|
background-color: var(--sc-color, var(--mantine-color-white));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { IconProps } from './types.js';
|
|
3
|
+
|
|
4
|
+
let { size = '100%', ...props }: IconProps = $props();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<svg
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
width={size}
|
|
10
|
+
height={size}
|
|
11
|
+
fill="none"
|
|
12
|
+
stroke="currentColor"
|
|
13
|
+
stroke-width="2"
|
|
14
|
+
stroke-linecap="round"
|
|
15
|
+
stroke-linejoin="round"
|
|
16
|
+
{...props}
|
|
17
|
+
>
|
|
18
|
+
<path d="M5 12l5 5L20 7" />
|
|
19
|
+
</svg>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { IconProps } from './types.js';
|
|
3
|
+
|
|
4
|
+
let { size = '100%', ...props }: IconProps = $props();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<svg
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
width={size}
|
|
10
|
+
height={size}
|
|
11
|
+
fill="none"
|
|
12
|
+
stroke="currentColor"
|
|
13
|
+
stroke-width="2"
|
|
14
|
+
stroke-linecap="round"
|
|
15
|
+
stroke-linejoin="round"
|
|
16
|
+
{...props}
|
|
17
|
+
>
|
|
18
|
+
<path d="M6 9l6 6 6-6" />
|
|
19
|
+
</svg>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { IconProps } from './types.js';
|
|
3
|
+
|
|
4
|
+
let { size = '100%', ...props }: IconProps = $props();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<svg
|
|
8
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
+
width={size}
|
|
10
|
+
height={size}
|
|
11
|
+
fill="none"
|
|
12
|
+
stroke="currentColor"
|
|
13
|
+
stroke-width="2"
|
|
14
|
+
stroke-linecap="round"
|
|
15
|
+
stroke-linejoin="round"
|
|
16
|
+
{...props}
|
|
17
|
+
>
|
|
18
|
+
<path d="M5 12h14" />
|
|
19
|
+
</svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/tools/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { unpluginIcons } from './unplugin.js';
|
package/dist/tools/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { unpluginIcons } from './unplugin.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const unpluginIcons: import("vite").Plugin<any> | import("vite").Plugin<any>[];
|
package/package.json
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reburn-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"analyze": "ANALYZE=true bun run build",
|
|
8
|
-
"dev": "
|
|
9
|
-
"build": "
|
|
8
|
+
"dev": "vite dev",
|
|
9
|
+
"build": "vite build",
|
|
10
10
|
"preview": "vite preview",
|
|
11
11
|
"prepare": "svelte-kit sync || echo ''",
|
|
12
|
-
"prepack": "
|
|
12
|
+
"prepack": "bun vite build && bun svelte-kit sync && PREPACK=true bun svelte-package && bun publint",
|
|
13
13
|
"transform-css-files": "bun run scripts/transform-css-files.ts",
|
|
14
|
-
"lint": "eslint ."
|
|
15
|
-
"build-icon-tool": "bun run scripts/build-icon-tool.ts"
|
|
14
|
+
"lint": "eslint ."
|
|
16
15
|
},
|
|
17
16
|
"files": [
|
|
18
17
|
"dist",
|
|
@@ -51,50 +50,45 @@
|
|
|
51
50
|
"svelte": "^5.29.0"
|
|
52
51
|
},
|
|
53
52
|
"dependencies": {
|
|
54
|
-
"@floating-ui/dom": "^1.7.
|
|
55
|
-
"@iconify/json": "^2.2.
|
|
56
|
-
"@iconify/tools": "^4.1.2",
|
|
57
|
-
"@iconify/types": "^2.0.0",
|
|
58
|
-
"@iconify/utils": "^3.0.1",
|
|
53
|
+
"@floating-ui/dom": "^1.7.4",
|
|
54
|
+
"@iconify/json": "^2.2.392",
|
|
59
55
|
"attr-accept": "^2.2.5",
|
|
60
|
-
"
|
|
61
|
-
"dayjs": "^1.11.13",
|
|
56
|
+
"dayjs": "^1.11.18",
|
|
62
57
|
"es-toolkit": "^1.39.10",
|
|
63
58
|
"nanoid": "^5",
|
|
64
|
-
"
|
|
65
|
-
"
|
|
59
|
+
"type-fest": "^5.0.1",
|
|
60
|
+
"unplugin-icons": "^22.4.2"
|
|
66
61
|
},
|
|
67
62
|
"devDependencies": {
|
|
68
|
-
"@eslint/compat": "^1.
|
|
69
|
-
"@eslint/js": "^9.
|
|
70
|
-
"@sveltejs/adapter-auto": "^6.1.
|
|
71
|
-
"@sveltejs/kit": "^2.
|
|
72
|
-
"@sveltejs/package": "2.4
|
|
73
|
-
"@sveltejs/vite-plugin-svelte": "^6.1
|
|
74
|
-
"@types/bun": "^1.2.
|
|
75
|
-
"@types/d3": "^7.4.3",
|
|
63
|
+
"@eslint/compat": "^1.4.0",
|
|
64
|
+
"@eslint/js": "^9.37.0",
|
|
65
|
+
"@sveltejs/adapter-auto": "^6.1.1",
|
|
66
|
+
"@sveltejs/kit": "^2.44.0",
|
|
67
|
+
"@sveltejs/package": "2.5.4",
|
|
68
|
+
"@sveltejs/vite-plugin-svelte": "^6.2.1",
|
|
69
|
+
"@types/bun": "^1.2.23",
|
|
76
70
|
"csstype": "^3.1.3",
|
|
77
|
-
"eslint": "^9.
|
|
78
|
-
"eslint-plugin-svelte": "^3.
|
|
79
|
-
"globals": "^16.
|
|
71
|
+
"eslint": "^9.37.0",
|
|
72
|
+
"eslint-plugin-svelte": "^3.12.4",
|
|
73
|
+
"globals": "^16.4.0",
|
|
80
74
|
"mitata": "^1.0.34",
|
|
81
75
|
"postcss": "^8.5.6",
|
|
82
76
|
"postcss-load-config": "^6.0.1",
|
|
83
77
|
"postcss-preset-mantine": "^1.18.0",
|
|
84
78
|
"postcss-simple-vars": "^7.0.1",
|
|
85
|
-
"publint": "^0.3.
|
|
86
|
-
"sass-embedded": "^1.
|
|
79
|
+
"publint": "^0.3.14",
|
|
80
|
+
"sass-embedded": "^1.93.2",
|
|
87
81
|
"sonda": "^0.9.0",
|
|
88
|
-
"svelte": "^5.
|
|
89
|
-
"svelte-check": "^4.3.
|
|
90
|
-
"typescript": "^5.9.
|
|
91
|
-
"typescript-eslint": "^8.
|
|
92
|
-
"vite": "^7.1.
|
|
82
|
+
"svelte": "^5.39.9",
|
|
83
|
+
"svelte-check": "^4.3.2",
|
|
84
|
+
"typescript": "^5.9.3",
|
|
85
|
+
"typescript-eslint": "^8.45.0",
|
|
86
|
+
"vite": "^7.1.9"
|
|
93
87
|
},
|
|
94
88
|
"keywords": [
|
|
95
89
|
"svelte"
|
|
96
90
|
],
|
|
97
91
|
"patchedDependencies": {
|
|
98
|
-
"@sveltejs/package@2.4
|
|
92
|
+
"@sveltejs/package@2.5.4": "patches/@sveltejs%2Fpackage@2.5.4.patch"
|
|
99
93
|
}
|
|
100
94
|
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
<script lang="ts" module>
|
|
2
|
-
import type { Snippet } from 'svelte';
|
|
3
|
-
import type { SVGAttributes } from 'svelte/elements';
|
|
4
|
-
|
|
5
|
-
export type IconContainerProps = SVGAttributes<SVGElement> & {
|
|
6
|
-
/** width and height of the icon */
|
|
7
|
-
size?: number | string;
|
|
8
|
-
|
|
9
|
-
/** children of the icon */
|
|
10
|
-
children: Snippet;
|
|
11
|
-
};
|
|
12
|
-
</script>
|
|
13
|
-
|
|
14
|
-
<script lang="ts">
|
|
15
|
-
let { size = '100%', children, ...props }: IconContainerProps = $props();
|
|
16
|
-
</script>
|
|
17
|
-
|
|
18
|
-
<svg
|
|
19
|
-
width={size}
|
|
20
|
-
height={size}
|
|
21
|
-
viewBox="0 0 24 24"
|
|
22
|
-
stroke-linecap="round"
|
|
23
|
-
stroke-linejoin="round"
|
|
24
|
-
fill="none"
|
|
25
|
-
stroke="currentColor"
|
|
26
|
-
stroke-width="2"
|
|
27
|
-
{...props}
|
|
28
|
-
>
|
|
29
|
-
{@render children()}
|
|
30
|
-
</svg>
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte';
|
|
2
|
-
import type { SVGAttributes } from 'svelte/elements';
|
|
3
|
-
export type IconContainerProps = SVGAttributes<SVGElement> & {
|
|
4
|
-
/** width and height of the icon */
|
|
5
|
-
size?: number | string;
|
|
6
|
-
/** children of the icon */
|
|
7
|
-
children: Snippet;
|
|
8
|
-
};
|
|
9
|
-
declare const IconContainer: import("svelte").Component<IconContainerProps, {}, "">;
|
|
10
|
-
type IconContainer = ReturnType<typeof IconContainer>;
|
|
11
|
-
export default IconContainer;
|
package/dist/icons/icon.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { IconContainerProps } from './IconContainer.svelte';
|
|
2
|
-
|
|
3
|
-
// https://svelte.dev/docs/svelte/typescript#enhancing-built-in-dom-types
|
|
4
|
-
declare module 'svelte/elements' {
|
|
5
|
-
export interface SvelteHTMLElements {
|
|
6
|
-
icon: Omit<IconContainerProps, 'children'> & {
|
|
7
|
-
name: string;
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export {}; // ensure this is not an ambient module, else types will be overridden instead of augmented
|
package/dist/icons/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as IconContainer } from './IconContainer.svelte';
|
package/dist/icons/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as IconContainer } from './IconContainer.svelte';
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { locate } from '@iconify/json';
|
|
2
|
-
import { getIconData } from '@iconify/utils';
|
|
3
|
-
import MagicString from 'magic-string';
|
|
4
|
-
import { readFile } from 'node:fs/promises';
|
|
5
|
-
import { parse } from 'svelte-parse-markup';
|
|
6
|
-
import { walk } from 'zimmerframe';
|
|
7
|
-
import { getAttrValue } from '../utils/getAttrValue.js';
|
|
8
|
-
import { isSvelteFile } from '../utils/isSvelteFile.js';
|
|
9
|
-
import { generateComponentName } from './utils/generateComponentName.js';
|
|
10
|
-
import { generateIconComponent } from './utils/generateIconComponent.js';
|
|
11
|
-
import { serializeIconAttributes } from './utils/serializeIconAttributes.js';
|
|
12
|
-
const NAME = 'vite-plugin-icon';
|
|
13
|
-
function isInstalledAsPackage() {
|
|
14
|
-
const local = process.env.LOCAL_REBURN_UI_INSTALLED;
|
|
15
|
-
return !local;
|
|
16
|
-
}
|
|
17
|
-
const asPackage = isInstalledAsPackage();
|
|
18
|
-
const INCLUDES_ICON_TAG = /<icon/g;
|
|
19
|
-
export function icon_plugin() {
|
|
20
|
-
// Icon name to component name cache
|
|
21
|
-
const iconCache = new Map();
|
|
22
|
-
return {
|
|
23
|
-
name: NAME,
|
|
24
|
-
markup: async ({ content, filename }) => {
|
|
25
|
-
if (!filename || !isSvelteFile(filename) || !INCLUDES_ICON_TAG.test(content))
|
|
26
|
-
return { code: content };
|
|
27
|
-
const s = new MagicString(content);
|
|
28
|
-
const ast = parse(content, { filename, modern: true });
|
|
29
|
-
/**
|
|
30
|
-
* Import path to import name
|
|
31
|
-
* e.g. TablerChevronUp => __IMPORTED_ICON_0__
|
|
32
|
-
*/
|
|
33
|
-
const imports = new Map();
|
|
34
|
-
async function update_element(node, nameAttribute) {
|
|
35
|
-
const iconName = nameAttribute.raw.trim();
|
|
36
|
-
if (!iconName.includes(':')) {
|
|
37
|
-
console.warn(`Icon "${iconName}" is not a valid icon name`);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
// Generate component name from icon name
|
|
41
|
-
const componentName = generateComponentName(iconName);
|
|
42
|
-
// Check if we already have this icon cached
|
|
43
|
-
let cached_component = iconCache.get(iconName);
|
|
44
|
-
if (!cached_component) {
|
|
45
|
-
try {
|
|
46
|
-
// Get icon data from Iconify
|
|
47
|
-
const [collection, icon] = iconName.split(':');
|
|
48
|
-
const filename = locate(collection);
|
|
49
|
-
const iconSet = JSON.parse(await readFile(filename, 'utf8'));
|
|
50
|
-
const iconData = getIconData(iconSet, icon);
|
|
51
|
-
if (!iconData) {
|
|
52
|
-
throw new Error(`Icon "${iconName}" not found`);
|
|
53
|
-
}
|
|
54
|
-
// Generate the component code
|
|
55
|
-
const import_statement = await generateIconComponent(iconName, iconData, asPackage);
|
|
56
|
-
imports.set(import_statement.importName, import_statement.path);
|
|
57
|
-
cached_component = componentName;
|
|
58
|
-
}
|
|
59
|
-
catch (error) {
|
|
60
|
-
console.error(`Failed to load icon "${iconName}":`, error);
|
|
61
|
-
// Fallback to a simple div with error message
|
|
62
|
-
s.update(node.start, node.end, `<div>Icon "${iconName}" not found</div>`);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
// Replace the icon tag with the component
|
|
67
|
-
const props = serializeIconAttributes(content, node.attributes);
|
|
68
|
-
s.update(node.start, node.end, `<${componentName} ${props} />`);
|
|
69
|
-
}
|
|
70
|
-
const pending_ast_updates = [];
|
|
71
|
-
walk(ast, null, {
|
|
72
|
-
RegularElement(node, { next }) {
|
|
73
|
-
if ('name' in node && node.name === 'icon') {
|
|
74
|
-
// Get the name attribute
|
|
75
|
-
const nameAttr = getAttrValue(node, 'name');
|
|
76
|
-
if (!nameAttr || typeof nameAttr === 'boolean')
|
|
77
|
-
return;
|
|
78
|
-
pending_ast_updates.push(update_element(node, nameAttr));
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
next();
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
for await (const update of pending_ast_updates) {
|
|
85
|
-
if (typeof update === 'function') {
|
|
86
|
-
// @ts-expect-error update is a function
|
|
87
|
-
await update();
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
// await Promise.all(pending_ast_updates);
|
|
91
|
-
// add imports
|
|
92
|
-
let text = '';
|
|
93
|
-
if (imports.size) {
|
|
94
|
-
for (const [import_name, path] of imports.entries()) {
|
|
95
|
-
text += `\timport ${import_name} from "${path}";\n`;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
if (ast.instance) {
|
|
99
|
-
// @ts-expect-error instance.content.start is defined
|
|
100
|
-
s.appendLeft(ast.instance.content.start, text);
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
s.prepend(`<script>${text}</script>\n`);
|
|
104
|
-
}
|
|
105
|
-
return {
|
|
106
|
-
code: s.toString(),
|
|
107
|
-
};
|
|
108
|
-
},
|
|
109
|
-
};
|
|
110
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function generateComponentName(name: string): string;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { capitalize } from 'es-toolkit';
|
|
2
|
-
export function generateComponentName(name) {
|
|
3
|
-
// Convert icon name like "tabler:chevron-up" to "TablerChevronUp"
|
|
4
|
-
const parts = name.split(':');
|
|
5
|
-
if (parts.length !== 2) {
|
|
6
|
-
throw new Error(`Invalid icon name format: ${name}. Expected format: "collection:icon-name"`);
|
|
7
|
-
}
|
|
8
|
-
const [collection, icon] = parts;
|
|
9
|
-
const collectionCapitalized = capitalize(collection);
|
|
10
|
-
const iconCapitalized = icon.split('-').map(capitalize).join('');
|
|
11
|
-
return `${collectionCapitalized}${iconCapitalized}`;
|
|
12
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { runSVGO, SVG } from '@iconify/tools';
|
|
2
|
-
import { existsSync, mkdirSync } from 'node:fs';
|
|
3
|
-
import { writeFile } from 'node:fs/promises';
|
|
4
|
-
import path from 'node:path';
|
|
5
|
-
import { generateComponentName } from './generateComponentName.js';
|
|
6
|
-
const nodeModulesFolder = path.join(process.cwd(), 'node_modules');
|
|
7
|
-
const iconsFolder = '.generated-reburn-icons';
|
|
8
|
-
const svgBodyRegex = /<svg[^>]*>(.*?)<\/svg>/s;
|
|
9
|
-
function extractSVGBody(svgString) {
|
|
10
|
-
const match = svgString.match(svgBodyRegex);
|
|
11
|
-
return match ? match[1].trim() : '';
|
|
12
|
-
}
|
|
13
|
-
function minifySVGBody(svg_content) {
|
|
14
|
-
const formatted = `<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
|
15
|
-
${svg_content}
|
|
16
|
-
</svg>`;
|
|
17
|
-
const svg = new SVG(formatted);
|
|
18
|
-
runSVGO(svg, {});
|
|
19
|
-
const getBody = extractSVGBody(svg.toMinifiedString());
|
|
20
|
-
return getBody;
|
|
21
|
-
}
|
|
22
|
-
export async function generateIconComponent(name, data, asPackage) {
|
|
23
|
-
const component_name = generateComponentName(name);
|
|
24
|
-
const svg_content = minifySVGBody(data.body);
|
|
25
|
-
const iconContainerPath = asPackage ? 'reburn-ui' : '$lib/icons';
|
|
26
|
-
const component_code = `<script lang="ts">
|
|
27
|
-
import { IconContainer } from '${iconContainerPath}';
|
|
28
|
-
import type { IconContainerProps } from '${iconContainerPath}';
|
|
29
|
-
|
|
30
|
-
let { size = '100%', ...props }: IconContainerProps = $props();
|
|
31
|
-
</script>
|
|
32
|
-
|
|
33
|
-
<IconContainer {size} {...props}>
|
|
34
|
-
{#snippet children()}
|
|
35
|
-
${svg_content}
|
|
36
|
-
{/snippet}
|
|
37
|
-
</IconContainer>`;
|
|
38
|
-
if (!existsSync(path.join(nodeModulesFolder, iconsFolder))) {
|
|
39
|
-
mkdirSync(path.join(nodeModulesFolder, iconsFolder), { recursive: true });
|
|
40
|
-
}
|
|
41
|
-
await writeFile(path.join(nodeModulesFolder, iconsFolder, `${component_name}.svelte`), component_code);
|
|
42
|
-
return {
|
|
43
|
-
importName: component_name,
|
|
44
|
-
path: `${nodeModulesFolder}/${iconsFolder}/${component_name}.svelte`,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
function isNameAttribute(attribute) {
|
|
2
|
-
return attribute.type === 'Attribute' && attribute.name === 'name';
|
|
3
|
-
}
|
|
4
|
-
export function serializeIconAttributes(content, attributes) {
|
|
5
|
-
const attribute_strings = attributes
|
|
6
|
-
.filter((attribute) => !isNameAttribute(attribute))
|
|
7
|
-
.map((attribute) => content.substring(attribute.start, attribute.end));
|
|
8
|
-
if (attribute_strings.length === 0)
|
|
9
|
-
return '';
|
|
10
|
-
return attribute_strings.join(' ');
|
|
11
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function generateClass(prefix: string): string;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export function getAttrValue(node, attr) {
|
|
2
|
-
if (!('type' in node) || !('attributes' in node))
|
|
3
|
-
return;
|
|
4
|
-
const attribute = node.attributes.find((v) => v.type === 'Attribute' && v.name === attr);
|
|
5
|
-
if (!attribute || !('value' in attribute) || typeof attribute.value === 'boolean')
|
|
6
|
-
return;
|
|
7
|
-
// Check if value is an array and has at least one element
|
|
8
|
-
if (Array.isArray(attribute.value)) {
|
|
9
|
-
if (attribute.value.length > 0)
|
|
10
|
-
return attribute.value[0];
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
// If it's not an array or is empty, return the value as is
|
|
14
|
-
return attribute.value;
|
|
15
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isSvelteFile(filename: string): boolean;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export function resolveConfig(config, name, plugin) {
|
|
2
|
-
const svelteConfigPlugin = config.plugins.find((p) => p.name === 'vite-plugin-svelte:config');
|
|
3
|
-
if (!svelteConfigPlugin) {
|
|
4
|
-
throw new Error(`${name} requires @sveltejs/vite-plugin-svelte 6 or higher to be installed`);
|
|
5
|
-
}
|
|
6
|
-
// @ts-expect-error plugin.transform is defined below before configResolved is called
|
|
7
|
-
plugin.transform.filter.id = svelteConfigPlugin.api.idFilter;
|
|
8
|
-
}
|