kitten-icons
Version:
A subset of the Phosphor icon set in Kitten component format.
56 lines (43 loc) • 1.93 kB
JavaScript
// @ts-check
/**
Kitten Icons
This is a subset of the Phosphor icons set, version 2.1.1
(https://phosphoricons.com) by Helena Zhang and Tobias Fried in Kitten
component format with some modifications to make it compatible with the
Small Techonology Principles (https://small-tech.org/about/small-tech).
Specifically:
- Removes icons from Big Tech/Silicon Valley/surveillance capitalists/people farmers.
- Removes BTC (proof of work cryptocurrency).
- Renames user to person and users to people. (We do not have users in Small Tech and
the Small Web; we have people and we treat them as such.)
Also, creates `categories` and `tags` object hierarchies based on
metadata provided in the library to make it easier to discover icons
during authoring.
*/
import { catalog } from './catalog/index.mjs'
import { categories } from './catalog/categories.mjs'
import { tags } from './catalog/tags.mjs'
/**
Defines an unenumerable (hidden) property on the passed object with the given name and value.
Accessing the property directly will still work.
We use this to ensure that the authoring-time convenience objects (.categories and .tags)
do not pollute the icons namespace so you can enumerate all icons easily.
@param {{
onObject: any,
withName: string,
andValue: any
}} parameterObject
*/
function defineUnenumerableProperty ({ onObject, withName, andValue }) {
Object.defineProperty(onObject, withName, {
value: andValue,
enumerable: false, // This makes the property non-enumerable
writable: true, // Can be modified
configurable: true // Can be deleted or reconfigured
})
}
/** @type {import('./types.d.ts').Icons} */
const icons = catalog
defineUnenumerableProperty({ onObject: icons, withName: 'categories', andValue: categories })
defineUnenumerableProperty({ onObject: icons, withName: 'tags', andValue: tags})
export { icons }