mirror of
https://github.com/lucide-icons/lucide.git
synced 2025-12-17 09:47:41 +01:00
Compare commits
3 Commits
package/an
...
version-se
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
985fa35a0b | ||
|
|
8c0e5cf302 | ||
|
|
4acd574de2 |
13
docs/.vitepress/api/release-info/index.get.ts
Normal file
13
docs/.vitepress/api/release-info/index.get.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import { eventHandler, setResponseHeader } from 'h3';
|
||||||
|
import releaseMeta from '../../data/releaseMetaData.json';
|
||||||
|
|
||||||
|
export default eventHandler((event) => {
|
||||||
|
setResponseHeader(event, 'Cache-Control', 'public, max-age=86400');
|
||||||
|
setResponseHeader(event, 'Access-Control-Allow-Origin', '*');
|
||||||
|
|
||||||
|
return Object.fromEntries(
|
||||||
|
Object.entries(releaseMeta).map(
|
||||||
|
([name, { createdRelease }]) => [name, createdRelease.version]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
});
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
export default eventHandler(() => {
|
|
||||||
return { nitro: 'Is Awesome! asda' };
|
|
||||||
});
|
|
||||||
@@ -1,60 +1,71 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export default {
|
export default {
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
}
|
};
|
||||||
|
|
||||||
export interface InputProps {
|
export interface InputProps {
|
||||||
type: string
|
type: string;
|
||||||
modelValue: string
|
modelValue: string;
|
||||||
shortcut?: string
|
shortcut?: string;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, nextTick, watch } from 'vue'
|
import { ref, onMounted, nextTick, watch } from 'vue';
|
||||||
|
|
||||||
const props = withDefaults(defineProps<InputProps>(), {
|
const props = withDefaults(defineProps<InputProps>(), {
|
||||||
type: 'text'
|
type: 'text',
|
||||||
})
|
});
|
||||||
|
|
||||||
const input = ref()
|
const input = ref();
|
||||||
const wrapperEl = ref()
|
const wrapperEl = ref();
|
||||||
const shortcutEl = ref()
|
const shortcutEl = ref();
|
||||||
|
|
||||||
defineEmits(['change', 'input', 'update:modelValue'])
|
defineEmits(['change', 'input', 'update:modelValue']);
|
||||||
|
|
||||||
const updateShortcutSpacing = () => {
|
const updateShortcutSpacing = () => {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
if (shortcutEl.value && wrapperEl.value) {
|
if (shortcutEl.value && wrapperEl.value) {
|
||||||
const shortcutWidth = shortcutEl.value.offsetWidth
|
const shortcutWidth = shortcutEl.value.offsetWidth;
|
||||||
wrapperEl.value.style.setProperty('--shortcut-width', `${shortcutWidth}px`)
|
wrapperEl.value.style.setProperty('--shortcut-width', `${shortcutWidth}px`);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
onMounted(updateShortcutSpacing)
|
onMounted(updateShortcutSpacing);
|
||||||
watch(() => props.shortcut, updateShortcutSpacing)
|
watch(() => props.shortcut, updateShortcutSpacing);
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
focus: () => {
|
focus: () => {
|
||||||
input.value.focus()
|
input.value.focus();
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="input-wrapper" ref="wrapperEl">
|
<div
|
||||||
<slot name="icon" class="icon" />
|
class="input-wrapper"
|
||||||
|
ref="wrapperEl"
|
||||||
|
>
|
||||||
|
<slot
|
||||||
|
name="icon"
|
||||||
|
class="icon"
|
||||||
|
/>
|
||||||
<input
|
<input
|
||||||
:type="type"
|
:type="type"
|
||||||
class="input"
|
class="input"
|
||||||
:class="{'has-icon': $slots.icon, 'has-shortcut': shortcut}"
|
:class="{ 'has-icon': $slots.icon, 'has-shortcut': shortcut }"
|
||||||
ref="input"
|
ref="input"
|
||||||
:value="modelValue"
|
:value="modelValue"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
@input="$emit('update:modelValue', $event.target.value)"
|
@input="$emit('update:modelValue', $event.target.value)"
|
||||||
/>
|
/>
|
||||||
<kbd v-if="shortcut" class="shortcut" ref="shortcutEl">{{ shortcut }}</kbd>
|
<kbd
|
||||||
|
v-if="shortcut"
|
||||||
|
class="shortcut"
|
||||||
|
ref="shortcutEl"
|
||||||
|
>{{ shortcut }}</kbd
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -71,13 +82,15 @@ defineExpose({
|
|||||||
height: 40px;
|
height: 40px;
|
||||||
background-color: var(--vp-c-bg-alt);
|
background-color: var(--vp-c-bg-alt);
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
transition: border-color 0.2s ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input.has-shortcut {
|
.input.has-shortcut {
|
||||||
padding-right: calc(var(--shortcut-width, 40px) + 22px);
|
padding-right: calc(var(--shortcut-width, 40px) + 22px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.input:hover, .input:focus {
|
.input:hover,
|
||||||
|
.input:focus {
|
||||||
border-color: var(--vp-c-brand);
|
border-color: var(--vp-c-brand);
|
||||||
background: var(--vp-c-bg-alt);
|
background: var(--vp-c-bg-alt);
|
||||||
}
|
}
|
||||||
@@ -111,7 +124,7 @@ defineExpose({
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.input-wrapper svg {
|
.input-wrapper > svg {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 16px;
|
left: 16px;
|
||||||
top: 12px;
|
top: 12px;
|
||||||
|
|||||||
@@ -1,38 +1,43 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export default {
|
export default {
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref } from 'vue'
|
import { computed, ref } from 'vue';
|
||||||
import Input from './Input.vue'
|
import Input from './Input.vue';
|
||||||
import createLucideIcon from 'lucide-vue-next/src/createLucideIcon'
|
import createLucideIcon from 'lucide-vue-next/src/createLucideIcon';
|
||||||
import { search } from '../../../data/iconNodes'
|
import { search, x } from '../../../data/iconNodes';
|
||||||
|
|
||||||
const SearchIcon = createLucideIcon('search', search)
|
const SearchIcon = createLucideIcon('search', search);
|
||||||
|
const XIcon = createLucideIcon('close', x);
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
modelValue: string
|
modelValue: string;
|
||||||
shortcut?: string
|
shortcut?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const props = defineProps<Props>()
|
const props = defineProps<Props>();
|
||||||
|
|
||||||
const input = ref()
|
const input = ref();
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue'])
|
const emit = defineEmits(['update:modelValue']);
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
focus: () => {
|
focus: () => {
|
||||||
input.value.focus()
|
input.value.focus();
|
||||||
}
|
},
|
||||||
})
|
});
|
||||||
|
|
||||||
const value = computed({
|
const value = computed({
|
||||||
get: () => props.modelValue,
|
get: () => props.modelValue,
|
||||||
set: (val) => emit('update:modelValue', val)
|
set: (val) => emit('update:modelValue', val),
|
||||||
})
|
});
|
||||||
|
|
||||||
|
const clear = () => {
|
||||||
|
value.value = '';
|
||||||
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -45,8 +50,25 @@ const value = computed({
|
|||||||
v-model="value"
|
v-model="value"
|
||||||
class="input-wrapper"
|
class="input-wrapper"
|
||||||
>
|
>
|
||||||
<template #icon>
|
<template #startIcon>
|
||||||
<component :is="SearchIcon" class="search-icon" />
|
<component
|
||||||
|
:is="SearchIcon"
|
||||||
|
class="search-icon"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #endIcon>
|
||||||
|
<button
|
||||||
|
class="clear-button"
|
||||||
|
type="button"
|
||||||
|
v-if="value"
|
||||||
|
>
|
||||||
|
<component
|
||||||
|
:is="XIcon"
|
||||||
|
class="x-icon"
|
||||||
|
@click="clear"
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
</template>
|
</template>
|
||||||
</Input>
|
</Input>
|
||||||
</template>
|
</template>
|
||||||
@@ -59,18 +81,43 @@ const value = computed({
|
|||||||
padding: 0 10px 0 12px;
|
padding: 0 10px 0 12px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
|
color: var(--vp-c-text-1);
|
||||||
background-color: var(--vp-c-bg-alt);
|
background-color: var(--vp-c-bg-alt);
|
||||||
|
transition: border-color 0.15s ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input:hover, .input:focus {
|
.input:hover,
|
||||||
|
.input:focus {
|
||||||
border-color: var(--vp-c-brand);
|
border-color: var(--vp-c-brand);
|
||||||
background: var(--vp-c-bg-alt);
|
background: var(--vp-c-bg-alt);
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-wrapper:deep(.input) {
|
.input-wrapper:deep(.input) {
|
||||||
/* padding: 12px 24px; */
|
|
||||||
padding-block: 12px;
|
padding-block: 12px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
height: 48px;
|
height: 48px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.clear-button {
|
||||||
|
position: absolute;
|
||||||
|
padding: 4px;
|
||||||
|
right: 8px;
|
||||||
|
top: 8px;
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
background: transparent;
|
||||||
|
border-radius: 6px;
|
||||||
|
transition: background 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.clear-button:hover {
|
||||||
|
background: var(--vp-button-alt-bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-wrapper:deep(.input)::-webkit-search-decoration,
|
||||||
|
.input-wrapper:deep(.input)::-webkit-search-cancel-button,
|
||||||
|
.input-wrapper:deep(.input)::-webkit-search-results-button,
|
||||||
|
.input-wrapper:deep(.input)::-webkit-search-results-decoration {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -52,7 +52,6 @@
|
|||||||
width: 20px;
|
width: 20px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
/* background-color: var(--vp-c-neutral); */
|
|
||||||
box-shadow: var(--vp-shadow-1);
|
box-shadow: var(--vp-shadow-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { useData } from 'vitepress';
|
import { useData } from 'vitepress';
|
||||||
import { useSessionStorage } from '@vueuse/core';
|
import { useSessionStorage } from '@vueuse/core';
|
||||||
import IconButton from '../base/IconButton.vue';
|
import IconButton from '../base/IconButton.vue';
|
||||||
import VPDocAsideCarbonAds from 'vitepress/dist/client/theme-default/components/VPDocAsideCarbonAds.vue'
|
// import VPDocAsideCarbonAds from 'vitepress/dist/client/theme-default/components/VPDocAsideCarbonAds.vue'
|
||||||
import { x } from '../../../data/iconNodes'
|
import { x } from '../../../data/iconNodes'
|
||||||
import createLucideIcon from 'lucide-vue-next/src/createLucideIcon';
|
import createLucideIcon from 'lucide-vue-next/src/createLucideIcon';
|
||||||
import { onMounted, ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
|
|||||||
21
docs/.vitepress/theme/components/icons/IconsOverview.data.ts
Normal file
21
docs/.vitepress/theme/components/icons/IconsOverview.data.ts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import { getAllData } from '../../../lib/icons';
|
||||||
|
import { getAllCategoryFiles, mapCategoryIconCount } from '../../../lib/categories';
|
||||||
|
import iconsMetaData from '../../../data/iconMetaData';
|
||||||
|
import { fetchAllReleases } from '../../../../scripts/writeReleaseMetadata.mts';
|
||||||
|
import { satisfies } from 'semver';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
async load() {
|
||||||
|
const versions = await fetchAllReleases();
|
||||||
|
|
||||||
|
const mappedVersions = versions
|
||||||
|
.map((tag) => tag.replace('v', ''))
|
||||||
|
.reverse()
|
||||||
|
|
||||||
|
mappedVersions.length = 100
|
||||||
|
|
||||||
|
return {
|
||||||
|
versions: mappedVersions,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, defineAsyncComponent, onMounted, watch } from 'vue';
|
import { ref, computed, defineAsyncComponent, onMounted, watch, watchEffect } from 'vue';
|
||||||
import type { IconEntity } from '../../types';
|
import type { IconEntity } from '../../types';
|
||||||
import { useElementSize, useEventListener, useVirtualList } from '@vueuse/core';
|
import { useElementSize, useEventListener, useVirtualList } from '@vueuse/core';
|
||||||
import { useRoute } from 'vitepress';
|
import { useRoute } from 'vitepress';
|
||||||
@@ -11,9 +11,13 @@ import useSearchShortcut from '../../utils/useSearchShortcut';
|
|||||||
import StickyBar from './StickyBar.vue';
|
import StickyBar from './StickyBar.vue';
|
||||||
import useFetchTags from '../../composables/useFetchTags';
|
import useFetchTags from '../../composables/useFetchTags';
|
||||||
import useFetchCategories from '../../composables/useFetchCategories';
|
import useFetchCategories from '../../composables/useFetchCategories';
|
||||||
|
import useFetchVersionIcons from '../../composables/useFetchVersionIcons';
|
||||||
import chunkArray from '../../utils/chunkArray';
|
import chunkArray from '../../utils/chunkArray';
|
||||||
import CarbonAdOverlay from './CarbonAdOverlay.vue';
|
import CarbonAdOverlay from './CarbonAdOverlay.vue';
|
||||||
|
import VersionSelect from './VersionSelect.vue';
|
||||||
|
import { sort, satisfies } from 'semver';
|
||||||
import useSearchPlaceholder from '../../utils/useSearchPlaceholder.ts';
|
import useSearchPlaceholder from '../../utils/useSearchPlaceholder.ts';
|
||||||
|
import { data as versionData } from './IconsOverview.data';
|
||||||
|
|
||||||
const ICON_SIZE = 56;
|
const ICON_SIZE = 56;
|
||||||
const ICON_GRID_GAP = 8;
|
const ICON_GRID_GAP = 8;
|
||||||
@@ -32,9 +36,15 @@ const props = defineProps<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const activeIconName = ref(null);
|
const activeIconName = ref(null);
|
||||||
|
const selectedVersion = ref();
|
||||||
|
|
||||||
const { execute: fetchTags, data: tags } = useFetchTags();
|
const { execute: fetchTags, data: tags } = useFetchTags();
|
||||||
const { execute: fetchCategories, data: categories } = useFetchCategories();
|
const { execute: fetchCategories, data: categories } = useFetchCategories();
|
||||||
|
const { execute: fetchVersionIcons, data: versionIcons } = useFetchVersionIcons(selectedVersion);
|
||||||
|
|
||||||
|
watch(selectedVersion, () => {
|
||||||
|
fetchVersionIcons();
|
||||||
|
});
|
||||||
|
|
||||||
const overviewEl = ref<HTMLElement | null>(null);
|
const overviewEl = ref<HTMLElement | null>(null);
|
||||||
const { width: containerWidth } = useElementSize(overviewEl);
|
const { width: containerWidth } = useElementSize(overviewEl);
|
||||||
@@ -44,20 +54,31 @@ const columnSize = computed(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const mappedIcons = computed(() => {
|
const mappedIcons = computed(() => {
|
||||||
if (tags.value == null) {
|
let icons = props.icons;
|
||||||
return props.icons;
|
|
||||||
|
if (tags.value != null && categories.value != null) {
|
||||||
|
icons = props.icons.map((icon) => {
|
||||||
|
const iconTags = tags.value[icon.name];
|
||||||
|
const iconCategories = categories.value?.[icon.name] ?? [];
|
||||||
|
|
||||||
|
return {
|
||||||
|
...icon,
|
||||||
|
tags: iconTags,
|
||||||
|
categories: iconCategories,
|
||||||
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return props.icons.map((icon) => {
|
if (selectedVersion.value == null || versionIcons.value == null) {
|
||||||
const iconTags = tags.value[icon.name];
|
console.log('no release info');
|
||||||
const iconCategories = categories.value?.[icon.name] ?? [];
|
|
||||||
|
|
||||||
return {
|
return icons;
|
||||||
...icon,
|
}
|
||||||
tags: iconTags,
|
|
||||||
categories: iconCategories,
|
return Object.values(versionIcons.value).filter(([name, iconNode]) => ({
|
||||||
};
|
name,
|
||||||
});
|
iconNode,
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
const { searchInput, searchQuery, searchQueryDebounced } = useSearchInput();
|
const { searchInput, searchQuery, searchQueryDebounced } = useSearchInput();
|
||||||
@@ -107,6 +128,12 @@ function onFocusSearchInput() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// function onFocusVersionSelect() {
|
||||||
|
// if (releaseInfo.value == null) {
|
||||||
|
// fetchReleaseInfo();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
const NoResults = defineAsyncComponent(() => import('./NoResults.vue'));
|
const NoResults = defineAsyncComponent(() => import('./NoResults.vue'));
|
||||||
|
|
||||||
const IconDetailOverlay = defineAsyncComponent(() => import('./IconDetailOverlay.vue'));
|
const IconDetailOverlay = defineAsyncComponent(() => import('./IconDetailOverlay.vue'));
|
||||||
@@ -129,13 +156,17 @@ function handleCloseDrawer() {
|
|||||||
>
|
>
|
||||||
<StickyBar>
|
<StickyBar>
|
||||||
<InputSearch
|
<InputSearch
|
||||||
:placeholder="`Search ${icons.length} icons ...`"
|
:placeholder="`Search ${mappedIcons.length} icons ...`"
|
||||||
v-model="searchQuery"
|
v-model="searchQuery"
|
||||||
ref="searchInput"
|
ref="searchInput"
|
||||||
:shortcut="kbdSearchShortcut"
|
:shortcut="kbdSearchShortcut"
|
||||||
class="input-wrapper"
|
class="input-wrapper"
|
||||||
@focus="onFocusSearchInput"
|
@focus="onFocusSearchInput"
|
||||||
/>
|
/>
|
||||||
|
<VersionSelect
|
||||||
|
v-model="selectedVersion"
|
||||||
|
:versions="versionData.versions"
|
||||||
|
/>
|
||||||
</StickyBar>
|
</StickyBar>
|
||||||
<NoResults
|
<NoResults
|
||||||
v-if="searchPlaceholder.isNoResults"
|
v-if="searchPlaceholder.isNoResults"
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
margin-top: -32px;
|
margin-top: -32px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
gap: 16px;
|
||||||
margin-bottom: 32px;
|
margin-bottom: 32px;
|
||||||
background: var(--vp-c-bg);
|
background: var(--vp-c-bg);
|
||||||
box-shadow: 0 16px 24px var(--vp-c-bg);
|
box-shadow: 0 16px 24px var(--vp-c-bg);
|
||||||
|
|||||||
221
docs/.vitepress/theme/components/icons/VersionSelect.vue
Normal file
221
docs/.vitepress/theme/components/icons/VersionSelect.vue
Normal file
@@ -0,0 +1,221 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, computed } from 'vue';
|
||||||
|
import {
|
||||||
|
Combobox,
|
||||||
|
ComboboxInput,
|
||||||
|
ComboboxButton,
|
||||||
|
ComboboxOptions,
|
||||||
|
ComboboxOption,
|
||||||
|
} from '@headlessui/vue';
|
||||||
|
|
||||||
|
import { chevronsUpDown, check } from '../../../data/iconNodes';
|
||||||
|
import createLucideIcon from 'lucide-vue-next/src/createLucideIcon';
|
||||||
|
|
||||||
|
const model = defineModel<string | undefined>();
|
||||||
|
const props = defineProps<{
|
||||||
|
versions: string[];
|
||||||
|
}>();
|
||||||
|
|
||||||
|
let query = ref('');
|
||||||
|
|
||||||
|
let filteredVersions = computed(() =>
|
||||||
|
query.value === ''
|
||||||
|
? [...props.versions]
|
||||||
|
: props.versions.filter((version) =>
|
||||||
|
version
|
||||||
|
.toLowerCase()
|
||||||
|
.replace(/\s+/g, '')
|
||||||
|
.includes(query.value.toLowerCase().replace(/\s+/g, '')),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
const emit = defineEmits(['focus']);
|
||||||
|
|
||||||
|
const ChevronUpDown = createLucideIcon('ChevronUpDown', chevronsUpDown);
|
||||||
|
const Check = createLucideIcon('Check', check);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Combobox v-model="model">
|
||||||
|
<div class="combobox-container">
|
||||||
|
<div class="combobox-input-container">
|
||||||
|
<ComboboxInput
|
||||||
|
class="combobox-input"
|
||||||
|
placeholder="Latest version"
|
||||||
|
@change="query = $event.target.value"
|
||||||
|
@focus="emit('focus')"
|
||||||
|
/>
|
||||||
|
<ComboboxButton class="combobox-button">
|
||||||
|
<ChevronUpDown
|
||||||
|
class="icon-chevron"
|
||||||
|
aria-hidden="true"
|
||||||
|
/>
|
||||||
|
</ComboboxButton>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ComboboxOptions class="combobox-options">
|
||||||
|
<div
|
||||||
|
v-if="versions.length === 0 && query !== ''"
|
||||||
|
class="combobox-no-results"
|
||||||
|
>
|
||||||
|
No match!
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ComboboxOption
|
||||||
|
v-for="version in filteredVersions"
|
||||||
|
as="template"
|
||||||
|
:key="version"
|
||||||
|
:value="version"
|
||||||
|
v-slot="{ selected, active }"
|
||||||
|
>
|
||||||
|
<li
|
||||||
|
class="combobox-option"
|
||||||
|
:class="{ active: active }"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="combobox-option-text"
|
||||||
|
:class="{ selected: selected }"
|
||||||
|
>
|
||||||
|
{{ version }}
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
v-if="selected"
|
||||||
|
class="combobox-option-icon"
|
||||||
|
:class="{ active: active }"
|
||||||
|
>
|
||||||
|
<Check
|
||||||
|
class="icon-check"
|
||||||
|
aria-hidden="true"
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
</ComboboxOption>
|
||||||
|
</ComboboxOptions>
|
||||||
|
</div>
|
||||||
|
</Combobox>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.combobox-input-container {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 48px;
|
||||||
|
min-width: 160px;
|
||||||
|
cursor: default;
|
||||||
|
overflow: hidden;
|
||||||
|
background-color: var(--vp-c-bg-alt);
|
||||||
|
text-align: left;
|
||||||
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.combobox-input {
|
||||||
|
width: 100%;
|
||||||
|
border: none;
|
||||||
|
padding: 12px;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
line-height: 1.25rem;
|
||||||
|
color: var(--vp-c-text-1);
|
||||||
|
border: 1px solid transparent;
|
||||||
|
transition: border-color 0.15s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.combobox-input:hover,
|
||||||
|
.combobox-input:focus {
|
||||||
|
border-color: var(--vp-c-brand);
|
||||||
|
background: var(--vp-c-bg-alt);
|
||||||
|
}
|
||||||
|
|
||||||
|
.combobox-button {
|
||||||
|
position: absolute;
|
||||||
|
top: 4px;
|
||||||
|
padding: 9px 8px;
|
||||||
|
right: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding-right: 0.5rem;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-chevron {
|
||||||
|
height: 20px;
|
||||||
|
width: 20px;
|
||||||
|
color: #9ca3af;
|
||||||
|
}
|
||||||
|
|
||||||
|
.combobox-options {
|
||||||
|
position: absolute;
|
||||||
|
margin-top: 0.25rem;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 160px;
|
||||||
|
padding: 12px;
|
||||||
|
min-width: 128px;
|
||||||
|
overflow-y: auto;
|
||||||
|
border-radius: 12px;
|
||||||
|
border: 1px solid var(--vp-c-divider);
|
||||||
|
background-color: var(--vp-c-bg-elv);
|
||||||
|
box-shadow: var(--vp-shadow-3);
|
||||||
|
transition: background-color 0.5s;
|
||||||
|
max-height: 240px;
|
||||||
|
outline: none;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.combobox-no-results {
|
||||||
|
position: relative;
|
||||||
|
cursor: default;
|
||||||
|
padding: 0.5rem 1rem;
|
||||||
|
color: #4b5563;
|
||||||
|
}
|
||||||
|
|
||||||
|
.combobox-option {
|
||||||
|
position: relative;
|
||||||
|
cursor: default;
|
||||||
|
padding: 2px 8px;
|
||||||
|
border-radius: 6px;
|
||||||
|
color: var(--vp-c-text-1);
|
||||||
|
line-height: 32px;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
white-space: nowrap;
|
||||||
|
transition:
|
||||||
|
background-color 0.25s,
|
||||||
|
color 0.25s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.combobox-option.active {
|
||||||
|
color: var(--vp-c-brand);
|
||||||
|
background-color: var(--vp-c-default-soft);
|
||||||
|
}
|
||||||
|
|
||||||
|
.combobox-option-text {
|
||||||
|
display: block;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.combobox-option-text.selected {
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.combobox-option-icon {
|
||||||
|
position: absolute;
|
||||||
|
right: 8px;
|
||||||
|
top: 8px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding-left: 0.75rem;
|
||||||
|
color: var(--vp-c-brand) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.combobox-option-icon.active {
|
||||||
|
color: var(--vp-c-brand) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-check {
|
||||||
|
height: 20px;
|
||||||
|
width: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
17
docs/.vitepress/theme/composables/useFetchVersionIcons.ts
Normal file
17
docs/.vitepress/theme/composables/useFetchVersionIcons.ts
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import { useFetch } from '@vueuse/core';
|
||||||
|
import { computed, Ref } from 'vue';
|
||||||
|
|
||||||
|
const useFetchVersionIcons = (version: Ref<string | undefined>) =>{
|
||||||
|
const fetchUrl = computed(() => {
|
||||||
|
if(version.value == null ) return ''
|
||||||
|
return `https://unpkg.com/lucide-static@${version.value}/icon-nodes.json`
|
||||||
|
})
|
||||||
|
return useFetch<Record<string, string>>(
|
||||||
|
fetchUrl,
|
||||||
|
{
|
||||||
|
refetch: true
|
||||||
|
}
|
||||||
|
).json();
|
||||||
|
}
|
||||||
|
|
||||||
|
export default useFetchVersionIcons;
|
||||||
@@ -9,14 +9,14 @@
|
|||||||
"docs:build": "pnpm run /^prebuild:.*/ && vitepress build",
|
"docs:build": "pnpm run /^prebuild:.*/ && vitepress build",
|
||||||
"docs:preview": "vitepress preview",
|
"docs:preview": "vitepress preview",
|
||||||
"build:docs": "vitepress build",
|
"build:docs": "vitepress build",
|
||||||
"prebuild:iconNodes": "node ./scripts/writeIconNodes.mjs",
|
"prebuild:iconNodes": "node ./scripts/writeIconNodes.mts",
|
||||||
"prebuild:metaJson": "node ./scripts/writeIconMetaIndex.mjs",
|
"prebuild:metaJson": "node ./scripts/writeIconMetaIndex.mts",
|
||||||
"prebuild:releaseJson": "node ./scripts/writeReleaseMetadata.mjs",
|
"prebuild:releaseJson": "node ./scripts/writeReleaseMetadata.mts",
|
||||||
"prebuild:categoriesJson": "node ./scripts/writeCategoriesMetadata.mjs",
|
"prebuild:categoriesJson": "node ./scripts/writeCategoriesMetadata.mts",
|
||||||
"prebuild:relatedIcons": "node ./scripts/writeIconRelatedIcons.mjs",
|
"prebuild:relatedIcons": "node ./scripts/writeIconRelatedIcons.mts",
|
||||||
"prebuild:iconDetails": "node ./scripts/writeIconDetails.mjs",
|
"prebuild:iconDetails": "node ./scripts/writeIconDetails.mts",
|
||||||
"prebuild:brandStopwords": "node ./scripts/writeBrandStopwords.mjs",
|
"prebuild:brandStopwords": "node ./scripts/writeBrandStopwords.mts",
|
||||||
"postbuild:vercelJson": "node ./scripts/writeVercelOutput.mjs",
|
"postbuild:vercelJson": "node ./scripts/writeVercelOutput.mts",
|
||||||
"dev": "npx nitropack dev",
|
"dev": "npx nitropack dev",
|
||||||
"prebuild:api": "npx nitropack prepare",
|
"prebuild:api": "npx nitropack prepare",
|
||||||
"build:api": "npx nitropack build",
|
"build:api": "npx nitropack build",
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ const getRelatedIcons = (currentIcon, icons) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const iconsMetaDataPromises = svgFiles.map(async (iconName) => {
|
const iconsMetaDataPromises = svgFiles.map(async (iconName) => {
|
||||||
const metaDataFileContent = await fs.promises.readFile(`../icons/${iconName}`);
|
const metaDataFileContent = await fs.promises.readFile(`../icons/${iconName}`, 'utf-8');
|
||||||
const metaData = JSON.parse(metaDataFileContent);
|
const metaData = JSON.parse(metaDataFileContent);
|
||||||
|
|
||||||
const name = iconName.replace('.json', '');
|
const name = iconName.replace('.json', '');
|
||||||
@@ -29,7 +29,7 @@ if (!fs.existsSync(releaseMetaDataDirectory)) {
|
|||||||
fs.mkdirSync(releaseMetaDataDirectory);
|
fs.mkdirSync(releaseMetaDataDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
const fetchAllReleases = async () => {
|
export const fetchAllReleases = async () => {
|
||||||
await git.fetch('https://github.com/lucide-icons/lucide.git', '--tags');
|
await git.fetch('https://github.com/lucide-icons/lucide.git', '--tags');
|
||||||
|
|
||||||
return Promise.all(
|
return Promise.all(
|
||||||
@@ -73,7 +73,7 @@ const comparisonsPromises = tags.map(async (tag, index) => {
|
|||||||
const comparisons = await Promise.all(comparisonsPromises);
|
const comparisons = await Promise.all(comparisonsPromises);
|
||||||
const newReleaseMetaData = {};
|
const newReleaseMetaData = {};
|
||||||
|
|
||||||
comparisons.forEach(({ tag, iconFiles, date } = {}) => {
|
comparisons.forEach(({ tag, iconFiles, date } = {} as typeof comparisons[number]) => {
|
||||||
if (tag == null) return;
|
if (tag == null) return;
|
||||||
|
|
||||||
iconFiles.forEach(({ status, file, renamedFile }) => {
|
iconFiles.forEach(({ status, file, renamedFile }) => {
|
||||||
@@ -11,7 +11,7 @@ const iconMetaData = await getIconMetaData(path.resolve(scriptDir, '../../icons'
|
|||||||
const iconAliasesRedirectRoutes = Object.entries(iconMetaData)
|
const iconAliasesRedirectRoutes = Object.entries(iconMetaData)
|
||||||
.filter(([, { aliases }]) => aliases?.length)
|
.filter(([, { aliases }]) => aliases?.length)
|
||||||
.map(([iconName, { aliases }]) => {
|
.map(([iconName, { aliases }]) => {
|
||||||
const aliasRouteMatches = aliases.map((alias) => alias.name).join('|');
|
const aliasRouteMatches = aliases.map((alias) => typeof alias === 'string' ? alias : alias.name).join('|');
|
||||||
|
|
||||||
return {
|
return {
|
||||||
src: `/icons/${aliasRouteMatches}`,
|
src: `/icons/${aliasRouteMatches}`,
|
||||||
9764
pnpm-lock.yaml
generated
9764
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user