reburn-ui 0.3.2 → 0.3.3
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/components/Accordion/Accordion.svelte +3 -2
- package/dist/core/components/Checkbox/Checkbox.svelte +5 -3
- package/dist/core/components/Checkbox/CheckboxIndicator.svelte +5 -3
- package/dist/core/components/Chip/Chip.svelte +3 -2
- package/dist/core/components/CloseButton/CloseButton.svelte +3 -2
- package/dist/core/components/Combobox/ComboboxChevron.svelte +3 -9
- package/dist/core/components/Combobox/OptionsDropdown/OptionsDropdownOption.svelte +4 -3
- package/dist/core/components/NavLink/NavLink.svelte +3 -2
- package/dist/tools/icon-vite-plugin/icon-vite-plugin.d.ts +2 -2
- package/dist/tools/icon-vite-plugin/icon-vite-plugin.js +81 -89
- package/package.json +8 -7
|
@@ -65,7 +65,8 @@
|
|
|
65
65
|
}
|
|
66
66
|
</script>
|
|
67
67
|
|
|
68
|
-
<script lang="ts" generics="T extends AccordionItem, Multiple extends boolean = false">
|
|
68
|
+
<script lang="ts" generics="T extends AccordionItem, Multiple extends boolean = false"> import TablerChevronDown from "/home/moritz/Documents/GitHub/mantine-reburn-ui/node_modules/.generated-reburn-icons/TablerChevronDown.svelte";
|
|
69
|
+
|
|
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
|
+
<TablerChevronDown />
|
|
135
136
|
{/if}
|
|
136
137
|
</span>
|
|
137
138
|
|
|
@@ -55,7 +55,9 @@
|
|
|
55
55
|
}
|
|
56
56
|
</script>
|
|
57
57
|
|
|
58
|
-
<script lang="ts">
|
|
58
|
+
<script lang="ts"> import TablerMinus from "/home/moritz/Documents/GitHub/mantine-reburn-ui/node_modules/.generated-reburn-icons/TablerMinus.svelte";
|
|
59
|
+
import TablerCheck from "/home/moritz/Documents/GitHub/mantine-reburn-ui/node_modules/.generated-reburn-icons/TablerCheck.svelte";
|
|
60
|
+
|
|
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
|
+
<TablerMinus class="icon" />
|
|
139
141
|
{:else}
|
|
140
|
-
<
|
|
142
|
+
<TablerCheck class="icon" />
|
|
141
143
|
{/if}
|
|
142
144
|
{/if}
|
|
143
145
|
</div>
|
|
@@ -39,7 +39,9 @@
|
|
|
39
39
|
}
|
|
40
40
|
</script>
|
|
41
41
|
|
|
42
|
-
<script lang="ts">
|
|
42
|
+
<script lang="ts"> import TablerMinus from "/home/moritz/Documents/GitHub/mantine-reburn-ui/node_modules/.generated-reburn-icons/TablerMinus.svelte";
|
|
43
|
+
import TablerCheck from "/home/moritz/Documents/GitHub/mantine-reburn-ui/node_modules/.generated-reburn-icons/TablerCheck.svelte";
|
|
44
|
+
|
|
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
|
+
<TablerMinus class={['icon', `icon--${variant}`]} {...dataAttributes} />
|
|
100
102
|
{:else}
|
|
101
|
-
<
|
|
103
|
+
<TablerCheck class={['icon', `icon--${variant}`]} {...dataAttributes} />
|
|
102
104
|
{/if}
|
|
103
105
|
{/if}
|
|
104
106
|
</div>
|
|
@@ -54,7 +54,8 @@
|
|
|
54
54
|
}
|
|
55
55
|
</script>
|
|
56
56
|
|
|
57
|
-
<script lang="ts">
|
|
57
|
+
<script lang="ts"> import TablerCheck from "/home/moritz/Documents/GitHub/mantine-reburn-ui/node_modules/.generated-reburn-icons/TablerCheck.svelte";
|
|
58
|
+
|
|
58
59
|
import { theme } from '../../MantineProvider/theme.svelte.js';
|
|
59
60
|
import { getFontSize, getRadius, getSize } from '../../utils/get-size.js';
|
|
60
61
|
import { getChipGroupContext } from './ChipGroup/ChipGroupContext.svelte.js';
|
|
@@ -120,7 +121,7 @@
|
|
|
120
121
|
{#if icon}
|
|
121
122
|
{@render icon()}
|
|
122
123
|
{:else}
|
|
123
|
-
<
|
|
124
|
+
<TablerCheck class="check-icon" />
|
|
124
125
|
{/if}
|
|
125
126
|
</span>
|
|
126
127
|
{/if}
|
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
export interface CloseButtonProps extends __CloseButtonProps, Omit<HTMLButtonAttributes, 'disabled'> {}
|
|
37
37
|
</script>
|
|
38
38
|
|
|
39
|
-
<script lang="ts">
|
|
39
|
+
<script lang="ts"> import TablerX from "/home/moritz/Documents/GitHub/mantine-reburn-ui/node_modules/.generated-reburn-icons/TablerX.svelte";
|
|
40
|
+
|
|
40
41
|
import { getRadius, getSize } from '../../utils/get-size.js';
|
|
41
42
|
import { rem } from '../../utils/units-converters/rem.js';
|
|
42
43
|
|
|
@@ -56,7 +57,7 @@
|
|
|
56
57
|
{#if icon}
|
|
57
58
|
{@render icon?.()}
|
|
58
59
|
{:else}
|
|
59
|
-
<
|
|
60
|
+
<TablerX class="icon" />
|
|
60
61
|
{/if}
|
|
61
62
|
</button>
|
|
62
63
|
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
|
-
<script lang="ts">
|
|
12
|
+
<script lang="ts"> import TablerSelector from "/home/moritz/Documents/GitHub/mantine-reburn-ui/node_modules/.generated-reburn-icons/TablerSelector.svelte";
|
|
13
|
+
|
|
13
14
|
import { getThemeColor } from '../../MantineProvider/color-functions/get-theme-color.js';
|
|
14
15
|
import { getSize } from '../../utils/get-size.js';
|
|
15
16
|
import { getComboboxContext } from './ComboboxContext.svelte.js';
|
|
@@ -19,14 +20,7 @@
|
|
|
19
20
|
let { size = ctx.size, error, color, ...props }: ComboboxChevronProps = $props();
|
|
20
21
|
</script>
|
|
21
22
|
|
|
22
|
-
<
|
|
23
|
-
{...props}
|
|
24
|
-
name="tabler:selector"
|
|
25
|
-
class={['chevron-5KwWrrOy', props.class]}
|
|
26
|
-
data-combobox-chevron
|
|
27
|
-
data-error={Boolean(error) || undefined}
|
|
28
|
-
style={`--combobox-chevron-size: ${getSize(size, 'combobox-chevron-size')}; ${props.style}; ${color ? `--combobox-chevron-color: ${getThemeColor(color)}` : ''}`}
|
|
29
|
-
></icon>
|
|
23
|
+
<TablerSelector {...props} class={['chevron-5KwWrrOy', props.class]} data-combobox-chevron data-error={Boolean(error) || undefined} style={`--combobox-chevron-size: ${getSize(size, 'combobox-chevron-size')}; ${props.style}; ${color ? `--combobox-chevron-color: ${getThemeColor(color)}` : ''}`} />
|
|
30
24
|
|
|
31
25
|
<!-- TODO: This works in production but not in dev -->
|
|
32
26
|
<style>:global(.chevron-5KwWrrOy) {
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
}
|
|
19
19
|
</script>
|
|
20
20
|
|
|
21
|
-
<script lang="ts">
|
|
21
|
+
<script lang="ts"> import TablerCheck from "/home/moritz/Documents/GitHub/mantine-reburn-ui/node_modules/.generated-reburn-icons/TablerCheck.svelte";
|
|
22
|
+
|
|
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
|
+
<TablerCheck 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
|
+
<TablerCheck class="icon-71XliHqC" data-reverse={reverse} data-checked={selected} stroke-width="4" />
|
|
53
54
|
{/if}
|
|
54
55
|
{/if}
|
|
55
56
|
</Combobox.Option>
|
|
@@ -51,7 +51,8 @@
|
|
|
51
51
|
}
|
|
52
52
|
</script>
|
|
53
53
|
|
|
54
|
-
<script lang="ts">
|
|
54
|
+
<script lang="ts"> import TablerChevronDown from "/home/moritz/Documents/GitHub/mantine-reburn-ui/node_modules/.generated-reburn-icons/TablerChevronDown.svelte";
|
|
55
|
+
|
|
55
56
|
let {
|
|
56
57
|
label,
|
|
57
58
|
description,
|
|
@@ -121,7 +122,7 @@
|
|
|
121
122
|
{#if rightSection}
|
|
122
123
|
{@render rightSection?.()}
|
|
123
124
|
{:else}
|
|
124
|
-
<
|
|
125
|
+
<TablerChevronDown />
|
|
125
126
|
{/if}
|
|
126
127
|
{:else}
|
|
127
128
|
{@render rightSection?.()}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function icon_plugin():
|
|
1
|
+
import type { PreprocessorGroup } from 'svelte/compiler';
|
|
2
|
+
export declare function icon_plugin(): PreprocessorGroup;
|
|
@@ -6,113 +6,105 @@ import { parse } from 'svelte-parse-markup';
|
|
|
6
6
|
import { walk } from 'zimmerframe';
|
|
7
7
|
import { getAttrValue } from '../utils/getAttrValue.js';
|
|
8
8
|
import { isSvelteFile } from '../utils/isSvelteFile.js';
|
|
9
|
-
import { resolveConfig } from '../utils/resolveConfig.js';
|
|
10
9
|
import { generateComponentName } from './utils/generateComponentName.js';
|
|
11
10
|
import { generateIconComponent } from './utils/generateIconComponent.js';
|
|
12
11
|
import { serializeIconAttributes } from './utils/serializeIconAttributes.js';
|
|
13
|
-
const NAME = 'vite-plugin-icon
|
|
12
|
+
const NAME = 'vite-plugin-icon';
|
|
14
13
|
function isInstalledAsPackage() {
|
|
15
14
|
const local = process.env.LOCAL_REBURN_UI_INSTALLED;
|
|
16
|
-
return !
|
|
15
|
+
return !local;
|
|
17
16
|
}
|
|
18
17
|
const asPackage = isInstalledAsPackage();
|
|
18
|
+
const INCLUDES_ICON_TAG = /<icon/g;
|
|
19
19
|
export function icon_plugin() {
|
|
20
20
|
// Icon name to component name cache
|
|
21
21
|
const iconCache = new Map();
|
|
22
|
-
|
|
22
|
+
return {
|
|
23
23
|
name: NAME,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const imports = new Map();
|
|
40
|
-
async function update_element(node, nameAttribute) {
|
|
41
|
-
const iconName = nameAttribute.raw.trim();
|
|
42
|
-
if (!iconName.includes(':')) {
|
|
43
|
-
console.warn(`Icon "${iconName}" is not a valid icon name`);
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
// Generate component name from icon name
|
|
47
|
-
const componentName = generateComponentName(iconName);
|
|
48
|
-
// Check if we already have this icon cached
|
|
49
|
-
let cached_component = iconCache.get(iconName);
|
|
50
|
-
if (!cached_component) {
|
|
51
|
-
try {
|
|
52
|
-
// Get icon data from Iconify
|
|
53
|
-
const [collection, icon] = iconName.split(':');
|
|
54
|
-
const filename = locate(collection);
|
|
55
|
-
const iconSet = JSON.parse(await readFile(filename, 'utf8'));
|
|
56
|
-
const iconData = getIconData(iconSet, icon);
|
|
57
|
-
if (!iconData) {
|
|
58
|
-
throw new Error(`Icon "${iconName}" not found`);
|
|
59
|
-
}
|
|
60
|
-
// Generate the component code
|
|
61
|
-
const import_statement = await generateIconComponent(iconName, iconData, asPackage);
|
|
62
|
-
imports.set(import_statement.importName, import_statement.path);
|
|
63
|
-
cached_component = componentName;
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
console.error(`Failed to load icon "${iconName}":`, error);
|
|
67
|
-
// Fallback to a simple div with error message
|
|
68
|
-
s.update(node.start, node.end, `<div>Icon "${iconName}" not found</div>`);
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
// Replace the icon tag with the component
|
|
73
|
-
let props = serializeIconAttributes(content, node.attributes);
|
|
74
|
-
s.update(node.start, node.end, `<${componentName} ${props} />`);
|
|
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;
|
|
75
39
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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`);
|
|
86
53
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
if (typeof update === 'function') {
|
|
92
|
-
await update();
|
|
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;
|
|
93
58
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
for (const [import_name, path] of imports.entries()) {
|
|
100
|
-
text += `\timport ${import_name} from "${path}";\n`;
|
|
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;
|
|
101
64
|
}
|
|
102
65
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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();
|
|
106
88
|
}
|
|
107
|
-
|
|
108
|
-
|
|
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`;
|
|
109
96
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
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
|
+
};
|
|
115
108
|
},
|
|
116
109
|
};
|
|
117
|
-
return plugin;
|
|
118
110
|
}
|
package/package.json
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reburn-ui",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"analyze": "ANALYZE=true bun run build",
|
|
8
8
|
"dev": "LOCAL_REBURN_UI_INSTALLED=true vite dev",
|
|
9
|
-
"build": "LOCAL_REBURN_UI_INSTALLED=true vite build",
|
|
9
|
+
"build": "bun run build-icon-tool && LOCAL_REBURN_UI_INSTALLED=true vite build",
|
|
10
10
|
"preview": "vite preview",
|
|
11
11
|
"prepare": "svelte-kit sync || echo ''",
|
|
12
12
|
"prepack": "LOCAL_REBURN_UI_INSTALLED=true bun vite build && bun svelte-kit sync && bun svelte-package && bun publint",
|
|
13
13
|
"transform-css-files": "bun run scripts/transform-css-files.ts",
|
|
14
|
-
"lint": "eslint ."
|
|
14
|
+
"lint": "eslint .",
|
|
15
|
+
"build-icon-tool": "bun run scripts/build-icon-tool.ts"
|
|
15
16
|
},
|
|
16
17
|
"files": [
|
|
17
18
|
"dist",
|
|
@@ -51,7 +52,7 @@
|
|
|
51
52
|
},
|
|
52
53
|
"dependencies": {
|
|
53
54
|
"@floating-ui/dom": "^1.7.3",
|
|
54
|
-
"@iconify/json": "^2.2.
|
|
55
|
+
"@iconify/json": "^2.2.366",
|
|
55
56
|
"@iconify/tools": "^4.1.2",
|
|
56
57
|
"@iconify/types": "^2.0.0",
|
|
57
58
|
"@iconify/utils": "^2.3.0",
|
|
@@ -84,10 +85,10 @@
|
|
|
84
85
|
"publint": "^0.3.12",
|
|
85
86
|
"sass-embedded": "^1.89.2",
|
|
86
87
|
"sonda": "^0.9.0",
|
|
87
|
-
"svelte": "^5.37.
|
|
88
|
-
"svelte-check": "^4.3.
|
|
88
|
+
"svelte": "^5.37.3",
|
|
89
|
+
"svelte-check": "^4.3.1",
|
|
89
90
|
"typescript": "^5.9.2",
|
|
90
|
-
"typescript-eslint": "^8.
|
|
91
|
+
"typescript-eslint": "^8.39.0",
|
|
91
92
|
"vite": "^7.0.6"
|
|
92
93
|
},
|
|
93
94
|
"keywords": [
|