chore: update deps

This commit is contained in:
Anthony Fu 2023-12-27 11:59:07 +01:00
parent 86f90f97ed
commit 1da8aabb18
13 changed files with 2629 additions and 2213 deletions

View File

@ -24,19 +24,17 @@ Icônes
![](./screenshots/6.png)
<p align="center">
<a href="https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg">
<img src='https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg'/>
</a>
</p>
### Features
- **Instant Fuzzy Searching** *- all are done locally, no web queries!*
- The **Bag** *- select your icons and pack them into a ready-to-use icon font!*
- *[svg-packer](https://github.com/antfu/svg-packer) was born from this XD*
- **Instant Fuzzy Searching** _- all are done locally, no web queries!_
- The **Bag** _- select your icons and pack them into a ready-to-use icon font!_
- _[svg-packer](https://github.com/antfu/svg-packer) was born from this XD_
- Copy the usage scripts
- SVGs direct download
- Mobile friendly

View File

@ -12,5 +12,6 @@ export default antfu(
'**/collections-meta.json',
'**/dist-electron',
],
formatters: true,
},
)

View File

@ -1,11 +1,16 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Icônes</title>
<link rel="icon" href="/favicon.svg">
<link rel="search" type="application/opensearchdescription+xml" href="/search.xml" title="Icônes">
<link rel="icon" href="/favicon.svg" />
<link
rel="search"
type="application/opensearchdescription+xml"
href="/search.xml"
title="Icônes"
/>
<script src="/lib/svg-packer.js" defer></script>
<script src="/lib/jszip.min.js" defer></script>
</head>

View File

@ -1,11 +1,11 @@
[build.environment]
NODE_VERSION = "20"
[build]
publish = "dist"
command = "pnpm run build"
publish = "dist"
command = "pnpm run build"
[build.environment]
NODE_VERSION = "20"
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
from = "/*"
to = "/index.html"
status = 200

View File

