mirror of https://github.com/msgbyte/tailchat
feat: #76 add offline icons plugin which will prefetch icons from iconify
useful in full internal environmentpull/100/head
parent
54c2676d23
commit
25a5c41bfc
@ -0,0 +1,11 @@
|
||||
{
|
||||
"label": "Offline Icons",
|
||||
"label.zh-CN": "离线图标",
|
||||
"name": "com.msgbyte.offline-icons",
|
||||
"url": "/plugins/com.msgbyte.offline-icons/index.js",
|
||||
"version": "0.0.0",
|
||||
"author": "moonrailgun",
|
||||
"description": "Add prefetched icons which need run in intranet environment",
|
||||
"description.zh-CN": "增加预获取的图标,适用于内网环境",
|
||||
"requireRestart": true
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "@plugins/com.msgbyte.offline-icons",
|
||||
"main": "src/index.tsx",
|
||||
"version": "0.0.0",
|
||||
"description": "Add prefetched icons which need run in offline environment",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"extract": "ts-node scripts/extract-icons.ts",
|
||||
"sync:declaration": "tailchat declaration github"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/parser": "^7.20.5",
|
||||
"@babel/traverse": "^7.20.5",
|
||||
"@babel/types": "^7.20.5",
|
||||
"@types/babel__traverse": "^7.18.3",
|
||||
"@types/styled-components": "^5.1.26",
|
||||
"globby": "11.1.0",
|
||||
"react": "18.2.0",
|
||||
"styled-components": "^5.3.6",
|
||||
"ts-node": "10.9.1",
|
||||
"typescript": "4.9.4"
|
||||
}
|
||||
}
|
@ -0,0 +1,160 @@
|
||||
import { parse } from '@babel/parser';
|
||||
import traverse from '@babel/traverse';
|
||||
import {
|
||||
isArrayExpression,
|
||||
isExpression,
|
||||
isIdentifier,
|
||||
isJSXAttribute,
|
||||
isJSXIdentifier,
|
||||
isObjectExpression,
|
||||
isObjectProperty,
|
||||
isStringLiteral,
|
||||
} from '@babel/types';
|
||||
import globby from 'globby';
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import _ from 'lodash';
|
||||
import axios from 'axios';
|
||||
|
||||
const PROJECT_ROOT = path.resolve(__dirname, '../../../../../');
|
||||
|
||||
(async () => {
|
||||
const start = Date.now();
|
||||
const paths = await globby(['**.tsx'], {
|
||||
cwd: PROJECT_ROOT,
|
||||
});
|
||||
|
||||
console.log(`extract icons from ${paths.length} files...`);
|
||||
|
||||
const res = await Promise.all(
|
||||
paths.map((p) => extractIcons(path.resolve(PROJECT_ROOT, p)))
|
||||
);
|
||||
|
||||
const icons = _.uniq(_.flatten(res));
|
||||
|
||||
console.log(`extract ${icons.length} icons, usage: ${Date.now() - start}ms`);
|
||||
|
||||
const group = _.mapValues(
|
||||
_.groupBy(icons, (icon) => icon.split(':')[0]),
|
||||
(value) => {
|
||||
return value.map((item) => item.split(':')[1]);
|
||||
}
|
||||
);
|
||||
|
||||
console.log(`fetching remote svg....`);
|
||||
|
||||
const svgs = await Promise.all(
|
||||
_.map(group, (icons, prefix) => {
|
||||
return fetchSvgs(prefix, icons);
|
||||
})
|
||||
);
|
||||
|
||||
const target = path.resolve(__dirname, '../src/icons.json');
|
||||
await fs.writeJSON(target, svgs, { spaces: 2 });
|
||||
|
||||
console.log('DONE! Assets has been write into:', target);
|
||||
})();
|
||||
|
||||
async function extractIcons(filepath: string): Promise<string[]> {
|
||||
const code = await fs.readFile(filepath, 'utf-8');
|
||||
|
||||
const ast = parse(code, {
|
||||
sourceType: 'module',
|
||||
plugins: ['jsx', 'typescript'],
|
||||
});
|
||||
|
||||
const icons = [];
|
||||
|
||||
traverse(ast, {
|
||||
JSXOpeningElement(path) {
|
||||
const name = path.node.name;
|
||||
if (isJSXIdentifier(name) && name.name === 'Icon') {
|
||||
path.node.attributes.forEach((attribute) => {
|
||||
if (isJSXAttribute(attribute) && attribute.name.name === 'icon') {
|
||||
if (isStringLiteral(attribute.value)) {
|
||||
icons.push(attribute.value.value);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
CallExpression(path) {
|
||||
if (!isIdentifier(path.node.callee)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
['regCustomPanel', 'regPluginPanelAction'].includes(
|
||||
path.node.callee.name
|
||||
)
|
||||
) {
|
||||
path.node.arguments.forEach((argument) => {
|
||||
if (isObjectExpression(argument)) {
|
||||
argument.properties.forEach((property) => {
|
||||
if (
|
||||
isObjectProperty(property) &&
|
||||
isIdentifier(property.key) &&
|
||||
property.key.name === 'icon' &&
|
||||
isStringLiteral(property.value) &&
|
||||
property.value.value // icon maybe empty string in some type
|
||||
) {
|
||||
icons.push(property.value.value);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (path.node.callee.name === 'regGroupPanel') {
|
||||
path.node.arguments.forEach((argument) => {
|
||||
if (isObjectExpression(argument)) {
|
||||
argument.properties.forEach((property) => {
|
||||
if (
|
||||
isObjectProperty(property) &&
|
||||
isIdentifier(property.key) &&
|
||||
property.key.name === 'menus' &&
|
||||
isArrayExpression(property.value)
|
||||
) {
|
||||
property.value.elements.forEach((element) => {
|
||||
if (isObjectExpression(element)) {
|
||||
element.properties.forEach((property) => {
|
||||
if (
|
||||
isObjectProperty(property) &&
|
||||
isIdentifier(property.key) &&
|
||||
property.key.name === 'icon' &&
|
||||
isStringLiteral(property.value) &&
|
||||
property.value.value // icon maybe empty string in some type
|
||||
) {
|
||||
icons.push(property.value.value);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
return icons;
|
||||
}
|
||||
|
||||
async function fetchSvgs(
|
||||
prefix: string,
|
||||
icons: string[]
|
||||
): Promise<{
|
||||
aliases: any;
|
||||
height: number;
|
||||
width: number;
|
||||
icons: Record<string, { body: string }>;
|
||||
lastModified: number;
|
||||
prefix: string;
|
||||
}> {
|
||||
const { data } = await axios.get(`/${prefix}.json?icons=${icons.join(',')}`, {
|
||||
baseURL: 'https://api.simplesvg.com/', // https://iconify.design/docs/api/#public-api
|
||||
});
|
||||
|
||||
return data;
|
||||
}
|
@ -0,0 +1,173 @@
|
||||
[
|
||||
{
|
||||
"prefix": "mdi",
|
||||
"lastModified": 1684129624,
|
||||
"aliases": {},
|
||||
"width": 24,
|
||||
"height": 24,
|
||||
"icons": {
|
||||
"account": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M12 4a4 4 0 0 1 4 4a4 4 0 0 1-4 4a4 4 0 0 1-4-4a4 4 0 0 1 4-4m0 10c4.42 0 8 1.79 8 4v2H4v-2c0-2.21 3.58-4 8-4Z\"/>"
|
||||
},
|
||||
"camera-outline": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M20 4h-3.17L15 2H9L7.17 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2m0 14H4V6h4.05l1.83-2h4.24l1.83 2H20v12M12 7a5 5 0 0 0-5 5a5 5 0 0 0 5 5a5 5 0 0 0 5-5a5 5 0 0 0-5-5m0 8a3 3 0 0 1-3-3a3 3 0 0 1 3-3a3 3 0 0 1 3 3a3 3 0 0 1-3 3Z\"/>"
|
||||
},
|
||||
"chevron-right": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M8.59 16.58L13.17 12L8.59 7.41L10 6l6 6l-6 6l-1.41-1.42Z\"/>"
|
||||
},
|
||||
"code-braces": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M8 3a2 2 0 0 0-2 2v4a2 2 0 0 1-2 2H3v2h1a2 2 0 0 1 2 2v4a2 2 0 0 0 2 2h2v-2H8v-5a2 2 0 0 0-2-2a2 2 0 0 0 2-2V5h2V3m6 0a2 2 0 0 1 2 2v4a2 2 0 0 0 2 2h1v2h-1a2 2 0 0 0-2 2v4a2 2 0 0 1-2 2h-2v-2h2v-5a2 2 0 0 1 2-2a2 2 0 0 1-2-2V5h-2V3h2Z\"/>"
|
||||
},
|
||||
"close": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12L19 6.41Z\"/>"
|
||||
},
|
||||
"chevron-down": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M7.41 8.58L12 13.17l4.59-4.59L18 10l-6 6l-6-6l1.41-1.42Z\"/>"
|
||||
},
|
||||
"loading": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M12 4V2A10 10 0 0 0 2 12h2a8 8 0 0 1 8-8Z\"/>"
|
||||
},
|
||||
"alert-circle-outline": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M11 15h2v2h-2v-2m0-8h2v6h-2V7m1-5C6.47 2 2 6.5 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2m0 18a8 8 0 0 1-8-8a8 8 0 0 1 8-8a8 8 0 0 1 8 8a8 8 0 0 1-8 8Z\"/>"
|
||||
},
|
||||
"content-cut": {
|
||||
"body": "<path fill=\"currentColor\" d=\"m19 3l-6 6l2 2l7-7V3m-10 9.5a.5.5 0 0 1-.5-.5a.5.5 0 0 1 .5-.5a.5.5 0 0 1 .5.5a.5.5 0 0 1-.5.5M6 20a2 2 0 0 1-2-2a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2M6 8a2 2 0 0 1-2-2a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2m3.64-.36c.23-.5.36-1.05.36-1.64a4 4 0 0 0-4-4a4 4 0 0 0-4 4a4 4 0 0 0 4 4c.59 0 1.14-.13 1.64-.36L10 12l-2.36 2.36C7.14 14.13 6.59 14 6 14a4 4 0 0 0-4 4a4 4 0 0 0 4 4a4 4 0 0 0 4-4c0-.59-.13-1.14-.36-1.64L12 14l7 7h3v-1L9.64 7.64Z\"/>"
|
||||
},
|
||||
"disc-player": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M14.5 10.37a1.87 1.87 0 1 0 0-3.74c-1.04 0-1.87.83-1.87 1.87a1.87 1.87 0 0 0 1.87 1.87m0-9.37A7.5 7.5 0 0 1 22 8.5c0 2.17-.92 4.13-2.4 5.5H9.4A7.51 7.51 0 0 1 7 8.5C7 4.35 10.36 1 14.5 1M6 21v1H4v-1H2v-6h20v6h-2v1h-2v-1H6m-2-3v1h9v-1H4m11-1v2h2v-2h-2m4 0a1 1 0 0 0-1 1a1 1 0 0 0 1 1a1 1 0 0 0 1-1a1 1 0 0 0-1-1Z\"/>"
|
||||
},
|
||||
"radio-tower": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M12 10a2 2 0 0 1 2 2a2 2 0 0 1-.47 1.29L16.7 22h-2.13L12 14.93L9.43 22H7.3l3.17-8.71A2 2 0 0 1 10 12a2 2 0 0 1 2-2m0-2a4 4 0 0 0-4 4c0 .5.1 1 .28 1.46l-.88 2.4A6.026 6.026 0 0 1 6 12a6 6 0 0 1 6-6a6 6 0 0 1 6 6c0 1.47-.53 2.81-1.4 3.86l-.88-2.4C15.9 13 16 12.5 16 12a4 4 0 0 0-4-4m0-4a8 8 0 0 0-8 8c0 2.36 1 4.5 2.64 5.94l-.72 2A10.005 10.005 0 0 1 2 12A10 10 0 0 1 12 2a10 10 0 0 1 10 10c0 3.23-1.54 6.11-3.92 7.94l-.72-2C19 16.5 20 14.36 20 12a8 8 0 0 0-8-8Z\"/>"
|
||||
},
|
||||
"web": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M16.36 14c.08-.66.14-1.32.14-2c0-.68-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2m-5.15 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95a8.03 8.03 0 0 1-4.33 3.56M14.34 14H9.66c-.1-.66-.16-1.32-.16-2c0-.68.06-1.35.16-2h4.68c.09.65.16 1.32.16 2c0 .68-.07 1.34-.16 2M12 19.96c-.83-1.2-1.5-2.53-1.91-3.96h3.82c-.41 1.43-1.08 2.76-1.91 3.96M8 8H5.08A7.923 7.923 0 0 1 9.4 4.44C8.8 5.55 8.35 6.75 8 8m-2.92 8H8c.35 1.25.8 2.45 1.4 3.56A8.008 8.008 0 0 1 5.08 16m-.82-2C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2c0 .68.06 1.34.14 2M12 4.03c.83 1.2 1.5 2.54 1.91 3.97h-3.82c.41-1.43 1.08-2.77 1.91-3.97M18.92 8h-2.95a15.65 15.65 0 0 0-1.38-3.56c1.84.63 3.37 1.9 4.33 3.56M12 2C6.47 2 2 6.5 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2Z\"/>"
|
||||
},
|
||||
"paperclip": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M16.5 6v11.5a4 4 0 0 1-4 4a4 4 0 0 1-4-4V5A2.5 2.5 0 0 1 11 2.5A2.5 2.5 0 0 1 13.5 5v10.5a1 1 0 0 1-1 1a1 1 0 0 1-1-1V6H10v9.5a2.5 2.5 0 0 0 2.5 2.5a2.5 2.5 0 0 0 2.5-2.5V5a4 4 0 0 0-4-4a4 4 0 0 0-4 4v12.5a5.5 5.5 0 0 0 5.5 5.5a5.5 5.5 0 0 0 5.5-5.5V6h-1.5Z\"/>"
|
||||
},
|
||||
"close-circle-outline": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M12 20c-4.41 0-8-3.59-8-8s3.59-8 8-8s8 3.59 8 8s-3.59 8-8 8m0-18C6.47 2 2 6.47 2 12s4.47 10 10 10s10-4.47 10-10S17.53 2 12 2m2.59 6L12 10.59L9.41 8L8 9.41L10.59 12L8 14.59L9.41 16L12 13.41L14.59 16L16 14.59L13.41 12L16 9.41L14.59 8Z\"/>"
|
||||
},
|
||||
"arrow-left": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M20 11v2H8l5.5 5.5l-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5L8 11h12Z\"/>"
|
||||
},
|
||||
"github": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M12 2A10 10 0 0 0 2 12c0 4.42 2.87 8.17 6.84 9.5c.5.08.66-.23.66-.5v-1.69c-2.77.6-3.36-1.34-3.36-1.34c-.46-1.16-1.11-1.47-1.11-1.47c-.91-.62.07-.6.07-.6c1 .07 1.53 1.03 1.53 1.03c.87 1.52 2.34 1.07 2.91.83c.09-.65.35-1.09.63-1.34c-2.22-.25-4.55-1.11-4.55-4.92c0-1.11.38-2 1.03-2.71c-.1-.25-.45-1.29.1-2.64c0 0 .84-.27 2.75 1.02c.79-.22 1.65-.33 2.5-.33c.85 0 1.71.11 2.5.33c1.91-1.29 2.75-1.02 2.75-1.02c.55 1.35.2 2.39.1 2.64c.65.71 1.03 1.6 1.03 2.71c0 3.82-2.34 4.66-4.57 4.91c.36.31.69.92.69 1.85V21c0 .27.16.59.67.5C19.14 20.16 22 16.42 22 12A10 10 0 0 0 12 2Z\"/>"
|
||||
},
|
||||
"arrow-right": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M4 11v2h12l-5.5 5.5l1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5L16 11H4Z\"/>"
|
||||
},
|
||||
"pound": {
|
||||
"body": "<path fill=\"currentColor\" d=\"m5.41 21l.71-4h-4l.35-2h4l1.06-6h-4l.35-2h4l.71-4h2l-.71 4h6l.71-4h2l-.71 4h4l-.35 2h-4l-1.06 6h4l-.35 2h-4l-.71 4h-2l.71-4h-6l-.71 4h-2M9.53 9l-1.06 6h6l1.06-6h-6Z\"/>"
|
||||
},
|
||||
"chevron-double-down": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M16.59 5.59L18 7l-6 6l-6-6l1.41-1.41L12 10.17l4.59-4.58m0 6L18 13l-6 6l-6-6l1.41-1.41L12 16.17l4.59-4.58Z\"/>"
|
||||
},
|
||||
"content-copy": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M19 21H8V7h11m0-2H8a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2m-3-4H4a2 2 0 0 0-2 2v14h2V3h12V1Z\"/>"
|
||||
},
|
||||
"reply": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M10 9V5l-7 7l7 7v-4.1c5 0 8.5 1.6 11 5.1c-1-5-4-10-11-11Z\"/>"
|
||||
},
|
||||
"restore": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M13 3a9 9 0 0 0-9 9H1l3.89 3.89l.07.14L9 12H6a7 7 0 0 1 7-7a7 7 0 0 1 7 7a7 7 0 0 1-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42A8.896 8.896 0 0 0 13 21a9 9 0 0 0 9-9a9 9 0 0 0-9-9Z\"/>"
|
||||
},
|
||||
"delete-outline": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M6 19a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7H6v12M8 9h8v10H8V9m7.5-5l-1-1h-5l-1 1H5v2h14V4h-3.5Z\"/>"
|
||||
},
|
||||
"file-question-outline": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M14 2H6a2 2 0 0 0-2 2v16c0 1.11.89 2 2 2h12c1.11 0 2-.89 2-2V8l-6-6m4 18H6V4h7v5h5v11m-3-7c0 1.89-2.25 2.07-2.25 3.76h-1.5c0-2.44 2.25-2.26 2.25-3.76c0-.82-.67-1.5-1.5-1.5s-1.5.68-1.5 1.5H9c0-1.65 1.34-3 3-3s3 1.35 3 3m-2.25 4.5V19h-1.5v-1.5h1.5Z\"/>"
|
||||
},
|
||||
"plus-circle-outline": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M12 20c-4.41 0-8-3.59-8-8s3.59-8 8-8s8 3.59 8 8s-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2m1 5h-2v4H7v2h4v4h2v-4h4v-2h-4V7Z\"/>"
|
||||
},
|
||||
"cloud-upload": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M11 20H6.5q-2.28 0-3.89-1.57Q1 16.85 1 14.58q0-1.95 1.17-3.48q1.18-1.53 3.08-1.95q.63-2.3 2.5-3.72Q9.63 4 12 4q2.93 0 4.96 2.04Q19 8.07 19 11q1.73.2 2.86 1.5q1.14 1.28 1.14 3q0 1.88-1.31 3.19T18.5 20H13v-7.15l1.6 1.55L16 13l-4-4l-4 4l1.4 1.4l1.6-1.55Z\"/>"
|
||||
},
|
||||
"send-circle-outline": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M8 7.71L18 12L8 16.29v-3.34l7.14-.95L8 11.05V7.71M12 2a10 10 0 0 1 10 10a10 10 0 0 1-10 10A10 10 0 0 1 2 12A10 10 0 0 1 12 2m0 2a8 8 0 0 0-8 8a8 8 0 0 0 8 8a8 8 0 0 0 8-8a8 8 0 0 0-8-8Z\"/>"
|
||||
},
|
||||
"email-edit-outline": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M19.07 13.88L13 19.94V22h2.06l6.06-6.07m1.58-2.35l-1.28-1.28a.517.517 0 0 0-.38-.17c-.15.01-.29.06-.39.17l-1 1l2.05 2l1-1c.19-.2.19-.52 0-.72M11 18H4V8l8 5l8-5v2h2V6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h7v-2m9-12l-8 5l-8-5h16Z\"/>"
|
||||
},
|
||||
"magnify": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5l-1.5 1.5l-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16A6.5 6.5 0 0 1 3 9.5A6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14S14 12 14 9.5S12 5 9.5 5Z\"/>"
|
||||
},
|
||||
"message-badge-outline": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M22 7v9c0 1.1-.9 2-2 2H6l-4 4V4c0-1.1.9-2 2-2h10.1c-.1.3-.1.7-.1 1s0 .7.1 1H4v12h16V7.9c.7-.1 1.4-.5 2-.9m-6-4c0 1.7 1.3 3 3 3s3-1.3 3-3s-1.3-3-3-3s-3 1.3-3 3Z\"/>"
|
||||
},
|
||||
"plus": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2Z\"/>"
|
||||
},
|
||||
"inbox-arrow-down": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M16 10h-2V7h-4v3H8l4 4m7 1h-4a3 3 0 0 1-3 3a3 3 0 0 1-3-3H5V5h14m0-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2Z\"/>"
|
||||
},
|
||||
"download": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M5 20h14v-2H5m14-9h-4V3H9v6H5l7 7l7-7Z\"/>"
|
||||
},
|
||||
"dots-horizontal": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M16 12a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2m-6 0a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2m-6 0a2 2 0 0 1 2-2a2 2 0 0 1 2 2a2 2 0 0 1-2 2a2 2 0 0 1-2-2Z\"/>"
|
||||
},
|
||||
"dock-window": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M18 18v2H4a2 2 0 0 1-2-2V8h2v10M22 6v8a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2m-2 0H8v8h12Z\"/>"
|
||||
},
|
||||
"pin-off": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M2 5.27L3.28 4L20 20.72L18.73 22l-5.93-5.93V22h-1.6v-6H6v-2l2-2v-.73l-6-6M16 12l2 2v2h-.18L8 6.18V4H7V2h10v2h-1v8Z\"/>"
|
||||
},
|
||||
"pin": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M16 12V4h1V2H7v2h1v8l-2 2v2h5.2v6h1.6v-6H18v-2l-2-2Z\"/>"
|
||||
},
|
||||
"bell-off-outline": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M22.11 21.46L2.39 1.73L1.11 3l4.72 4.72A6.975 6.975 0 0 0 5 11v6l-2 2v1h15.11l2.73 2.73l1.27-1.27M7 18v-7c0-.61.11-1.21.34-1.77L16.11 18H7m3 3h4a2 2 0 0 1-2 2a2 2 0 0 1-2-2M8.29 5.09c.53-.34 1.11-.59 1.71-.8V4a2 2 0 0 1 2-2a2 2 0 0 1 2 2v.29c2.97.88 5 3.61 5 6.71v4.8l-2-2V11a5 5 0 0 0-5-5c-.78 0-1.55.2-2.24.56L8.29 5.09Z\"/>"
|
||||
},
|
||||
"account-multiple": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M16 17v2H2v-2s0-4 7-4s7 4 7 4m-3.5-9.5A3.5 3.5 0 1 0 9 11a3.5 3.5 0 0 0 3.5-3.5m3.44 5.5A5.32 5.32 0 0 1 18 17v2h4v-2s0-3.63-6.06-4M15 4a3.39 3.39 0 0 0-1.93.59a5 5 0 0 1 0 5.82A3.39 3.39 0 0 0 15 11a3.5 3.5 0 0 0 0-7Z\"/>"
|
||||
},
|
||||
"puzzle": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M20.5 11H19V7a2 2 0 0 0-2-2h-4V3.5A2.5 2.5 0 0 0 10.5 1A2.5 2.5 0 0 0 8 3.5V5H4a2 2 0 0 0-2 2v3.8h1.5c1.5 0 2.7 1.2 2.7 2.7c0 1.5-1.2 2.7-2.7 2.7H2V20a2 2 0 0 0 2 2h3.8v-1.5c0-1.5 1.2-2.7 2.7-2.7c1.5 0 2.7 1.2 2.7 2.7V22H17a2 2 0 0 0 2-2v-4h1.5a2.5 2.5 0 0 0 2.5-2.5a2.5 2.5 0 0 0-2.5-2.5Z\"/>"
|
||||
},
|
||||
"video-box": {
|
||||
"body": "<path fill=\"currentColor\" d=\"m18 16l-4-3.2V16H6V8h8v3.2L18 8m2-4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2Z\"/>"
|
||||
},
|
||||
"compass": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M14.19 14.19L6 18l3.81-8.19L18 6m-6-4A10 10 0 0 0 2 12a10 10 0 0 0 10 10a10 10 0 0 0 10-10A10 10 0 0 0 12 2m0 8.9a1.1 1.1 0 0 0-1.1 1.1a1.1 1.1 0 0 0 1.1 1.1a1.1 1.1 0 0 0 1.1-1.1a1.1 1.1 0 0 0-1.1-1.1Z\"/>"
|
||||
},
|
||||
"checkbox-marked-outline": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M19 19H5V5h10V3H5c-1.11 0-2 .89-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-8h-2m-11.09-.92L6.5 11.5L11 16L21 6l-1.41-1.42L11 13.17l-3.09-3.09Z\"/>"
|
||||
},
|
||||
"projector-screen-outline": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M20 2H4c-.55 0-1 .45-1 1v1c0 .55.45 1 1 1h1v9h6v2.59l-4.21 4.2l1.42 1.42l2.79-2.8V22h2v-2.59l2.79 2.8l1.42-1.42l-4.21-4.2V14h6V5h1c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1m-3 10H7V5h10v7Z\"/>"
|
||||
},
|
||||
"open-in-new": {
|
||||
"body": "<path fill=\"currentColor\" d=\"M14 3v2h3.59l-9.83 9.83l1.41 1.41L19 6.41V10h2V3m-2 16H5V5h7V3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7h-2v7Z\"/>"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"prefix": "openmoji",
|
||||
"lastModified": 1686116966,
|
||||
"aliases": {},
|
||||
"width": 72,
|
||||
"height": 72,
|
||||
"icons": {
|
||||
"frog": {
|
||||
"body": "<path fill=\"#B1CC33\" d=\"M39.386 22.357c.463 0 .871-.305.993-.753c.56-2.053 2.59-6.929 7.654-7.604C55.867 12.955 59 18.178 59 22.357c0 5.06-2.09 5.222-3.415 7.597c-.264.472-.408 1.058-.035 1.45c5.443 5.696 8.19 29.602-19.53 29.602C10.95 61.006 9 41 16.475 31.384c.333-.428.391-1.001.026-1.403c-1.47-1.615-4.56-5.664-2.94-9.714C15.652 15.045 19.83 14 22.963 14c3.003 0 7.925 1.919 9.25 7.595c.105.453.527.762.992.762h6.18z\"/><path fill=\"none\" stroke=\"#000\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-miterlimit=\"10\" stroke-width=\"2\" d=\"M39.386 22.357c.463 0 .871-.305.993-.753c.56-2.053 2.59-6.929 7.654-7.604C55.867 12.955 59 18.178 59 22.357c0 5.06-2.09 5.222-3.415 7.597c-.264.472-.408 1.058-.035 1.45c5.443 5.696 8.19 29.602-19.53 29.602C10.95 61.006 9 41 16.475 31.384c.333-.428.391-1.001.026-1.403c-1.47-1.615-4.56-5.664-2.94-9.714C15.652 15.045 19.83 14 22.963 14c3.003 0 7.925 1.919 9.25 7.595c.105.453.527.762.992.762h6.18z\"/><path fill=\"none\" stroke=\"#000\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-miterlimit=\"10\" stroke-width=\"2\" d=\"M22.441 48.47s13.58 12.536 28.203 0\"/><circle cx=\"22.441\" cy=\"23.401\" r=\"3.134\"/><circle cx=\"49.6\" cy=\"23.401\" r=\"3.134\"/><circle cx=\"31.842\" cy=\"43.248\" r=\"2.089\"/><circle cx=\"40.199\" cy=\"43.248\" r=\"2.089\"/>"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"prefix": "emojione",
|
||||
"lastModified": 1672651879,
|
||||
"aliases": {},
|
||||
"width": 64,
|
||||
"height": 64,
|
||||
"icons": {
|
||||
"white-heavy-check-mark": {
|
||||
"body": "<circle cx=\"32\" cy=\"32\" r=\"30\" fill=\"#4bd37b\"/><path fill=\"#fff\" d=\"M46 14L25 35.6l-7-7.2l-7 7.2L25 50l28-28.8z\"/>"
|
||||
},
|
||||
"cross-mark-button": {
|
||||
"body": "<path fill=\"#ff5a79\" d=\"M62 52c0 5.5-4.5 10-10 10H12C6.5 62 2 57.5 2 52V12C2 6.5 6.5 2 12 2h40c5.5 0 10 4.5 10 10v40z\"/><path fill=\"#fff\" d=\"M50 21.2L42.8 14L32 24.8L21.2 14L14 21.2L24.8 32L14 42.8l7.2 7.2L32 39.2L42.8 50l7.2-7.2L39.2 32z\"/>"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
@ -0,0 +1,20 @@
|
||||
import { Icon } from '@capital/component';
|
||||
import icons from './icons.json';
|
||||
|
||||
const PLUGIN_ID = 'com.msgbyte.offline-icons';
|
||||
const PLUGIN_NAME = 'Offline Icons';
|
||||
|
||||
console.log(`Plugin ${PLUGIN_NAME}(${PLUGIN_ID}) is loaded`);
|
||||
|
||||
// Icon.addIcon
|
||||
|
||||
icons.forEach((collection) => {
|
||||
if (!Icon.addCollection) {
|
||||
console.warn(
|
||||
'Cannot call addCollection because of Icon.addCollection has not exposed!'
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
Icon.addCollection(collection);
|
||||
});
|
@ -0,0 +1,8 @@
|
||||
import { localTrans } from '@capital/common';
|
||||
|
||||
export const Translate = {
|
||||
name: localTrans({
|
||||
'zh-CN': 'Offline Icons',
|
||||
'en-US': 'Offline Icons',
|
||||
}),
|
||||
};
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"esModuleInterop": true,
|
||||
"jsx": "react",
|
||||
"resolveJsonModule": true,
|
||||
"importsNotUsedAsValues": "error"
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
declare module '@capital/common';
|
||||
declare module '@capital/component';
|
Loading…
Reference in New Issue