@feathericons/core 0.0.0-stage → 0.2.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 CHANGED
@@ -1,3 +1,32 @@
1
- # Temporary Holding Version
1
+ # @feathericons/core
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Icon catalog for [Feather](../..).
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ pnpm add @feathericons/core
9
+ ```
10
+
11
+ The published package is ESM in `dist/index.js` with types in `dist/index.d.ts`.
12
+
13
+ ## Usage
14
+
15
+ ```ts
16
+ import { ICON_AXES, getVariant, icons } from '@feathericons/core'
17
+
18
+ ICON_AXES
19
+ // {
20
+ // weight: ['thin', 'extralight', 'light', 'regular', 'medium', 'semibold', 'bold'],
21
+ // roundness: ['none', 'small', 'medium', 'large'],
22
+ // }
23
+
24
+ icons
25
+ // [{ name, keywords, variants: [{ axes, grid, bounds, contents }, ...] }, ...]
26
+
27
+ getVariant(icons[0], { weight: 'bold', roundness: 'large' })
28
+ // { axes, grid, bounds, contents }
29
+
30
+ getVariant(icons[0], { weight: 'bold' })
31
+ // Axes you leave out use ICON_AXIS_DEFAULTS
32
+ ```
package/dist/axes.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ export declare const ICON_AXES: {
2
+ readonly weight: readonly ["thin", "extralight", "light", "regular", "medium", "semibold", "bold"];
3
+ readonly roundness: readonly ["none", "small", "medium", "large"];
4
+ };
5
+ export declare const ICON_AXIS_DEFAULTS: {
6
+ readonly weight: "regular";
7
+ readonly roundness: "medium";
8
+ };
package/dist/axes.js ADDED
@@ -0,0 +1,8 @@
1
+ export const ICON_AXES = {
2
+ "weight": ["thin", "extralight", "light", "regular", "medium", "semibold", "bold"],
3
+ "roundness": ["none", "small", "medium", "large"]
4
+ };
5
+ export const ICON_AXIS_DEFAULTS = {
6
+ "weight": "regular",
7
+ "roundness": "medium"
8
+ };
@@ -0,0 +1,4 @@
1
+ import type { IconAxes } from './types.js';
2
+ export declare function iconExportName(kebab: string): string;
3
+ export declare function entryPointId(axes: IconAxes): string;
4
+ export declare function entryPointIds(): readonly string[];
@@ -0,0 +1,28 @@
1
+ import { ICON_AXES } from './axes.js';
2
+ export function iconExportName(kebab) {
3
+ return `${kebab
4
+ .split('-')
5
+ .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
6
+ .join('')}Icon`;
7
+ }
8
+ export function entryPointId(axes) {
9
+ return Object.keys(ICON_AXES)
10
+ .map((key) => `${key}-${axes[key]}`)
11
+ .join('_');
12
+ }
13
+ export function entryPointIds() {
14
+ const keys = Object.keys(ICON_AXES);
15
+ const ids = [];
16
+ const walk = (depth, parts) => {
17
+ if (depth === keys.length) {
18
+ ids.push(parts.join('_'));
19
+ return;
20
+ }
21
+ const key = keys[depth];
22
+ for (const value of ICON_AXES[key]) {
23
+ walk(depth + 1, [...parts, `${key}-${value}`]);
24
+ }
25
+ };
26
+ walk(0, []);
27
+ return ids;
28
+ }
@@ -0,0 +1,2 @@
1
+ import type { Icon } from './types.js';
2
+ export declare const icons: readonly Icon[];