@rimelight/ui 0.0.43 → 0.0.44
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/LICENSE +21 -0
- package/README.md +14 -12
- package/package.json +11 -14
- package/src/components/avatar/RLAAvatar.astro +4 -12
- package/src/components/badge/RLABadge.astro +2 -1
- package/src/components/badge/badge.theme.ts +0 -4
- package/src/components/banner/RLABanner.astro +1 -1
- package/src/components/banner/banner.theme.ts +1 -1
- package/src/components/breadcrumb/RLABreadcrumb.astro +2 -2
- package/src/components/button/RLAButton.astro +4 -1
- package/src/components/button/button.theme.ts +1 -5
- package/src/components/callout/RLACallout.astro +7 -5
- package/src/components/callout/callout.theme.ts +1 -5
- package/src/components/card/card.theme.ts +3 -3
- package/src/components/carousel/RLACarousel.astro +2 -2
- package/src/components/carousel/carousel.theme.ts +2 -2
- package/src/components/chart/RLAChart.astro +1 -1
- package/src/components/checkbox/RLACheckbox.astro +2 -1
- package/src/components/checkbox/checkbox.theme.ts +0 -4
- package/src/components/chip/RLAChip.astro +2 -1
- package/src/components/chip/chip.theme.ts +0 -4
- package/src/components/collapsible/RLACollapsible.astro +1 -1
- package/src/components/color-area/RLAColorArea.astro +1 -0
- package/src/components/color-area/color-area.theme.ts +1 -5
- package/src/components/color-field/RLAColorField.astro +1 -0
- package/src/components/color-field/color-field.theme.ts +1 -5
- package/src/components/color-slider/RLAColorSlider.astro +1 -0
- package/src/components/color-slider/color-slider.theme.ts +1 -5
- package/src/components/dashboard-group/RLADashboardGroup.astro +5 -7
- package/src/components/dashboard-group/dashboard-group.theme.ts +1 -1
- package/src/components/dashboard-group/dashboard-group.ts +1 -1
- package/src/components/dashboard-navbar/RLADashboardNavbar.astro +4 -4
- package/src/components/dashboard-navbar/dashboard-navbar.theme.ts +3 -3
- package/src/components/dashboard-navbar/dashboard-navbar.ts +1 -1
- package/src/components/dashboard-panel/RLADashboardPanel.astro +9 -8
- package/src/components/dashboard-panel/dashboard-panel.theme.ts +1 -1
- package/src/components/dashboard-sidebar/RLADashboardSidebar.astro +7 -4
- package/src/components/dashboard-sidebar/dashboard-sidebar.theme.ts +6 -5
- package/src/components/dashboard-sidebar-collapse/RLADashboardSidebarCollapse.astro +1 -0
- package/src/components/drawer/RLADrawer.astro +1 -1
- package/src/components/dropdown-menu/dropdown-menu.theme.ts +2 -2
- package/src/components/footer/RLAFooter.astro +2 -0
- package/src/components/footer/footer.theme.ts +0 -8
- package/src/components/gamepad/RLAGamepad.astro +1 -1
- package/src/components/head/UIHead.astro +1 -2
- package/src/components/header/header.theme.ts +1 -1
- package/src/components/icon/RLAIcon.astro +2 -5
- package/src/components/icon/RLSIcon.tsx +2 -2
- package/src/components/icon/RLVIcon.vue +18 -6
- package/src/components/icon/icon.theme.ts +1 -1
- package/src/components/image/image.theme.ts +1 -1
- package/src/components/input/RLAInput.astro +2 -1
- package/src/components/input/input.theme.ts +0 -4
- package/src/components/input-menu/RLAInputMenu.astro +2 -2
- package/src/components/input-menu/input-menu.theme.ts +1 -1
- package/src/components/input-rating/input-rating.theme.ts +2 -2
- package/src/components/kbd/RLAKbd.astro +2 -1
- package/src/components/kbd/kbd.theme.ts +0 -4
- package/src/components/keyboard/RLAKeyboard.astro +1 -1
- package/src/components/link/RLALink.astro +1 -0
- package/src/components/link/link.theme.ts +0 -4
- package/src/components/link-group/RLALinkGroup.astro +1 -1
- package/src/components/link-group/link-group.theme.ts +1 -10
- package/src/components/locale-selector/RLALocaleSelector.astro +4 -36
- package/src/components/locale-selector/locale-selector.theme.ts +3 -11
- package/src/components/logo/RLALogo.astro +1 -2
- package/src/components/modal/RLAModal.astro +1 -1
- package/src/components/modal/RLSModal.tsx +2 -2
- package/src/components/navigation-menu/RLANavigationMenu.astro +17 -21
- package/src/components/navigation-menu/navigation-menu.theme.ts +3 -7
- package/src/components/pagination/RLAPagination.astro +2 -2
- package/src/components/pagination/pagination.theme.ts +1 -1
- package/src/components/popover/RLAPopover.astro +39 -0
- package/src/components/progress/RLAProgress.astro +2 -0
- package/src/components/progress/progress.theme.ts +0 -4
- package/src/components/scroll-area/scroll-area.theme.ts +1 -1
- package/src/components/scroll-to-top/RLAScrollToTop.astro +6 -5
- package/src/components/scroll-to-top/RLVScrollToTop.vue +7 -7
- package/src/components/scroll-to-top/scroll-to-top.theme.ts +3 -7
- package/src/components/search/RLASearch.astro +3 -3
- package/src/components/select/RLASelect.astro +96 -528
- package/src/components/select/RLSSelect.tsx +68 -14
- package/src/components/select/RLVSelect.vue +57 -0
- package/src/components/select/select.theme.ts +11 -96
- package/src/components/shortcuts/RLAShortcuts.astro +9 -9
- package/src/components/sidebar/RLASidebar.astro +3 -3
- package/src/components/slideover/RLASlideover.astro +1 -1
- package/src/components/slider/RLASlider.astro +2 -1
- package/src/components/slider/slider.theme.ts +1 -5
- package/src/components/spinner/RLASpinner.astro +2 -1
- package/src/components/spinner/spinner.theme.ts +1 -5
- package/src/components/splitter/splitter.theme.ts +1 -1
- package/src/components/stepper/RLAStepper.astro +8 -8
- package/src/components/stepper/stepper.theme.ts +6 -7
- package/src/components/steps/RLASteps.astro +3 -3
- package/src/components/switch/RLASwitch.astro +2 -1
- package/src/components/switch/switch.theme.ts +0 -4
- package/src/components/table/table.theme.ts +1 -1
- package/src/components/table-of-contents/RLATableOfContents.astro +5 -5
- package/src/components/theme-selector/RLAThemeSelector.astro +16 -14
- package/src/components/theme-selector/theme-selector.theme.ts +2 -2
- package/src/components/toast/RLAToast.astro +6 -6
- package/src/components/toast/store.ts +1 -1
- package/src/components/tooltip/tooltip.theme.ts +1 -1
- package/src/icons.raw.ts +67 -0
- package/src/icons.ts +31 -64
- package/src/index.ts +19 -18
- package/src/preset.ts +110 -108
- package/src/resolver.ts +127 -15
- package/src/shortcuts.ts +103 -84
- package/src/stores.ts +22 -0
- package/src/types.ts +27 -9
- package/src/virtual.d.ts +4 -0
- package/src/components/editor/PageEditor.vue +0 -459
- package/src/components/editor/PageMention.vue +0 -87
- package/src/components/editor/PagePropertiesEditor.vue +0 -358
- package/src/components/editor/PagePropertiesRenderer.vue +0 -285
- package/src/components/editor/PageRenderer.vue +0 -155
- package/src/components/editor/PageSurround.vue +0 -130
- package/src/components/editor/PageVersionSelector.vue +0 -371
- package/src/components/editor/blocks/AddBlockModal.vue +0 -196
- package/src/components/editor/blocks/Block.vue +0 -142
- package/src/components/editor/blocks/BlockEditRenderer.vue +0 -26
- package/src/components/editor/blocks/BlockEditor.vue +0 -141
- package/src/components/editor/blocks/BlockViewRenderer.vue +0 -71
- package/src/components/editor/blocks/TextRenderer.vue +0 -31
- package/src/components/editor/blocks/editor/CalloutBlockEditor.vue +0 -53
- package/src/components/editor/blocks/editor/ImageBlockEditor.vue +0 -55
- package/src/components/editor/blocks/editor/ParagraphBlockEditor.vue +0 -31
- package/src/components/editor/blocks/editor/SectionBlockEditor.vue +0 -65
- package/src/components/editor/blocks/nodes/LinkNode.vue +0 -28
- package/src/components/editor/blocks/nodes/TextNode.vue +0 -22
- package/src/components/editor/blocks/renderer/CalloutBlockRenderer.vue +0 -65
- package/src/components/editor/blocks/renderer/ImageBlockRenderer.vue +0 -20
- package/src/components/editor/blocks/renderer/ParagraphBlockRenderer.vue +0 -21
- package/src/components/editor/blocks/renderer/SectionBlockRenderer.vue +0 -55
- package/src/components/editor/composables/injectionKeys.ts +0 -3
- package/src/components/editor/composables/useBlockEditor.ts +0 -261
- package/src/components/editor/composables/usePageEditor.ts +0 -97
- package/src/components/editor/modals/CreatePageModal.vue +0 -160
- package/src/components/editor/modals/DeletePageModal.vue +0 -116
- package/src/components/editor/modals/PageTreeModal.vue +0 -275
- package/src/components/editor/types/blocks.ts +0 -100
- package/src/components/editor/types/pages.ts +0 -89
- package/src/components/editor/types/schemas.ts +0 -36
- package/src/components/editor/utils/blocks.ts +0 -42
- package/src/components/editor/utils/editorHelpers.ts +0 -24
- package/src/components/editor/utils/page.ts +0 -219
- package/src/components/editor/utils/richTextHelpers.ts +0 -35
- package/src/components/editor/views/PageEditView.vue +0 -195
- package/src/components/editor/views/PageLiveView.vue +0 -90
- package/src/components/editor/views/PageReviewView.vue +0 -308
- package/src/components/icon/resolver.ts +0 -23
|
@@ -35,10 +35,10 @@ const headingSelector = Array.from({ length: maxLevel - minLevel + 1 }, (_, i) =
|
|
|
35
35
|
<details class:list={[className]} data-rla-toc-collapsible data-container-selector={containerSelector} data-heading-selector={headingSelector} {...rest}>
|
|
36
36
|
<summary class="flex items-center justify-between gap-3 px-4 h-10 text-sm font-medium text-highlighted cursor-pointer select-none hover:bg-muted/40 transition-colors list-none">
|
|
37
37
|
<span class="flex items-center gap-2">
|
|
38
|
-
<RLAIcon name="list" class="size-4 text-primary shrink-0" />
|
|
38
|
+
<RLAIcon name="i-rl-list" class="size-4 text-primary shrink-0" />
|
|
39
39
|
<span>On this page</span>
|
|
40
40
|
</span>
|
|
41
|
-
<RLAIcon name="chevronDown" class="rla-toc-chevron size-4 text-muted shrink-0 transition-transform duration-200" />
|
|
41
|
+
<RLAIcon name="i-rl-chevronDown" class="rla-toc-chevron size-4 text-muted shrink-0 transition-transform duration-200" />
|
|
42
42
|
</summary>
|
|
43
43
|
<div class="px-4 pt-3 max-h-[40vh] overflow-y-auto border-t border-default/50 bg-default">
|
|
44
44
|
<ul class="flex flex-col gap-0.5 pb-8">
|
|
@@ -63,12 +63,12 @@ const headingSelector = Array.from({ length: maxLevel - minLevel + 1 }, (_, i) =
|
|
|
63
63
|
<div class={classes.root} data-slot="root" data-container-selector={containerSelector} data-heading-selector={headingSelector} {...rest}>
|
|
64
64
|
<div class={classes.container} data-slot="container">
|
|
65
65
|
<h4 class={classes.title} data-slot="title">On this page</h4>
|
|
66
|
-
<ul class:list={[classes.list, "mt-2xl flex flex-col gap-
|
|
66
|
+
<ul class:list={[classes.list, "mt-2xl flex flex-col gap-xs"]} data-slot="list">
|
|
67
67
|
{filteredHeadings.map(heading => (
|
|
68
68
|
<li
|
|
69
69
|
class:list={[
|
|
70
70
|
classes.item,
|
|
71
|
-
heading.depth === 2 && "pl-
|
|
71
|
+
heading.depth === 2 && "pl-xs",
|
|
72
72
|
heading.depth === 3 && "pl-6",
|
|
73
73
|
heading.depth >= 4 && "pl-9"
|
|
74
74
|
]}
|
|
@@ -91,7 +91,7 @@ const headingSelector = Array.from({ length: maxLevel - minLevel + 1 }, (_, i) =
|
|
|
91
91
|
|
|
92
92
|
<style is:global>
|
|
93
93
|
.toc-active {
|
|
94
|
-
color: var(--primary);
|
|
94
|
+
color: var(--rl-primary-500);
|
|
95
95
|
font-weight: 600;
|
|
96
96
|
}
|
|
97
97
|
</style>
|
|
@@ -22,33 +22,35 @@ const classes = themeSelectorTheme(Astro.props);
|
|
|
22
22
|
square
|
|
23
23
|
aria-label="Toggle theme"
|
|
24
24
|
>
|
|
25
|
-
<RLAIcon name="sun" class={classes.sun} />
|
|
26
|
-
<RLAIcon name="moon" class={classes.moon} />
|
|
25
|
+
<RLAIcon name="i-rl-sun" class={classes.sun} />
|
|
26
|
+
<RLAIcon name="i-rl-moon" class={classes.moon} />
|
|
27
27
|
</RLAButton>
|
|
28
28
|
</rla-theme-selector>
|
|
29
29
|
|
|
30
|
+
<style is:global>
|
|
31
|
+
.rla-theme-sun { display: none; }
|
|
32
|
+
[data-theme="dark"] .rla-theme-sun { display: block; }
|
|
33
|
+
.rla-theme-moon { display: block; }
|
|
34
|
+
[data-theme="dark"] .rla-theme-moon { display: none; }
|
|
35
|
+
</style>
|
|
36
|
+
|
|
30
37
|
<script>
|
|
31
38
|
import { defineShortcuts } from "../../shortcuts"
|
|
32
39
|
|
|
33
40
|
function applyStoredTheme() {
|
|
34
41
|
const stored = localStorage.getItem('theme');
|
|
35
|
-
if (stored === 'dark') {
|
|
36
|
-
document.documentElement.
|
|
37
|
-
document.documentElement.classList.remove('light');
|
|
38
|
-
} else if (stored === 'light') {
|
|
39
|
-
document.documentElement.classList.remove('dark');
|
|
40
|
-
document.documentElement.classList.add('light');
|
|
42
|
+
if (stored === 'dark' || stored === 'light') {
|
|
43
|
+
document.documentElement.setAttribute('data-theme', stored);
|
|
41
44
|
}
|
|
42
45
|
}
|
|
43
46
|
|
|
44
47
|
applyStoredTheme();
|
|
45
48
|
|
|
46
49
|
function onToggle() {
|
|
47
|
-
const willBeDark =
|
|
48
|
-
document.documentElement.
|
|
49
|
-
document.documentElement.classList.toggle('light', !willBeDark);
|
|
50
|
+
const willBeDark = document.documentElement.getAttribute('data-theme') !== 'dark';
|
|
51
|
+
document.documentElement.setAttribute('data-theme', willBeDark ? 'dark' : 'light');
|
|
50
52
|
localStorage.setItem('theme', willBeDark ? 'dark' : 'light');
|
|
51
|
-
|
|
53
|
+
|
|
52
54
|
document.querySelectorAll('.theme-toggle-button').forEach(btn => {
|
|
53
55
|
btn.setAttribute('data-state', willBeDark ? 'on' : 'off');
|
|
54
56
|
btn.setAttribute('aria-pressed', willBeDark.toString());
|
|
@@ -63,7 +65,7 @@ const classes = themeSelectorTheme(Astro.props);
|
|
|
63
65
|
const button = this.querySelector('.theme-toggle-button');
|
|
64
66
|
if (!button) return;
|
|
65
67
|
|
|
66
|
-
const isDark = document.documentElement.
|
|
68
|
+
const isDark = document.documentElement.getAttribute('data-theme') === 'dark';
|
|
67
69
|
button.setAttribute('data-state', isDark ? 'on' : 'off');
|
|
68
70
|
button.setAttribute('aria-pressed', isDark.toString());
|
|
69
71
|
|
|
@@ -95,4 +97,4 @@ const classes = themeSelectorTheme(Astro.props);
|
|
|
95
97
|
if (!customElements.get('rla-theme-selector')) {
|
|
96
98
|
customElements.define('rla-theme-selector', RLAThemeSelector);
|
|
97
99
|
}
|
|
98
|
-
</script>
|
|
100
|
+
</script>
|
|
@@ -4,8 +4,8 @@ export const themeSelectorTheme = defineTheme("theme-selector", {
|
|
|
4
4
|
slots: ["root", "sun", "moon"],
|
|
5
5
|
base: {
|
|
6
6
|
root: "group rounded-full hover:bg-neutral-900/50 transition-colors inline-flex items-center justify-center text-neutral-400 hover:text-white cursor-pointer",
|
|
7
|
-
sun: "
|
|
8
|
-
moon: "
|
|
7
|
+
sun: "rla-theme-sun w-5 h-5 text-current",
|
|
8
|
+
moon: "rla-theme-moon w-5 h-5 text-current"
|
|
9
9
|
},
|
|
10
10
|
variants: {},
|
|
11
11
|
defaultVariants: {}
|
|
@@ -24,11 +24,11 @@ const classes = toastTheme({
|
|
|
24
24
|
})
|
|
25
25
|
|
|
26
26
|
const variantIcons: Record<string, string> = {
|
|
27
|
-
default: "bell",
|
|
28
|
-
error: "
|
|
29
|
-
success: "circleCheck",
|
|
30
|
-
warning: "alertTriangle",
|
|
31
|
-
info: "info",
|
|
27
|
+
default: "i-rl-bell",
|
|
28
|
+
error: "i-rl-circleCheck",
|
|
29
|
+
success: "i-rl-circleCheck",
|
|
30
|
+
warning: "i-rl-alertTriangle",
|
|
31
|
+
info: "i-rl-info",
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
const icon = variantIcons[variant] ?? variantIcons.default!
|
|
@@ -90,7 +90,7 @@ const isError = variant === "error"
|
|
|
90
90
|
data-toast-close
|
|
91
91
|
aria-label="Dismiss notification"
|
|
92
92
|
>
|
|
93
|
-
<RLAIcon name="close" class="size-3.5" aria-hidden="true" />
|
|
93
|
+
<RLAIcon name="i-rl-close" class="size-3.5" aria-hidden="true" />
|
|
94
94
|
</button>
|
|
95
95
|
)}
|
|
96
96
|
</div>
|
|
@@ -6,7 +6,7 @@ export const tooltipTheme = defineTheme("tooltip", {
|
|
|
6
6
|
root: "relative inline-block group/tooltip",
|
|
7
7
|
trigger: "",
|
|
8
8
|
content: [
|
|
9
|
-
"absolute z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-
|
|
9
|
+
"absolute z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-neutral-50 shadow-md animate-in fade-in-0 zoom-in-95",
|
|
10
10
|
"transition-all duration-150 invisible opacity-0 scale-95 origin-center pointer-events-none",
|
|
11
11
|
"group-hover/tooltip:visible group-hover/tooltip:opacity-100 group-hover/tooltip:scale-100"
|
|
12
12
|
]
|
package/src/icons.raw.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export const svg = (inner: string) =>
|
|
2
|
+
`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" width="100%" height="100%">${inner}</svg>`
|
|
3
|
+
|
|
4
|
+
export const getIconSvg = (name: string): string | undefined => {
|
|
5
|
+
if (!Object.prototype.hasOwnProperty.call(ICONS, name)) return undefined
|
|
6
|
+
return svg(ICONS[name as keyof typeof ICONS])
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const ICONS = {
|
|
10
|
+
alertTriangle: `<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"/><path d="M12 9v4M12 17h.01"/>`,
|
|
11
|
+
alignLeft: `<line x1="21" x2="3" y1="6" y2="6"/><line x1="15" x2="3" y1="12" y2="12"/><line x1="17" x2="3" y1="18" y2="18"/>`,
|
|
12
|
+
arrowLeft: `<path d="M19 12H5M12 19l-7-7 7-7"/>`,
|
|
13
|
+
arrowRight: `<path d="M5 12h14M12 5l7 7-7 7"/>`,
|
|
14
|
+
bell: `<path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9M10.3 21a1.94 1.94 0 0 0 3.4 0"/>`,
|
|
15
|
+
check: `<path d="M20 6 9 17l-5-5"/>`,
|
|
16
|
+
chevronDown: `<path d="m6 9 6 6 6-6"/>`,
|
|
17
|
+
chevronLeft: `<path d="m15 18-6-6 6-6"/>`,
|
|
18
|
+
chevronRight: `<path d="m9 18 6-6-6-6"/>`,
|
|
19
|
+
chevronsUpDown: `<path d="m7 15 5 5 5-5M7 9l5-5 5 5"/>`,
|
|
20
|
+
circleCheck: `<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>`,
|
|
21
|
+
circleX: `<circle cx="12" cy="12" r="10"/><path d="m15 9-6 6M9 9l6 6"/>`,
|
|
22
|
+
close: `<path d="M18 6 6 18M6 6l12 12"/>`,
|
|
23
|
+
copy: `<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>`,
|
|
24
|
+
download: `<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"/>`,
|
|
25
|
+
externalLink: `<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6M15 3h6v6M10 14 21 3"/>`,
|
|
26
|
+
fileQuestion: `<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4M9.1 11.8a3 3 0 0 1 5.8 1c0 .9-.6 1.4-1.1 1.8-.4.3-.8.7-.8 1.4M12 19h.01"/>`,
|
|
27
|
+
gripHorizontal: `<circle cx="12" cy="9" r="1"/><circle cx="19" cy="9" r="1"/><circle cx="5" cy="9" r="1"/><circle cx="12" cy="15" r="1"/><circle cx="19" cy="15" r="1"/><circle cx="5" cy="15" r="1"/>`,
|
|
28
|
+
gripVertical: `<circle cx="9" cy="12" r="1"/><circle cx="9" cy="5" r="1"/><circle cx="9" cy="19" r="1"/><circle cx="15" cy="12" r="1"/><circle cx="15" cy="5" r="1"/><circle cx="15" cy="19" r="1"/>`,
|
|
29
|
+
hardDrive: `<rect width="20" height="8" x="2" y="14" rx="2"/><path d="M6 18h.01M10 18h.01M2 14L5 3h14l3 11"/>`,
|
|
30
|
+
image: `<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/>`,
|
|
31
|
+
imageUpscale: `<path d="M16 3H3v13h13V3z"/><path d="M21 21v-4a2 2 0 0 0-2-2h-3M21 11V9M21 5a2 2 0 0 0-2-2h-1"/>`,
|
|
32
|
+
info: `<circle cx="12" cy="12" r="10"/><path d="M12 16v-4M12 8h.01"/>`,
|
|
33
|
+
layers: `<path d="m12 3-10 5L12 13l10-5-10-5Z"/><path d="M2 17l10 5 10-5M2 12l10 5 10-5"/>`,
|
|
34
|
+
list: `<line x1="8" x2="21" y1="6" y2="6"/><line x1="8" x2="21" y1="12" y2="12"/><line x1="8" x2="21" y1="18" y2="18"/><line x1="3" x2="3.01" y1="6" y2="6"/><line x1="3" x2="3.01" y1="12" y2="12"/><line x1="3" x2="3.01" y1="18" y2="18"/>`,
|
|
35
|
+
loaderCircle: `<path d="M21 12a9 9 0 1 1-6.219-8.56"/>`,
|
|
36
|
+
moon: `<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"/>`,
|
|
37
|
+
panelLeft: `<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><path d="M9 3v18"/>`,
|
|
38
|
+
play: `<polygon points="6 3 20 12 6 21 6 3"/>`,
|
|
39
|
+
quote: `<path d="M3 21c3 0 7-1 7-8V5c0-1.25-.75-2-2-2H4c-1.25 0-2 .75-2 2v6c0 1.25.75 2 2 2h3c0 4-3 6-3 6Zm11 0c3 0 7-1 7-8V5c0-1.25-.75-2-2-2h-4c-1.25 0-2 .75-2 2v6c0 1.25.75 2 2 2h3c0 4-3 6-3 6Z"/>`,
|
|
40
|
+
search: `<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>`,
|
|
41
|
+
share: `<circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/><path d="m8.59 13.51 6.83 3.98M15.41 6.51l-6.82 3.98"/>`,
|
|
42
|
+
sun: `<circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"/>`,
|
|
43
|
+
uploadCloud: `<path d="M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242M12 12v9M9 15l3-3 3 3"/>`,
|
|
44
|
+
user: `<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/>`,
|
|
45
|
+
star: `<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/>`,
|
|
46
|
+
lock: `<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>`,
|
|
47
|
+
eye: `<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0z"/><circle cx="12" cy="12" r="3"/>`,
|
|
48
|
+
eyeOff: `<path d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"/><path d="M14.084 14.158a3 3 0 0 1-4.242-4.242"/><path d="M17.479 17.499A10.75 10.75 0 0 1 2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.225-4.22"/><line x1="2" x2="22" y1="2" y2="22"/>`,
|
|
49
|
+
arrowUp: `<path d="M12 19V5M5 12l7-7 7 7"/>`,
|
|
50
|
+
arrowDown: `<path d="M12 5v14M19 12l-7 7-7-7"/>`,
|
|
51
|
+
edit: `<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>`,
|
|
52
|
+
link: `<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>`,
|
|
53
|
+
plus: `<path d="M5 12h14M12 5v14"/>`,
|
|
54
|
+
trash: `<path d="M3 6h18M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6M10 11v6M14 11v6"/><path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"/>`,
|
|
55
|
+
fileText: `<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M10 9H8M16 13H8M16 17H8"/>`,
|
|
56
|
+
settings: `<path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/>`,
|
|
57
|
+
type: `<polyline points="4 7 4 4 20 4 20 7"/><line x1="9" x2="15" y1="20" y2="20"/><line x1="12" x2="12" y1="4" y2="20"/>`,
|
|
58
|
+
code: `<polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/>`,
|
|
59
|
+
film: `<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M7 3v18M17 3v18M3 7h4M17 7h4M3 12h18M3 17h4M17 17h4"/>`,
|
|
60
|
+
messageSquare: `<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>`,
|
|
61
|
+
bookOpen: `<path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"/><path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"/>`,
|
|
62
|
+
panelRight: `<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><path d="M15 3v18"/>`,
|
|
63
|
+
pin: `<path d="M12 17v5"/><path d="M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z"/>`,
|
|
64
|
+
ellipsisVertical: `<circle cx="12" cy="12" r="1"/><circle cx="12" cy="5" r="1"/><circle cx="12" cy="19" r="1"/>`,
|
|
65
|
+
arrowUpFromLine: `<path d="m18 9-6-6-6 6"/><path d="M12 3v14"/><path d="M5 21h14"/>`,
|
|
66
|
+
arrowDownToLine: `<path d="M12 17V3"/><path d="m6 11 6 6 6-6"/><path d="M5 21h14"/>`
|
|
67
|
+
} as const
|
package/src/icons.ts
CHANGED
|
@@ -1,68 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import uiConfig from "virtual:rimelight/ui"
|
|
2
|
+
import { getIconSvg, ICONS, svg } from "./icons.raw"
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
alertTriangle: `<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"/><path d="M12 9v4M12 17h.01"/>`,
|
|
6
|
-
alignLeft: `<line x1="21" x2="3" y1="6" y2="6"/><line x1="15" x2="3" y1="12" y2="12"/><line x1="17" x2="3" y1="18" y2="18"/>`,
|
|
7
|
-
arrowLeft: `<path d="M19 12H5M12 19l-7-7 7-7"/>`,
|
|
8
|
-
arrowRight: `<path d="M5 12h14M12 5l7 7-7 7"/>`,
|
|
9
|
-
bell: `<path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9M10.3 21a1.94 1.94 0 0 0 3.4 0"/>`,
|
|
10
|
-
check: `<path d="M20 6 9 17l-5-5"/>`,
|
|
11
|
-
chevronDown: `<path d="m6 9 6 6 6-6"/>`,
|
|
12
|
-
chevronLeft: `<path d="m15 18-6-6 6-6"/>`,
|
|
13
|
-
chevronRight: `<path d="m9 18 6-6-6-6"/>`,
|
|
14
|
-
chevronsUpDown: `<path d="m7 15 5 5 5-5M7 9l5-5 5 5"/>`,
|
|
15
|
-
circleCheck: `<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>`,
|
|
16
|
-
circleX: `<circle cx="12" cy="12" r="10"/><path d="m15 9-6 6M9 9l6 6"/>`,
|
|
17
|
-
close: `<path d="M18 6 6 18M6 6l12 12"/>`,
|
|
18
|
-
copy: `<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>`,
|
|
19
|
-
download: `<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"/>`,
|
|
20
|
-
externalLink: `<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6M15 3h6v6M10 14 21 3"/>`,
|
|
21
|
-
fileQuestion: `<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4M9.1 11.8a3 3 0 0 1 5.8 1c0 .9-.6 1.4-1.1 1.8-.4.3-.8.7-.8 1.4M12 19h.01"/>`,
|
|
22
|
-
gripHorizontal: `<circle cx="12" cy="9" r="1"/><circle cx="19" cy="9" r="1"/><circle cx="5" cy="9" r="1"/><circle cx="12" cy="15" r="1"/><circle cx="19" cy="15" r="1"/><circle cx="5" cy="15" r="1"/>`,
|
|
23
|
-
gripVertical: `<circle cx="9" cy="12" r="1"/><circle cx="9" cy="5" r="1"/><circle cx="9" cy="19" r="1"/><circle cx="15" cy="12" r="1"/><circle cx="15" cy="5" r="1"/><circle cx="15" cy="19" r="1"/>`,
|
|
24
|
-
hardDrive: `<rect width="20" height="8" x="2" y="14" rx="2"/><path d="M6 18h.01M10 18h.01M2 14L5 3h14l3 11"/>`,
|
|
25
|
-
image: `<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/>`,
|
|
26
|
-
imageUpscale: `<path d="M16 3H3v13h13V3z"/><path d="M21 21v-4a2 2 0 0 0-2-2h-3M21 11V9M21 5a2 2 0 0 0-2-2h-1"/>`,
|
|
27
|
-
info: `<circle cx="12" cy="12" r="10"/><path d="M12 16v-4M12 8h.01"/>`,
|
|
28
|
-
layers: `<path d="m12 3-10 5L12 13l10-5-10-5Z"/><path d="M2 17l10 5 10-5M2 12l10 5 10-5"/>`,
|
|
29
|
-
list: `<line x1="8" x2="21" y1="6" y2="6"/><line x1="8" x2="21" y1="12" y2="12"/><line x1="8" x2="21" y1="18" y2="18"/><line x1="3" x2="3.01" y1="6" y2="6"/><line x1="3" x2="3.01" y1="12" y2="12"/><line x1="3" x2="3.01" y1="18" y2="18"/>`,
|
|
30
|
-
loaderCircle: `<path d="M21 12a9 9 0 1 1-6.219-8.56"/>`,
|
|
31
|
-
moon: `<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"/>`,
|
|
32
|
-
panelLeft: `<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><path d="M9 3v18"/>`,
|
|
33
|
-
play: `<polygon points="6 3 20 12 6 21 6 3"/>`,
|
|
34
|
-
quote: `<path d="M3 21c3 0 7-1 7-8V5c0-1.25-.75-2-2-2H4c-1.25 0-2 .75-2 2v6c0 1.25.75 2 2 2h3c0 4-3 6-3 6Zm11 0c3 0 7-1 7-8V5c0-1.25-.75-2-2-2h-4c-1.25 0-2 .75-2 2v6c0 1.25.75 2 2 2h3c0 4-3 6-3 6Z"/>`,
|
|
35
|
-
search: `<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/>`,
|
|
36
|
-
share: `<circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/><path d="m8.59 13.51 6.83 3.98M15.41 6.51l-6.82 3.98"/>`,
|
|
37
|
-
sun: `<circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41"/>`,
|
|
38
|
-
uploadCloud: `<path d="M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242M12 12v9M9 15l3-3 3 3"/>`,
|
|
39
|
-
user: `<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/>`,
|
|
40
|
-
star: `<polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/>`,
|
|
41
|
-
lock: `<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>`,
|
|
42
|
-
eye: `<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0z"/><circle cx="12" cy="12" r="3"/>`,
|
|
43
|
-
eyeOff: `<path d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"/><path d="M14.084 14.158a3 3 0 0 1-4.242-4.242"/><path d="M17.479 17.499A10.75 10.75 0 0 1 2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.225-4.22"/><line x1="2" x2="22" y1="2" y2="22"/>`,
|
|
44
|
-
arrowUp: `<path d="M12 19V5M5 12l7-7 7 7"/>`,
|
|
45
|
-
arrowDown: `<path d="M12 5v14M19 12l-7 7-7-7"/>`,
|
|
46
|
-
edit: `<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>`,
|
|
47
|
-
link: `<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>`,
|
|
48
|
-
plus: `<path d="M5 12h14M12 5v14"/>`,
|
|
49
|
-
trash: `<path d="M3 6h18M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6M10 11v6M14 11v6"/><path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"/>`,
|
|
50
|
-
fileText: `<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M10 9H8M16 13H8M16 17H8"/>`,
|
|
51
|
-
settings: `<path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/>`,
|
|
52
|
-
type: `<polyline points="4 7 4 4 20 4 20 7"/><line x1="9" x2="15" y1="20" y2="20"/><line x1="12" x2="12" y1="4" y2="20"/>`,
|
|
53
|
-
code: `<polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/>`,
|
|
54
|
-
film: `<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M7 3v18M17 3v18M3 7h4M17 7h4M3 12h18M3 17h4M17 17h4"/>`,
|
|
55
|
-
messageSquare: `<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>`,
|
|
56
|
-
bookOpen: `<path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"/><path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"/>`,
|
|
57
|
-
panelRight: `<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><path d="M15 3v18"/>`,
|
|
58
|
-
pin: `<path d="M12 17v5"/><path d="M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z"/>`,
|
|
59
|
-
ellipsisVertical: `<circle cx="12" cy="12" r="1"/><circle cx="12" cy="5" r="1"/><circle cx="12" cy="19" r="1"/>`,
|
|
60
|
-
arrowUpFromLine: `<path d="m18 9-6-6-6 6"/><path d="M12 3v14"/><path d="M5 21h14"/>`,
|
|
61
|
-
arrowDownToLine: `<path d="M12 17V3"/><path d="m6 11 6 6 6-6"/><path d="M5 21h14"/>`
|
|
62
|
-
} as const
|
|
4
|
+
export { ICONS, svg }
|
|
63
5
|
|
|
64
|
-
export const
|
|
65
|
-
|
|
66
|
-
|
|
6
|
+
export const getSvgIcon = (k: string): string => getIconSvg(k) ?? ""
|
|
7
|
+
|
|
8
|
+
export const DEFAULT_ICONS: Record<keyof typeof ICONS, string> = Object.fromEntries(
|
|
9
|
+
Object.keys(ICONS).map((k) => [k, getSvgIcon(k)])
|
|
10
|
+
) as Record<keyof typeof ICONS, string>
|
|
67
11
|
|
|
68
12
|
export type RimelightIcons = Partial<Record<keyof typeof ICONS | (string & {}), string>>
|
|
13
|
+
|
|
14
|
+
const EMPTY_ICON = { isClass: false, content: "" }
|
|
15
|
+
const cache = new Map<string, { isClass: boolean; content: string }>()
|
|
16
|
+
|
|
17
|
+
export const resolveIcon = (name = "", custom?: string) => {
|
|
18
|
+
if (!name) return EMPTY_ICON
|
|
19
|
+
const raw = custom || uiConfig?.icons?.[name] || name
|
|
20
|
+
let res = cache.get(raw)
|
|
21
|
+
if (!res) {
|
|
22
|
+
const content = getIconSvg(raw)
|
|
23
|
+
res =
|
|
24
|
+
content !== undefined
|
|
25
|
+
? { isClass: false, content }
|
|
26
|
+
: raw.startsWith("i-") || raw.includes(":")
|
|
27
|
+
? { isClass: true, content: raw }
|
|
28
|
+
: {
|
|
29
|
+
isClass: false,
|
|
30
|
+
content: raw.startsWith("<svg") ? raw : raw.startsWith("<") ? svg(raw) : ""
|
|
31
|
+
}
|
|
32
|
+
cache.set(raw, res)
|
|
33
|
+
}
|
|
34
|
+
return res
|
|
35
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import UnoCSS from "unocss/astro"
|
|
3
|
-
import type { UIConfig } from "./types"
|
|
1
|
+
import UnoCSS from "@unocss/vite"
|
|
4
2
|
import rimelightUiPreset from "./preset"
|
|
3
|
+
import type { UIConfig } from "./types"
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
const ID = "virtual:rimelight/ui"
|
|
6
|
+
|
|
7
|
+
export const ui = ({ unocss = {}, ...cfg }: UIConfig = {}) => [
|
|
7
8
|
UnoCSS({
|
|
8
|
-
...
|
|
9
|
-
presets: [rimelightUiPreset(
|
|
9
|
+
...unocss,
|
|
10
|
+
presets: [rimelightUiPreset(cfg), ...(unocss.presets || [])],
|
|
10
11
|
content: {
|
|
11
|
-
...
|
|
12
|
-
pipeline:
|
|
13
|
-
...
|
|
12
|
+
...unocss.content,
|
|
13
|
+
pipeline: unocss.content?.pipeline !== false && {
|
|
14
|
+
...unocss.content?.pipeline,
|
|
14
15
|
include: [
|
|
15
16
|
/\.(vue|svelte|[jt]sx?|mdx?|astro|html)($|\?)/,
|
|
16
|
-
/[\\/](@rimelight\/ui|packages\/ui)[\\/]/,
|
|
17
|
-
...[
|
|
17
|
+
/[\\/](@rimelight\/(ui|cms)|packages\/(ui|cms))[\\/]/,
|
|
18
|
+
...[unocss.content?.pipeline?.include]
|
|
19
|
+
.flat()
|
|
20
|
+
.filter((v): v is string | RegExp => Boolean(v))
|
|
18
21
|
]
|
|
19
22
|
}
|
|
20
23
|
}
|
|
21
24
|
}),
|
|
22
25
|
{
|
|
23
|
-
name: "
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
})
|
|
29
|
-
}
|
|
26
|
+
name: "rimelight/ui",
|
|
27
|
+
enforce: "pre",
|
|
28
|
+
resolveId: (id: string) => (id === ID ? `\0${ID}` : null),
|
|
29
|
+
load: (id: string) =>
|
|
30
|
+
id === `\0${ID}` ? `import "virtual:uno.css";\nexport default ${JSON.stringify(cfg)};` : null
|
|
30
31
|
}
|
|
31
32
|
]
|