mirror of
https://github.com/iconify/iconify.git
synced 2024-11-08 14:20:57 +00:00
Update core package
This commit is contained in:
parent
ad29f6df20
commit
6d1ec83912
@ -1,10 +1,8 @@
|
||||
import type { IconifyIcon } from '@iconify/types';
|
||||
import { fullIcon } from '@iconify/utils/lib/icon';
|
||||
import {
|
||||
defaults,
|
||||
mergeCustomisations,
|
||||
} from '@iconify/utils/lib/customisations';
|
||||
import type { IconifyIconCustomisations } from '@iconify/utils/lib/customisations';
|
||||
import { defaultIconProps } from '@iconify/utils/lib/icon/defaults';
|
||||
import { defaultIconCustomisations } from '@iconify/utils/lib/customisations/defaults';
|
||||
import { mergeCustomisations } from '@iconify/utils/lib/customisations/merge';
|
||||
import type { IconifyIconCustomisations } from '@iconify/utils/lib/customisations/defaults';
|
||||
import { iconToSVG } from '@iconify/utils/lib/svg/build';
|
||||
import type { IconifyIconBuildResult } from '@iconify/utils/lib/svg/build';
|
||||
|
||||
@ -32,9 +30,9 @@ export function buildIcon(
|
||||
customisations?: IconifyIconCustomisations
|
||||
): IconifyIconBuildResult {
|
||||
return iconToSVG(
|
||||
fullIcon(icon),
|
||||
{ ...defaultIconProps, ...icon },
|
||||
customisations
|
||||
? mergeCustomisations(defaults, customisations)
|
||||
: defaults
|
||||
? mergeCustomisations(defaultIconCustomisations, customisations)
|
||||
: defaultIconCustomisations
|
||||
);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { IconifyJSON, IconifyIcon } from '@iconify/types';
|
||||
import type { FullIconifyIcon } from '@iconify/utils/lib/icon';
|
||||
import type { FullIconifyIcon } from '@iconify/utils/lib/icon/defaults';
|
||||
import { parseIconSet } from '@iconify/utils/lib/icon-set/parse';
|
||||
import { quicklyValidateIconSet } from '@iconify/utils/lib/icon-set/validate-basic';
|
||||
import type { IconifyIconName } from '@iconify/utils/lib/icon/name';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import type { IconifyJSON, IconifyIcon } from '@iconify/types';
|
||||
import type { FullIconifyIcon } from '@iconify/utils/lib/icon';
|
||||
import { fullIcon } from '@iconify/utils/lib/icon';
|
||||
import type { FullIconifyIcon } from '@iconify/utils/lib/icon/defaults';
|
||||
import { defaultIconProps } from '@iconify/utils/lib/icon/defaults';
|
||||
import { parseIconSet } from '@iconify/utils/lib/icon-set/parse';
|
||||
import { quicklyValidateIconSet } from '@iconify/utils/lib/icon-set/validate-basic';
|
||||
|
||||
@ -84,7 +84,10 @@ export function addIconToStorage(
|
||||
try {
|
||||
if (typeof icon.body === 'string') {
|
||||
// Freeze icon to make sure it will not be modified
|
||||
storage.icons[name] = Object.freeze(fullIcon(icon));
|
||||
storage.icons[name] = Object.freeze({
|
||||
...defaultIconProps,
|
||||
...icon,
|
||||
});
|
||||
return true;
|
||||
}
|
||||
} catch (err) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { fullIcon } from '@iconify/utils/lib/icon';
|
||||
import { defaultIconProps } from '@iconify/utils/lib/icon/defaults';
|
||||
import { addIconSet, getStorage, listIcons } from '../../lib/storage/storage';
|
||||
import {
|
||||
iconExists,
|
||||
@ -42,9 +42,10 @@ describe('Testing IconifyStorageFunctions', () => {
|
||||
expect(iconExists(testName)).toBe(true);
|
||||
expect(listIcons(provider)).toEqual([testName]);
|
||||
|
||||
let expected = fullIcon({
|
||||
let expected = {
|
||||
...defaultIconProps,
|
||||
body: '<g />',
|
||||
});
|
||||
};
|
||||
expect(getIconData(testName)).toEqual(expected);
|
||||
expect(getIcon(testName)).toEqual(expected);
|
||||
|
||||
@ -63,9 +64,10 @@ describe('Testing IconifyStorageFunctions', () => {
|
||||
|
||||
// Test 'home' icon
|
||||
expect(iconExists(`${prefix}:home`)).toBe(true);
|
||||
expected = fullIcon({
|
||||
expected = {
|
||||
...defaultIconProps,
|
||||
body: '<g id="home" />',
|
||||
});
|
||||
};
|
||||
expect(getIconData(`${prefix}:home`)).toEqual(expected);
|
||||
expect(getIcon(`${prefix}:home`)).toEqual(expected);
|
||||
|
||||
@ -161,9 +163,10 @@ describe('Testing IconifyStorageFunctions', () => {
|
||||
// Test 'test'
|
||||
name = name1;
|
||||
expect(iconExists(name)).toBe(true);
|
||||
let expected = fullIcon({
|
||||
let expected = {
|
||||
...defaultIconProps,
|
||||
body: '<g data-icon="basic-icon" />',
|
||||
});
|
||||
};
|
||||
expect(getIcon(name)).toEqual(expected);
|
||||
expect(getIconData(name)).toEqual(expected);
|
||||
|
||||
@ -171,18 +174,20 @@ describe('Testing IconifyStorageFunctions', () => {
|
||||
name = `${prefix2}:${name2}`;
|
||||
expect(listIcons('', prefix2)).toEqual([name]);
|
||||
expect(iconExists(name)).toBe(true);
|
||||
expected = fullIcon({
|
||||
expected = {
|
||||
...defaultIconProps,
|
||||
body: '<g data-icon="prefixed-icon" />',
|
||||
});
|
||||
};
|
||||
expect(getIcon(name)).toEqual(expected);
|
||||
expect(getIconData(name)).toEqual(expected);
|
||||
|
||||
// Test prefixed icon, using '-' separator
|
||||
name = `${prefix2}-${name2}`;
|
||||
expect(iconExists(name)).toBe(true);
|
||||
expected = fullIcon({
|
||||
expected = {
|
||||
...defaultIconProps,
|
||||
body: '<g data-icon="prefixed-icon" />',
|
||||
});
|
||||
};
|
||||
expect(getIcon(name)).toEqual(expected);
|
||||
expect(getIconData(name)).toEqual(expected);
|
||||
|
||||
|
@ -7,7 +7,10 @@ import {
|
||||
getStorage,
|
||||
listIcons,
|
||||
} from '../../lib/storage/storage';
|
||||
import type { IconifyIcon, FullIconifyIcon } from '@iconify/utils/lib/icon';
|
||||
import type {
|
||||
IconifyIcon,
|
||||
FullIconifyIcon,
|
||||
} from '@iconify/utils/lib/icon/defaults';
|
||||
|
||||
describe('Testing storage', () => {
|
||||
it('Adding icon', () => {
|
||||
|
Loading…
Reference in New Issue
Block a user