@ -3,7 +3,7 @@
"type": "module",
"version": "0.0.0",
"private": true,
"packageManager": "pnpm@8.10.2",
"packageManager": "pnpm@8.13.1",
"author": "Anthony Fu<https://github.com/antfu>",
"license": "MIT",
"homepage": "https://github.com/antfu/icones#readme",
@ -27,43 +27,44 @@
"build:electron": "NODE_ENV=production npm -C ./electron run build"
},
"dependencies": {
"@antfu/utils": "^0.7.6",
"@vueuse/core": "^10.6.0",
"@antfu/utils": "^0.7.7",
"@vueuse/core": "^10.7.0",
"dexie": "^3.2.4",
"file-saver": "^2.0.5",
"fzf": "^0.5.2",
"hotkeys-js": "^3.12.0",
"hotkeys-js": "^3.13.3",
"iconify-icon": "^1.0.8",
"prettier": "^3.0.3",
"vue": "^3.3.8",
"prettier": "^3.1.1",
"vue": "^3.3.13",
"vue-chemistry": "^0.2.2",
"vue-router": "^4.2.5"
},
"devDependencies": {
"@antfu/eslint-config": "^1.1.0",
"@iconify/json": "^2.2.161",
"@purge-icons/generated": "^0.9.0",
"@antfu/eslint-config": "^2.6.1",
"@iconify/json": "^2.2.162",
"@purge-icons/generated": "^0.10.0",
"@types/file-saver": "^2.0.7",
"@types/fs-extra": "^11.0.4",
"@vitejs/plugin-vue": "^4.4.1",
"@vitejs/plugin-vue": "^5.0.0",
"dayjs": "^1.11.10",
"eslint": "^8.53.0",
"esno": "^0.17.0",
"eslint": "^8.56.0",
"eslint-plugin-format": "^0.1.0",
"esno": "^4.0.0",
"fast-glob": "^3.3.2",
"fs-extra": "^11.1.1",
"fs-extra": "^11.2.0",
"jszip": "^3.10.1",
"lru-cache": "^10.0.1",
"lru-cache": "^10.1.0",
"pnpm": "8.10.2",
"svg-packer": "^0.0.3",
"typescript": "^5.2.2",
"unocss": "^0.57.3",
"unplugin-auto-import": "^0.16.7",
"unplugin-vue-components": "^0.25.2",
"vite": "^4.5.0",
"vite-plugin-pages": "^0.31.0",
"vite-plugin-purge-icons": "^0.9.2",
"vite-plugin-pwa": "^0.16.7",
"vue-tsc": "^1.8.22"
"typescript": "^5.3.3",
"unocss": "^0.58.0",
"unplugin-auto-import": "^0.17.2",
"unplugin-vue-components": "^0.26.0",
"vite": "^5.0.10",
"vite-plugin-pages": "^0.32.0",
"vite-plugin-purge-icons": "^0.10.0",
"vite-plugin-pwa": "^0.17.4",
"vue-tsc": "^1.8.27"
},
"pnpm": {
"neverBuiltDependencies": [

4665
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -5,13 +5,6 @@
// Generated by unplugin-auto-import
export {}
declare global {
const $: typeof import('vue/macros')['$']
const $$: typeof import('vue/macros')['$$']
const $computed: typeof import('vue/macros')['$computed']
const $customRef: typeof import('vue/macros')['$customRef']
const $ref: typeof import('vue/macros')['$ref']
const $shallowRef: typeof import('vue/macros')['$shallowRef']
const $toRef: typeof import('vue/macros')['$toRef']
const EffectScope: typeof import('vue')['EffectScope']
const asyncComputed: typeof import('@vueuse/core')['asyncComputed']
const autoResetRef: typeof import('@vueuse/core')['autoResetRef']
@ -295,4 +288,5 @@ declare global {
declare global {
// @ts-ignore
export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
import('vue')
}

View File

@ -6,10 +6,10 @@ import { isLocalMode } from '../env'
import { cacheCollection, specialTabs } from '../data'
import { getIconSnippet } from '../utils/icons'
const showBag = $ref(false)
let copied = $ref(false)
let current = $ref('')
let max = $ref(isLocalMode ? 500 : 200)
const showBag = ref(false)
const copied = ref(false)
const current = ref('')
const max = ref(isLocalMode ? 500 : 200)
const searchbar = ref<{ input: HTMLElement }>()
const route = useRoute()
@ -19,15 +19,15 @@ const { search, icons, category, collection, variant } = getSearchResults()
const loading = isCurrentCollectionLoading()
const maxMap = new Map<string, number>()
const id = $computed(() => collection.value?.id)
const url = $computed(() => collection.value?.url || collection.value?.author?.url)
const npm = $computed(() => (id != null && !specialTabs.includes(id)) ? `https://www.npmjs.com/package/@iconify-json/${id}` : '')
const namespace = $computed(() => (id != null && !specialTabs.includes(id)) ? `${id}:` : '')
const id = computed(() => collection.value?.id)
const url = computed(() => collection.value?.url || collection.value?.author?.url)
const npm = computed(() => (id.value != null && !specialTabs.includes(id.value)) ? `https://www.npmjs.com/package/@iconify-json/${id.value}` : '')
const namespace = computed(() => (id.value != null && !specialTabs.includes(id.value)) ? `${id.value}:` : '')
function onCopy(status: boolean) {
copied = status
copied.value = status
setTimeout(() => {
copied = false
copied.value = false
}, 2000)
}
@ -66,14 +66,14 @@ async function onSelect(icon: string) {
onCopy(await copyText(await getIconSnippet(icon, 'id', true) || icon))
break
default:
current = icon
current.value = icon
break
}
}
function loadMore() {
max += 100
maxMap.set(namespace, max)
max.value += 100
maxMap.set(namespace.value, max.value)
}
async function loadAll() {
@ -81,23 +81,25 @@ async function loadAll() {
return
await cacheCollection(collection.value!.id)
max = icons.value.length
maxMap.set(namespace, max)
max.value = icons.value.length
maxMap.set(namespace.value, max.value)
}
function next(delta = 1) {
const name = current.startsWith(namespace) ? current.slice(namespace.length) : current
const name = current.value.startsWith(namespace.value)
? current.value.slice(namespace.value.length)
: current.value
const index = icons.value.indexOf(name)
if (index === -1)
return
const newOne = icons.value[index + delta]
if (newOne)
current = namespace + newOne
current.value = namespace + newOne
}
watch(
() => namespace,
() => max = maxMap.get(namespace) || 200,
() => namespace.value,
() => max.value = maxMap.get(namespace.value) || 200,
)
onMounted(() => {
@ -127,8 +129,8 @@ onKeyStroke('/', (e) => {
})
onKeyStroke('Escape', () => {
if (current !== '') {
current = ''
if (current.value !== '') {
current.value = ''
focusSearch()
}
})

View File

@ -79,12 +79,13 @@ defineEmits<{
</template>
<style>
.icons-item:hover, .icons-item.active {
.icons-item:hover,
.icons-item.active {
color: var(--theme-color);
position: relative;
}
.icons-item.active::after {
content: "";
content: '';
position: absolute;
top: -3px;
left: -3px;
@ -95,7 +96,7 @@ defineEmits<{
opacity: 0.1;
}
.icons-item:hover::before {
content: "";
content: '';
position: absolute;
top: -4px;
left: -4px;

View File

@ -15,8 +15,8 @@ export type PresentType = 'favorite' | 'recent' | 'normal'
export interface CollectionInfo {
id: string
name: string
author?: { name: string; url: string }
license?: { title: string; url: string }
author?: { name: string, url: string }
license?: { title: string, url: string }
url?: string
sampleIcons?: string[]
category?: string

View File

@ -9,17 +9,15 @@ html.dark {
}
.btn {
@apply
border border-base rounded shadow-sm outline-none
px-4 py-1 text-gray-600 text-sm transition-all bg-base
hover:(bg-gray-50 shadow)
dark:(border-dark-200 text-gray-300)
dark:hover:(border-primary bg-dark-100 text-primary)
focus:(shadow outline-none);
--uno: border border-base rounded shadow-sm outline-none px-4 py-1
text-gray-600 text-sm transition-all bg-base hover-(bg-gray-50 shadow)
dark-(border-dark-200 text-gray-300)
dark-hover-(border-primary bg-dark-100 text-primary)
focus-(shadow outline-none);
}
.btn.small {
@apply px-2 py-1 text-sm;
--uno: px-2 py-1 text-sm;
}
.dragging {
@ -102,14 +100,14 @@ html.dark {
/* fallback black svg in dark mode */
.icons-item svg,
.dark .icons-item [fill="#000"],
.dark .icons-item [fill="#000000"],
.dark .icons-item [fill="black"] {
.dark .icons-item [fill='#000'],
.dark .icons-item [fill='#000000'],
.dark .icons-item [fill='black'] {
fill: currentColor;
}
.dark .icons-item [stroke="#000"],
.dark .icons-item [stroke="#000000"],
.dark .icons-item [stroke="black"] {
.dark .icons-item [stroke='#000'],
.dark .icons-item [stroke='#000000'],
.dark .icons-item [stroke='black'] {
stroke: currentColor;
}

View File

@ -19,7 +19,7 @@ export async function getSvgLocal(icon: string, size = '1em', color = 'currentCo
export async function getSvg(icon: string, size = '1em', color = 'currentColor') {
return await getSvgLocal(icon, size, color)
|| await fetch(`${API_ENTRY}/${icon}.svg?inline=false&height=${size}&color=${encodeURIComponent(color)}`).then(r => r.text()) || ''
|| await fetch(`${API_ENTRY}/${icon}.svg?inline=false&height=${size}&color=${encodeURIComponent(color)}`).then(r => r.text()) || ''
}
export async function getSvgSymbol(icon: string, size = '1em', color = 'currentColor') {

View File

@ -57,7 +57,6 @@ export default defineConfig(({ mode }) => {
AutoImport({
imports: [
'vue',
'vue/macros',
'vue-router',
'@vueuse/core',
],