Abstract preset manager.
npm i abstract-presets
|
pnpm add abstract-presets
|
yarn add abstract-presets
|
# node
# web
# view source
example/web.ts
import { add } from 'abstract-presets'
const main = document.querySelector('main')!
main.innerHTML = `<h1>1 + 2 = ${add(1, 2)}</h1>`
- TypeScript with SWC
- JSX/TSX out of the box
- Outputs both CommonJS and ES Modules, ready to publish on npm
- Automatic dist bundling using bunzee
- Documentation generation using dokio
- Isomorphic Node.js and real browser testing incl. coverage and snapshots with utr
- Examples / Playground using devito
- Evergreen using pull-configs
- ESLint
- dprint
- Husky
# AbstractDetail
src/abstract-presets.ts#L31
# satisfies
(other)
src/abstract-presets.ts#L44
# other
AbstractDetail<T> | T
satisfies(other) =>
- boolean
# BasePreset
src/abstract-presets.ts#L7
# BasePresets
src/abstract-presets.ts#L67
# constructor
(data, Preset, Detail)
src/abstract-presets.ts#L75
# new BasePresets
()
BasePresets<Detail, Preset, PresetClass>
# data
= {}
Partial<BasePresets<Detail, Preset, PresetClass>>
# Preset
= ...
# add
(item)
add(item) =>
-
BasePresets<Detail, Preset, PresetClass> & Partial<BasePresets<Detail, Preset, PresetClass>> & {
}
# createWithDetail
(detail, presetData)
src/abstract-presets.ts#L133
createWithDetail(detail, presetData) =>
# createWithDetailData
(data, presetData)
src/abstract-presets.ts#L137
createWithDetailData(data, presetData) =>
# emit
(eventName, args)
# args
Parameters<BasePresetsEvents<Preset, Detail> [K]>
emit<K>(eventName, args) =>
# insertAfterIndex
(index, newItem)
# index
number
insertAfterIndex(index, newItem) =>
-
BasePresets<Detail, Preset, PresetClass> & Partial<BasePresets<Detail, Preset, PresetClass>> & {
}
# insertAt
(index, newPreset)
src/abstract-presets.ts#L175
# index
number
insertAt(index, newPreset) =>
-
BasePresets<Detail, Preset, PresetClass> & Partial<BasePresets<Detail, Preset, PresetClass>> & {
}
# off
(eventName, callback)
# callback
off<K>(eventName, callback) =>
- undefined | BasePresets<Detail, Preset, PresetClass>
# on
(eventName, callback, options)
# removeById
(presetId, fallbackPresetId)
src/abstract-presets.ts#L182
# presetId
string
# fallbackPresetId
string
removeById(presetId, fallbackPresetId) =>
-
BasePresets<Detail, Preset, PresetClass> & Partial<BasePresets<Detail, Preset, PresetClass>> & {
}
# renamePresetRandom
(presetId, useEmoji)
src/abstract-presets.ts#L342 # restoreSpare
(newDetail, bySelect)
src/abstract-presets.ts#L141
# bySelect
boolean
restoreSpare(newDetail, bySelect) =>
- undefined | BasePresets<Detail, Preset, PresetClass>
# selectPreset
(nextPresetId, byClick, newDetail, byGroup)
src/abstract-presets.ts#L302 # setById
(itemId, newItem)
# itemId
string
setById<U extends BasePreset<Detail, U>>(itemId, newItem) =>
# setDetailData
(newDetailData, bySelect, byIntent, byGroup)
src/abstract-presets.ts#L215 # updateById
(itemId, updateData)
# itemId
string
updateById<U extends BasePreset<Detail, U>>(itemId, updateData) =>
# PresetsGroupDetail
src/presets-group-detail.ts#L8
# applyData
(data)
src/presets-group-detail.ts#L34
# data
applyData(data) =>
- undefined | Map<string, BasePresets<any, BasePreset<any>, Class<BasePreset<any>>>>
# collectData
(sources)
src/presets-group-detail.ts#L19
# sources
Map<string, BasePresets<any, BasePreset<any>, Class<BasePreset<any>>>>
collectData(sources) =>
- any
# PresetsGroupData
src/presets-group-detail.ts#L4
# sources
src/presets-group-detail.ts#L6 Map<string, BasePresets<any, BasePreset<any>, Class<BasePreset<any>>>>
- @stagas/immutable-list by stagas – Immutable list.
- everyday-types by stagas – Everyday utility types
- everyday-utils by stagas – Everyday utilities
All contributions are welcome!