feat(icons): 新增微软 Fluent Emoji 3D 位图图标源(1586 个,MIT),支持位图图标渲染与导出内联

This commit is contained in:
sgp
2026-11-05 11:33:36 +08:00
parent 07d2a79a60
commit fcb70e8c7f
1606 changed files with 266 additions and 55 deletions
+13 -6
View File
@@ -220,9 +220,13 @@ const HGB_Exporter = (function () {
* @param {string|null} bgColor 背景色;null 表示透明
*/
function renderCanvas(size, bgColor, svgOverride) {
return new Promise((resolve, reject) => {
const svgStr = svgOverride ||
buildExportSvg(bgColor === undefined ? null : bgColor);
const raw = svgOverride ||
buildExportSvg(bgColor === undefined ? null : bgColor);
// 位图图标(3D PNG)以相对 href 引用,转 blob 后相对路径失效 → 先内联为 data URI
const ready = (typeof HGB_IconLib !== 'undefined' && HGB_IconLib.inlineRasters)
? HGB_IconLib.inlineRasters(raw)
: Promise.resolve(raw);
return ready.then((svgStr) => new Promise((resolve, reject) => {
const blob = new Blob([svgStr], { type: 'image/svg+xml;charset=utf-8' });
const url = URL.createObjectURL(blob);
@@ -245,12 +249,15 @@ const HGB_Exporter = (function () {
reject(new Error('SVG 渲染失败,请检查元素内容'));
};
img.src = url;
});
}));
}
/* ============ 导出:SVG ============ */
function exportSvg(svgOverride, bgColor) {
const svgStr = svgOverride || buildExportSvg(bgColor || HGB_Store.get().bg || '#FFFFFF');
async function exportSvg(svgOverride, bgColor) {
let svgStr = svgOverride || buildExportSvg(bgColor || HGB_Store.get().bg || '#FFFFFF');
if (typeof HGB_IconLib !== 'undefined' && HGB_IconLib.inlineRasters) {
svgStr = await HGB_IconLib.inlineRasters(svgStr);
}
download(svgStr, 'image/svg+xml', safeName() + '.svg');
return svgStr;
}
+47 -2
View File
@@ -8,7 +8,7 @@
const HGB_IconLib = (function () {
'use strict';
const VERSION = '20261105c'; // 与 index.html 中 builtin-icons.js?v= 版本联动
const VERSION = '20261105d'; // 与 index.html 中 builtin-icons.js?v= 版本联动
const cache = {}; // sid -> {icons:[...]}
const pending = {}; // sid -> Promise
@@ -206,9 +206,54 @@ const HGB_IconLib = (function () {
return String(fullId || '').split(':')[0];
}
/* ---------- 位图图标内联(PNG 导出用) ---------- */
// 3D 位图图标的数据文件以 <image href="js/data/sources/...png"> 引用原图,
// 页面内联渲染可直接显示;但导出 PNG/PDF/SVG 时 SVG 会被转成 blob/data URI,
// 相对路径失效 → 导出前把 href 内联成 data URI(按路径缓存,只取一次)。
var rasterCache = {}; // 相对路径 -> data URI
var RASTER_RE = /href="(js\/data\/sources\/[^"]+\.png)"/g;
/** 是否含位图图标引用 */
function hasRaster(svg) {
return typeof svg === 'string' && svg.indexOf('js/data/sources/') !== -1 && svg.indexOf('.png"') !== -1;
}
function fetchDataURI(p) {
if (rasterCache[p]) return Promise.resolve(rasterCache[p]);
return fetch(p).then(function (r) {
if (!r.ok) throw new Error('位图加载失败: ' + p);
return r.blob();
}).then(function (blob) {
return new Promise(function (resolve, reject) {
var fr = new FileReader();
fr.onload = function () { rasterCache[p] = fr.result; resolve(fr.result); };
fr.onerror = reject;
fr.readAsDataURL(blob);
});
});
}
/** 把 svg 里的位图相对引用内联为 data URI(导出前调用;无位图时原样返回) */
function inlineRasters(svg) {
if (!hasRaster(svg)) return Promise.resolve(svg);
var paths = [], m;
RASTER_RE.lastIndex = 0;
while ((m = RASTER_RE.exec(svg))) {
if (paths.indexOf(m[1]) === -1) paths.push(m[1]);
}
return Promise.all(paths.map(fetchDataURI)).then(function () {
var out = svg;
paths.forEach(function (p) {
out = out.split('href="' + p + '"').join('href="' + rasterCache[p] + '"');
});
return out;
});
}
return {
VERSION, loadSource, loadSources, preload, loadAll,
getSource, loaded, loadedIds, findIcon, searchLoaded, searchIndex, sourceOf,
expandKeyword, matchIcon: iconMatches, scoreIcon
expandKeyword, matchIcon: iconMatches, scoreIcon,
hasRaster, inlineRasters
};
})();
File diff suppressed because one or more lines are too long
+30 -1
View File
@@ -1804,6 +1804,35 @@
{ id: 'withicons-lunar', type: 'emoji', name: 'With Icons Lunar', nameCn: '春节图标', desc: '中国春节主题图标,灯笼、红包与生肖元素,适合年节营销', style: '节日', license: 'MIT', licenseNote: 'MIT 协议,可商用', home: 'https://withicons.com', github: '', npm: '@iconify-json/withicons-lunar', format: 'iconify', scaleMode: 'body', coordText: '24 坐标归一化', variants: '多色 1 套', added: '2026-11-05' },
{ id: 'withicons-rangoli', type: 'emoji', name: 'With Icons Rangoli', nameCn: '排灯节图标', desc: '印度排灯节主题图标,彩绘与灯饰元素,适合节庆与跨文化设计', style: '节日', license: 'MIT', licenseNote: 'MIT 协议,可商用', home: 'https://withicons.com', github: '', npm: '@iconify-json/withicons-rangoli', format: 'iconify', scaleMode: 'body', coordText: '24 坐标归一化', variants: '多色 1 套', added: '2026-11-05' },
{ id: 'withicons-utsav', type: 'emoji', name: 'With Icons Utsav', nameCn: '印度节庆图标', desc: '印度节庆风格图标,色彩浓烈,适合文化活动和民族品牌', style: '节日', license: 'MIT', licenseNote: 'MIT 协议,可商用', home: 'https://withicons.com', github: '', npm: '@iconify-json/withicons-utsav', format: 'iconify', scaleMode: 'body', coordText: '24 坐标归一化', variants: '多色 1 套', added: '2026-11-05' },
{ id: 'withicons-valentine', type: 'emoji', name: 'With Icons Valentine', nameCn: '情人节图标', desc: '情人节主题图标,爱心、玫瑰与巧克力,适合情侣营销与礼品', style: '节日', license: 'MIT', licenseNote: 'MIT 协议,可商用', home: 'https://withicons.com', github: '', npm: '@iconify-json/withicons-valentine', format: 'iconify', scaleMode: 'body', coordText: '24 坐标归一化', variants: '多色 1 套', added: '2026-11-05' }
{ id: 'withicons-valentine', type: 'emoji', name: 'With Icons Valentine', nameCn: '情人节图标', desc: '情人节主题图标,爱心、玫瑰与巧克力,适合情侣营销与礼品', style: '节日', license: 'MIT', licenseNote: 'MIT 协议,可商用', home: 'https://withicons.com', github: '', npm: '@iconify-json/withicons-valentine', format: 'iconify', scaleMode: 'body', coordText: '24 坐标归一化', variants: '多色 1 套', added: '2026-11-05' },
/* ============================================================
* —— 2026-11-05 3D 位图批次:Fluent Emoji 3D ——
* 微软官方 3D 渲染表情(PNG,MIT)。仓库体积过大无法整树枚举(jsDelivr API 403),
* 改走 GitHub Trees API 枚举 + jsDelivr CDN 单文件下载(format: 'gh-raster'):
* - 非人物表情直接 3D:assets/<Name>/3D/<slug>_3d.png
* - 人物表情仅取 Default 肤色:assets/<Name>/Default/3D/<slug>_3d_default.png
* (Dark/Light/Medium 等 5 种肤色变体同图重复,不收录)
* PNG 落盘 js/data/sources/fluent-emoji-3d/files/,图标 svg 为 <image> 引用,
* 导出时由 HGB_IconLib.inlineRasters 内联为 data URI
* ============================================================ */
{
id: 'fluent-emoji-3d',
type: 'emoji',
name: 'Fluent Emoji 3D',
nameCn: '微软 3D 立体表情',
desc: '微软 Fluent Emoji 官方 3D 渲染版(MIT),真实光影与立体材质,覆盖食物、动物、活动、物体、符号等全品类,适合立体质感 LOGO、头像与社交素材',
style: '3D',
license: 'MIT',
licenseNote: 'MIT 协议,可自由商用、修改与再分发,需保留版权声明',
home: 'https://github.com/microsoft/fluentui-emoji',
github: 'https://github.com/microsoft/fluentui-emoji',
format: 'gh-raster',
gh: 'microsoft/fluentui-emoji',
ghBranch: 'main',
pathRe: '^assets/[^/]+/(?:Default/)?3D/[^/]+\\.png$',
coordText: '3D 渲染 PNG(原始 256×256),渲染时按 24 视口等比缩放',
variants: '非人物直接 3D + 人物 Default 肤色,共约 1,595 个',
added: '2026-11-05'
}
];
});
+3 -3
View File
@@ -5,12 +5,12 @@
## 生成时间
2026-11-04T18:03:56.685Z
2026-11-05T03:30:14.648Z
## ① 图标库(共享,LOGO/头像/海报共用)
- 源数:262 | 图标总数:443168
- 类型分布:icon 177 / emoji 53 / brand 32
- 源数:263 | 图标总数:444754
- 类型分布:icon 177 / emoji 54 / brand 32
- 源清单(含 count/file/workspaces):js/data/manifest/icons.json
## ② 海报素材库
+25 -2
View File
@@ -1,7 +1,7 @@
{
"kind": "icons",
"total": 443168,
"builtAt": "2026-11-04T17:20:41.111Z",
"total": 444754,
"builtAt": "2026-11-05T03:24:17.570Z",
"guide": "js/data/manifest/README.md",
"idRule": "「源:名称」,如 lucide:graduation-cap",
"dicebear": {
@@ -6034,6 +6034,29 @@
"logo",
"avatar"
]
},
{
"id": "fluent-emoji-3d",
"type": "emoji",
"name": "Fluent Emoji 3D",
"nameCn": "微软 3D 立体表情",
"desc": "微软 Fluent Emoji 官方 3D 渲染版(MIT),真实光影与立体材质,覆盖食物、动物、活动、物体、符号等全品类,适合立体质感 LOGO、头像与社交素材",
"style": "3D",
"license": "MIT",
"licenseNote": "MIT 协议,可自由商用、修改与再分发,需保留版权声明",
"home": "https://github.com/microsoft/fluentui-emoji",
"github": "https://github.com/microsoft/fluentui-emoji",
"npm": "",
"format": "gh-raster",
"coordText": "3D 渲染 PNG(原始 256×256),渲染时按 24 视口等比缩放",
"variants": "非人物直接 3D + 人物 Default 肤色,共约 1,595 个",
"added": "2026-11-05",
"count": 1586,
"file": "sources/fluent-emoji-3d.js",
"workspaces": [
"logo",
"avatar"
]
}
]
}
File diff suppressed because one or more lines are too long
Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Some files were not shown because too many files have changed in this diff Show More