@feathericons/core 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/dist/entries.js +1 -3
- package/dist/generated.js +2709 -1728
- package/dist/index.d.ts +1 -1
- package/dist/variant.d.ts +2 -1
- package/dist/variant.js +6 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ export { ICON_AXES, ICON_AXIS_DEFAULTS } from './axes.js';
|
|
|
2
2
|
export { entryPointId, entryPointIds, iconExportName } from './entries.js';
|
|
3
3
|
export { icons } from './generated.js';
|
|
4
4
|
export { getVariant } from './variant.js';
|
|
5
|
-
export type { Icon, IconAxes, IconBounds, IconGrid, IconRoundness, IconVariant, IconWeight
|
|
5
|
+
export type { Icon, IconAxes, IconBounds, IconGrid, IconRoundness, IconVariant, IconWeight } from './types.js';
|
package/dist/variant.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { IconAxes } from './types.js';
|
|
2
|
+
/** Finds the variant at `axes`. Axes left out use `ICON_AXIS_DEFAULTS`. */
|
|
2
3
|
export declare function getVariant<Variant extends {
|
|
3
4
|
readonly axes: IconAxes;
|
|
4
5
|
}>(icon: {
|
|
5
6
|
readonly variants: readonly Variant[];
|
|
6
|
-
}, axes
|
|
7
|
+
}, axes?: Partial<IconAxes>): Variant;
|
package/dist/variant.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { ICON_AXES } from './axes.js';
|
|
2
|
-
|
|
1
|
+
import { ICON_AXES, ICON_AXIS_DEFAULTS } from './axes.js';
|
|
2
|
+
/** Finds the variant at `axes`. Axes left out use `ICON_AXIS_DEFAULTS`. */
|
|
3
|
+
export function getVariant(icon, axes = {}) {
|
|
3
4
|
const keys = Object.keys(ICON_AXES);
|
|
4
|
-
const
|
|
5
|
+
const wanted = { ...ICON_AXIS_DEFAULTS, ...axes };
|
|
6
|
+
const found = icon.variants.find((variant) => keys.every((key) => variant.axes[key] === wanted[key]));
|
|
5
7
|
if (!found) {
|
|
6
|
-
throw new Error(`missing variant ${keys.map((key) =>
|
|
8
|
+
throw new Error(`missing variant ${keys.map((key) => wanted[key]).join('/')}`);
|
|
7
9
|
}
|
|
8
10
|
return found;
|
|
9
11
|
}
|