@memobit/icons 1.6.0 → 1.7.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,94 +1,111 @@
1
- # @memobit/icons
2
-
3
- 495 hand-built SVG icons for the Memobit apps, with categories and search aliases.
4
- TypeScript-first, ESM-only, React 19.
5
-
6
- Extracted from [`@memobit/libs`](https://github.com/CristeaIulian/memobit-react-library)
7
- in v2.0.0 of that library, so icons can be versioned and released independently.
8
-
9
- ## Install
10
-
11
- ```bash
12
- npm install @memobit/icons
13
- ```
14
-
15
- `react` is a peer dependency.
16
-
17
- ## Usage
18
-
19
- ### Import the icons you need (tree-shakeable)
20
-
21
- ```ts
22
- import { arrowUp, bee } from '@memobit/icons';
23
- ```
24
-
25
- Each icon is a `ReactElement` rendering an inline `<svg>` sized at `1em` with
26
- `fill="currentColor"`, so it inherits font size and colour from its container.
27
-
28
- Every icon is its own module and the package is marked side-effect free, so a bundler
29
- drops whatever you do not import. Importing two icons costs ~4 KB, not the full set.
30
-
31
- ### Look an icon up by name
32
-
33
- ```ts
34
- import { iconMap } from '@memobit/icons/map';
35
-
36
- const element = iconMap[name];
37
- ```
38
-
39
- `iconMap` is behind its own subpath deliberately: it references all 495 icons, so
40
- importing it pulls in the whole set and defeats tree-shaking. Reach for it only when the
41
- name is not known until runtime — for example a value chosen through a picker and
42
- persisted to a database.
43
-
44
- The same subpath exports `getIcon(name)`, `loadIcon(name)`, `loadAllIcons()` and
45
- `canLoadMoreIcons`. With the full map they simply read it. With the Vite plugin's
46
- `lazy: true`, only the icons found in the app's source ship up front; any other icon is
47
- fetched as its own small chunk the first time `loadIcon` asks for it, and `loadAllIcons`
48
- fetches the rest of the set, which is what an icon picker needs.
49
-
50
- ```ts
51
- memobitIcons({ root: import.meta.dirname, lazy: true });
52
- ```
53
-
54
- ### Metadata
55
-
56
- ```ts
57
- import {
58
- iconAliases,
59
- iconCategoryById,
60
- iconCategoryByPath,
61
- iconCategoryDefinitions,
62
- OTHER_CATEGORY_ID,
63
- otherCategory,
64
- type IconCategory,
65
- type IconName,
66
- } from '@memobit/icons';
67
- ```
68
-
69
- - `IconName` — union of all 495 names.
70
- - `iconCategoryDefinitions` — the categories, each with its icon names.
71
- - `iconAliases` — search synonyms per icon, used by the icon picker.
72
-
73
- ## Adding an icon
74
-
75
- 1. Add `src/icons/<kebab-name>.tsx` exporting a camelCase const.
76
- 2. Add the import and the map entry in `src/map.ts`.
77
- 3. Add the name to the right category in `src/iconCategories.ts`, and aliases in
78
- `src/iconAliases/` if it needs them.
79
- 4. Run `npm run generate:icon-names` to regenerate the `IconName` union.
80
- 5. Run `npm run build`.
81
-
82
- The `IconName` union is generated rather than derived as `keyof typeof iconMap`, because
83
- the derived form forced the whole map's object type into the emitted declarations and
84
- dominated the type-build time.
85
-
86
- ## Build output
87
-
88
- Modules are preserved one-to-one from `src/` into `dist/` rather than bundled, so every
89
- icon stays its own chunk. `dist/index.js` re-exports them all; `dist/map.js` holds the
90
- lookup.
91
-
92
- ## License
93
-
94
- Apache-2.0
1
+ # @memobit/icons
2
+
3
+ 495 hand-built SVG icons for the Memobit apps, with categories and search aliases.
4
+ TypeScript-first, ESM-only, React 19.
5
+
6
+ Extracted from [`@memobit/libs`](https://github.com/CristeaIulian/memobit-react-library)
7
+ in v2.0.0 of that library, so icons can be versioned and released independently.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install @memobit/icons
13
+ ```
14
+
15
+ `react` is a peer dependency.
16
+
17
+ ## Usage
18
+
19
+ ### Import the icons you need (tree-shakeable)
20
+
21
+ ```ts
22
+ import { arrowUp, bee } from '@memobit/icons';
23
+ ```
24
+
25
+ Each icon is a `ReactElement` rendering an inline `<svg>` sized at `1em` with
26
+ `fill="currentColor"`, so it inherits font size and colour from its container.
27
+
28
+ Every icon is its own module and the package is marked side-effect free, so a bundler
29
+ drops whatever you do not import. Importing two icons costs ~4 KB, not the full set.
30
+
31
+ ### Look an icon up by name
32
+
33
+ ```ts
34
+ import { iconMap } from '@memobit/icons/map';
35
+
36
+ const element = iconMap[name];
37
+ ```
38
+
39
+ `iconMap` is behind its own subpath deliberately: it references all 495 icons, so
40
+ importing it pulls in the whole set and defeats tree-shaking. Reach for it only when the
41
+ name is not known until runtime — for example a value chosen through a picker and
42
+ persisted to a database.
43
+
44
+ The same subpath exports `getIcon(name)`, `loadIcon(name)`, `loadAllIcons()` and
45
+ `canLoadMoreIcons`. With the full map they simply read it. With the Vite plugin's
46
+ `lazy: true`, only the icons found in the app's source ship up front; any other icon is
47
+ fetched as its own small chunk the first time `loadIcon` asks for it, and `loadAllIcons`
48
+ fetches the rest of the set, which is what an icon picker needs.
49
+
50
+ ```ts
51
+ memobitIcons({ root: import.meta.dirname, lazy: true });
52
+ ```
53
+
54
+ ### Metadata
55
+
56
+ ```ts
57
+ import {
58
+ iconAliases,
59
+ iconCategoryById,
60
+ iconCategoryByPath,
61
+ iconCategoryDefinitions,
62
+ OTHER_CATEGORY_ID,
63
+ otherCategory,
64
+ type IconCategory,
65
+ type IconName,
66
+ } from '@memobit/icons';
67
+ ```
68
+
69
+ - `IconName` — union of all 495 names.
70
+ - `iconCategoryDefinitions` — the categories, each with its icon names.
71
+ - `iconAliases` — search synonyms per icon, used by the icon picker.
72
+
73
+ ### Animated icons
74
+
75
+ ```tsx
76
+ import { AnimatedIcon } from '@memobit/libs';
77
+
78
+ <AnimatedIcon name="running" size="sm" />;
79
+ ```
80
+
81
+ A separate set behind `@memobit/icons/animated`, for something happening right now (motion
82
+ in a room, a job running). It exports `animatedIconMap`, the `AnimatedIconName` union and
83
+ `animatedIconDescriptions`. These icons move on their own (SMIL inside the SVG, no CSS
84
+ needed), may use strokes, and stay out of `iconMap`, `IconName`, the categories and the
85
+ Vite trim plugin.
86
+
87
+ To add one: put `src/animated/<kebab-name>.tsx` next to `running.tsx`, then add it to
88
+ `animatedIconMap` and `animatedIconDescriptions` in `src/animated.ts`.
89
+
90
+ ## Adding an icon
91
+
92
+ 1. Add `src/icons/<kebab-name>.tsx` exporting a camelCase const.
93
+ 2. Add the import and the map entry in `src/map.ts`.
94
+ 3. Add the name to the right category in `src/iconCategories.ts`, and aliases in
95
+ `src/iconAliases/` if it needs them.
96
+ 4. Run `npm run generate:icon-names` to regenerate the `IconName` union.
97
+ 5. Run `npm run build`.
98
+
99
+ The `IconName` union is generated rather than derived as `keyof typeof iconMap`, because
100
+ the derived form forced the whole map's object type into the emitted declarations and
101
+ dominated the type-build time.
102
+
103
+ ## Build output
104
+
105
+ Modules are preserved one-to-one from `src/` into `dist/` rather than bundled, so every
106
+ icon stays its own chunk. `dist/index.js` re-exports them all; `dist/map.js` holds the
107
+ lookup.
108
+
109
+ ## License
110
+
111
+ Apache-2.0
@@ -0,0 +1,6 @@
1
+ /**
2
+ * A stick figure running in place, with a slight bob. The limbs are SMIL animations rather than CSS
3
+ * ones, as each joint turns around its own point inside the limb above it. The far arm and leg are
4
+ * fainter, so the two legs read apart even at text size.
5
+ */
6
+ export declare const running: import('react').JSX.Element;
@@ -0,0 +1,132 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ //#region src/animated/running.tsx
3
+ var STRIDE_SECONDS = .7;
4
+ var HALF_STRIDE = `-${STRIDE_SECONDS / 2}s`;
5
+ var EASE = "0.45 0 0.55 1";
6
+ /** Rotates its group around the joint at the group's origin, through the angles (0 hangs straight down, negative swings forward). */
7
+ var swing = (angles, keyTimes, begin = "0s") => /* @__PURE__ */ jsx("animateTransform", {
8
+ attributeName: "transform",
9
+ type: "rotate",
10
+ values: angles.join(";"),
11
+ keyTimes: keyTimes.join(";"),
12
+ keySplines: keyTimes.slice(1).map(() => EASE).join(";"),
13
+ calcMode: "spline",
14
+ dur: `${STRIDE_SECONDS}s`,
15
+ begin,
16
+ repeatCount: "indefinite"
17
+ });
18
+ /** The upper arm swings from the shoulder, the forearm held bent forward. */
19
+ var arm = (begin) => /* @__PURE__ */ jsx("g", {
20
+ transform: "translate(13.6 8.9)",
21
+ children: /* @__PURE__ */ jsxs("g", { children: [
22
+ swing([
23
+ 40,
24
+ -45,
25
+ 40
26
+ ], [
27
+ 0,
28
+ .5,
29
+ 1
30
+ ], begin),
31
+ /* @__PURE__ */ jsx("line", {
32
+ x1: "0",
33
+ y1: "0",
34
+ x2: "0",
35
+ y2: "3.6"
36
+ }),
37
+ /* @__PURE__ */ jsx("g", {
38
+ transform: "translate(0 3.6) rotate(-85)",
39
+ children: /* @__PURE__ */ jsx("line", {
40
+ x1: "0",
41
+ y1: "0",
42
+ x2: "0",
43
+ y2: "3.2"
44
+ })
45
+ })
46
+ ] })
47
+ });
48
+ /** The thigh swings from the hip, the shin folds back on the recovery and reaches out to land. */
49
+ var leg = (begin) => /* @__PURE__ */ jsx("g", {
50
+ transform: "translate(11.5 13.6)",
51
+ children: /* @__PURE__ */ jsxs("g", { children: [
52
+ swing([
53
+ -45,
54
+ 35,
55
+ -45
56
+ ], [
57
+ 0,
58
+ .5,
59
+ 1
60
+ ], begin),
61
+ /* @__PURE__ */ jsx("line", {
62
+ x1: "0",
63
+ y1: "0",
64
+ x2: "0",
65
+ y2: "4.6"
66
+ }),
67
+ /* @__PURE__ */ jsx("g", {
68
+ transform: "translate(0 4.6)",
69
+ children: /* @__PURE__ */ jsxs("g", { children: [swing([
70
+ 10,
71
+ 20,
72
+ 100,
73
+ 10
74
+ ], [
75
+ 0,
76
+ .5,
77
+ .75,
78
+ 1
79
+ ], begin), /* @__PURE__ */ jsx("line", {
80
+ x1: "0",
81
+ y1: "0",
82
+ x2: "0",
83
+ y2: "4.8"
84
+ })] })
85
+ })
86
+ ] })
87
+ });
88
+ /**
89
+ * A stick figure running in place, with a slight bob. The limbs are SMIL animations rather than CSS
90
+ * ones, as each joint turns around its own point inside the limb above it. The far arm and leg are
91
+ * fainter, so the two legs read apart even at text size.
92
+ */
93
+ var running = /* @__PURE__ */ jsx("svg", {
94
+ xmlns: "http://www.w3.org/2000/svg",
95
+ viewBox: "0 0 24 24",
96
+ width: "1em",
97
+ height: "1em",
98
+ fill: "none",
99
+ stroke: "currentColor",
100
+ strokeWidth: "2.4",
101
+ strokeLinecap: "round",
102
+ children: /* @__PURE__ */ jsxs("g", { children: [
103
+ /* @__PURE__ */ jsx("animateTransform", {
104
+ attributeName: "transform",
105
+ type: "translate",
106
+ values: "0 0;0 -0.8;0 0",
107
+ dur: `${STRIDE_SECONDS / 2}s`,
108
+ repeatCount: "indefinite"
109
+ }),
110
+ /* @__PURE__ */ jsxs("g", {
111
+ opacity: "0.55",
112
+ children: [arm(HALF_STRIDE), leg(HALF_STRIDE)]
113
+ }),
114
+ /* @__PURE__ */ jsx("circle", {
115
+ cx: "15",
116
+ cy: "4.2",
117
+ r: "2.3",
118
+ fill: "currentColor",
119
+ stroke: "none"
120
+ }),
121
+ /* @__PURE__ */ jsx("line", {
122
+ x1: "14",
123
+ y1: "8",
124
+ x2: "11.5",
125
+ y2: "13.6"
126
+ }),
127
+ leg(),
128
+ arm()
129
+ ] })
130
+ });
131
+ //#endregion
132
+ export { running };
@@ -0,0 +1,6 @@
1
+ export declare const animatedIconMap: {
2
+ running: import('react').JSX.Element;
3
+ };
4
+ export type AnimatedIconName = keyof typeof animatedIconMap;
5
+ /** What each animated icon is for, shown in the icon catalog. */
6
+ export declare const animatedIconDescriptions: Readonly<Record<AnimatedIconName, string>>;
@@ -0,0 +1,7 @@
1
+ import { running } from "./animated/running.js";
2
+ //#region src/animated.ts
3
+ var animatedIconMap = { running };
4
+ /** What each animated icon is for, shown in the icon catalog. */
5
+ var animatedIconDescriptions = { running: "Someone moving right now: motion or presence detected." };
6
+ //#endregion
7
+ export { animatedIconDescriptions, animatedIconMap };
package/package.json CHANGED
@@ -1,101 +1,105 @@
1
- {
2
- "name": "@memobit/icons",
3
- "version": "1.6.0",
4
- "description": "495 hand-built SVG icons for the Memobit apps — individually exported and tree-shakeable, with categories and search aliases. TypeScript-first, ESM-only, React 19.",
5
- "keywords": [
6
- "react",
7
- "icons",
8
- "svg",
9
- "svg-icons",
10
- "icon-set",
11
- "typescript",
12
- "tree-shakeable",
13
- "memobit"
14
- ],
15
- "author": "Iulian Cristea <iulianx@gmail.com>",
16
- "license": "Apache-2.0",
17
- "homepage": "https://react.memobit.ro/",
18
- "repository": {
19
- "type": "git",
20
- "url": "git+https://github.com/CristeaIulian/memobit-react-library-icons.git"
21
- },
22
- "bugs": {
23
- "url": "https://github.com/CristeaIulian/memobit-react-library-icons/issues"
24
- },
25
- "publishConfig": {
26
- "access": "public"
27
- },
28
- "sideEffects": false,
29
- "type": "module",
30
- "main": "dist/index.js",
31
- "module": "dist/index.js",
32
- "types": "dist/index.d.ts",
33
- "exports": {
34
- ".": {
35
- "types": "./dist/index.d.ts",
36
- "import": "./dist/index.js"
37
- },
38
- "./map": {
39
- "types": "./dist/map.d.ts",
40
- "import": "./dist/map.js"
41
- },
42
- "./registry": {
43
- "types": "./dist/registry.d.ts",
44
- "import": "./dist/registry.js"
45
- },
46
- "./vite": {
47
- "types": "./dist/vite.d.ts",
48
- "import": "./dist/vite.js"
49
- },
50
- "./icons/*": {
51
- "types": "./dist/icons/*.d.ts",
52
- "import": "./dist/icons/*.js"
53
- },
54
- "./package.json": "./package.json"
55
- },
56
- "files": [
57
- "dist"
58
- ],
59
- "scripts": {
60
- "build": "vite build && npm pack",
61
- "release": "npm run build && npm publish",
62
- "ship": "npm version patch && npm run release && git push --follow-tags",
63
- "ship:minor": "npm version minor && npm run release && git push --follow-tags",
64
- "ship:major": "npm version major && npm run release && git push --follow-tags",
65
- "prepublishOnly": "vite build",
66
- "generate:icon-names": "node scripts/generate-icon-names.mjs",
67
- "dev": "vite build --watch",
68
- "lint": "eslint .",
69
- "lint:fix": "eslint . --fix",
70
- "format": "prettier --write \"**/*.{ts,tsx,js,jsx,mjs,cjs,css,scss}\"",
71
- "format:check": "prettier --check \"**/*.{ts,tsx,js,jsx,mjs,cjs,css,scss}\""
72
- },
73
- "peerDependencies": {
74
- "react": "19.3.0"
75
- },
76
- "devDependencies": {
77
- "@eslint/js": "9.39.4",
78
- "@types/node": "25.9.8",
79
- "@types/react": "19.3.0",
80
- "@vitejs/plugin-react": "6.1.1",
81
- "esbuild": "0.28.2",
82
- "eslint": "9.39.4",
83
- "eslint-config-prettier": "10.1.8",
84
- "eslint-plugin-import": "2.32.0",
85
- "eslint-plugin-prettier": "5.5.6",
86
- "eslint-plugin-react": "7.37.5",
87
- "eslint-plugin-react-hooks": "7.1.1",
88
- "eslint-plugin-react-refresh": "0.5.7",
89
- "eslint-plugin-simple-import-sort": "14.0.0",
90
- "globals": "17.12.0",
91
- "prettier": "3.9.9",
92
- "react": "19.3.0",
93
- "typescript": "6.0.3",
94
- "typescript-eslint": "8.70.1",
95
- "vite": "8.3.3",
96
- "vite-plugin-dts": "5.1.1"
97
- },
98
- "overrides": {
99
- "source-map-js": "1.2.2"
100
- }
101
- }
1
+ {
2
+ "name": "@memobit/icons",
3
+ "version": "1.7.0",
4
+ "description": "495 hand-built SVG icons for the Memobit apps — individually exported and tree-shakeable, with categories and search aliases. TypeScript-first, ESM-only, React 19.",
5
+ "keywords": [
6
+ "react",
7
+ "icons",
8
+ "svg",
9
+ "svg-icons",
10
+ "icon-set",
11
+ "typescript",
12
+ "tree-shakeable",
13
+ "memobit"
14
+ ],
15
+ "author": "Iulian Cristea <iulianx@gmail.com>",
16
+ "license": "Apache-2.0",
17
+ "homepage": "https://react.memobit.ro/",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/CristeaIulian/memobit-react-library-icons.git"
21
+ },
22
+ "bugs": {
23
+ "url": "https://github.com/CristeaIulian/memobit-react-library-icons/issues"
24
+ },
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "sideEffects": false,
29
+ "type": "module",
30
+ "main": "dist/index.js",
31
+ "module": "dist/index.js",
32
+ "types": "dist/index.d.ts",
33
+ "exports": {
34
+ ".": {
35
+ "types": "./dist/index.d.ts",
36
+ "import": "./dist/index.js"
37
+ },
38
+ "./animated": {
39
+ "types": "./dist/animated.d.ts",
40
+ "import": "./dist/animated.js"
41
+ },
42
+ "./map": {
43
+ "types": "./dist/map.d.ts",
44
+ "import": "./dist/map.js"
45
+ },
46
+ "./registry": {
47
+ "types": "./dist/registry.d.ts",
48
+ "import": "./dist/registry.js"
49
+ },
50
+ "./vite": {
51
+ "types": "./dist/vite.d.ts",
52
+ "import": "./dist/vite.js"
53
+ },
54
+ "./icons/*": {
55
+ "types": "./dist/icons/*.d.ts",
56
+ "import": "./dist/icons/*.js"
57
+ },
58
+ "./package.json": "./package.json"
59
+ },
60
+ "files": [
61
+ "dist"
62
+ ],
63
+ "scripts": {
64
+ "build": "vite build && npm pack",
65
+ "release": "npm run build && npm publish",
66
+ "ship": "npm version patch && npm run release && git push --follow-tags",
67
+ "ship:minor": "npm version minor && npm run release && git push --follow-tags",
68
+ "ship:major": "npm version major && npm run release && git push --follow-tags",
69
+ "prepublishOnly": "vite build",
70
+ "generate:icon-names": "node scripts/generate-icon-names.mjs",
71
+ "dev": "vite build --watch",
72
+ "lint": "eslint .",
73
+ "lint:fix": "eslint . --fix",
74
+ "format": "prettier --write \"**/*.{ts,tsx,js,jsx,mjs,cjs,css,scss}\"",
75
+ "format:check": "prettier --check \"**/*.{ts,tsx,js,jsx,mjs,cjs,css,scss}\""
76
+ },
77
+ "peerDependencies": {
78
+ "react": "19.3.0"
79
+ },
80
+ "devDependencies": {
81
+ "@eslint/js": "9.39.4",
82
+ "@types/node": "25.9.8",
83
+ "@types/react": "19.3.0",
84
+ "@vitejs/plugin-react": "6.1.1",
85
+ "esbuild": "0.28.2",
86
+ "eslint": "9.39.4",
87
+ "eslint-config-prettier": "10.1.8",
88
+ "eslint-plugin-import": "2.32.0",
89
+ "eslint-plugin-prettier": "5.5.6",
90
+ "eslint-plugin-react": "7.37.5",
91
+ "eslint-plugin-react-hooks": "7.1.1",
92
+ "eslint-plugin-react-refresh": "0.5.7",
93
+ "eslint-plugin-simple-import-sort": "14.0.0",
94
+ "globals": "17.12.0",
95
+ "prettier": "3.9.9",
96
+ "react": "19.3.0",
97
+ "typescript": "6.0.3",
98
+ "typescript-eslint": "8.70.1",
99
+ "vite": "8.3.3",
100
+ "vite-plugin-dts": "5.1.1"
101
+ },
102
+ "overrides": {
103
+ "source-map-js": "1.2.2"
104
+ }
105
+ }