npm

abstract-presets
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

abstract-presets

Abstract preset manager.

npm i abstract-presets pnpm add abstract-presets yarn add abstract-presets

Examples

# node
    # view source example/node.ts

    import { add } from 'abstract-presets'
    
    console.log(add(1, 2))
# 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>`

Features

  • 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

API

# AbstractDetail src/abstract-presets.ts#L31

# equals(other) src/abstract-presets.ts#L43
# merge(other) src/abstract-presets.ts#L42
# satisfies(other) src/abstract-presets.ts#L44
# toJSON() src/abstract-presets.ts#L46

    toJSON()  =>

# BasePreset src/abstract-presets.ts#L7
# BasePresets src/abstract-presets.ts#L67
# onceSymbol

    symbol

# selectedPreset src/abstract-presets.ts#L124
# add(item)
# createWithDetail(detail, presetData) src/abstract-presets.ts#L133

    # detail
    # presetData  =  {}

    createWithDetail(detail, presetData)  =>

# createWithDetailData(data, presetData) src/abstract-presets.ts#L137

    # data
    # presetData

    createWithDetailData(data, presetData)  =>

# emit(eventName, args)
# equals(other) src/abstract-presets.ts#L111
# getByDetail(detail) src/abstract-presets.ts#L163
# getById(itemId)
# hasId(itemId)

    # itemId

      string

    hasId(itemId)  =>

      boolean
# insertAfterIndex(index, newItem)
# insertAt(index, newPreset) src/abstract-presets.ts#L175
# mergeEach(data)
# off(eventName, callback)
# on(eventName, callback, options)
# once(eventName, callback)
# removeById(presetId, fallbackPresetId) src/abstract-presets.ts#L182
# renamePresetRandom(presetId, useEmoji) src/abstract-presets.ts#L342

    # presetId

      string

    # useEmoji

      boolean

    renamePresetRandom(presetId, useEmoji)  =>

      void
# restoreSpare(newDetail, bySelect) src/abstract-presets.ts#L141
# savePreset(presetId) src/abstract-presets.ts#L344
# selectPreset(nextPresetId, byClick, newDetail, byGroup) src/abstract-presets.ts#L302
# setById(itemId, newItem)
# setDetailData(newDetailData, bySelect, byIntent, byGroup) src/abstract-presets.ts#L215

    # newDetailData
    # bySelect  =  false

      boolean

    # byIntent  =  false

      boolean

    # byGroup  =  false

      boolean

    setDetailData(newDetailData, bySelect, byIntent, byGroup)  =>

# toJSON() src/abstract-presets.ts#L101

    toJSON()  =>

      any
# updateById(itemId, updateData)
# PresetsGroupDetail src/presets-group-detail.ts#L8
# collectData(sources) src/presets-group-detail.ts#L19
# copy() src/abstract-presets.ts#L50
# equals(other) src/presets-group-detail.ts#L54
# merge(other) src/presets-group-detail.ts#L115
# satisfies(other) src/presets-group-detail.ts#L90
# toJSON() src/presets-group-detail.ts#L13

    toJSON()  =>

      any
# BasePresetsEvents src/abstract-presets.ts#L56

    # select src/abstract-presets.ts#L57

      # (next, prev, nextDetail, prevDetail, byClick, byGroup)

        # next
        # prev
        # nextDetail
        # prevDetail
        # byClick

          undefined | boolean

        # byGroup

          undefined | boolean

        (next, prev, nextDetail, prevDetail, byClick, byGroup)  =>

          void

# PresetsGroupData src/presets-group-detail.ts#L4

Credits

Contributing

Fork or edit and submit a PR.

All contributions are welcome!

License

MIT © 2022 stagas

Readme

Keywords

none

Package Sidebar

Install

npm i abstract-presets

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

297 kB

Total Files

23

Last publish

Collaborators

  • stagas