npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@octarin/lotion

v0.1.2

Published

<h1 align="center"><b>🧴 Lotion</b></h1> <p align="center"> An open-source Notion UI built with Vue 3. </p> <p align="center"> <a href="https://lotion.dashibase.com" target="_blank">Try demo</a> </p> <p align="center"> <a href="https://twitter.com/d

Downloads

4

Readme

We shared about Lotion and recreating the Notion UI during CityJS Singapore's pre-conference meetup on 27th July!

Features

  • [x] Block-based editor
  • [x] Drag to reorder blocks
  • [x] Basic Markdown-parsing including bold, italic, headings and divider
  • [x] Type '/' for command menu and shortcuts
  • [x] Register your own blocks
  • [x] Read-only mode

Getting Started

1. Install package

npm i @dashibase/lotion

2. Basic Lotion editor

The following Vue component will initialize a basic Lotion editor.

<template>
  <Lotion :page="page" />
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { v4 as uuidv4 } from 'uuid'
import { Lotion, registerBlock } from '@dashibase/lotion'

const page = ref({
  name: '🧴 Lotion',
  blocks:[{
    id: uuidv4(),
    type: 'TEXT',
    details: {
      value: 'Hello, World!'
    },
  }],
})
</script>

3. Create custom components

See examples/CustomBlock.vue for an example of a custom block.

The custom block component can accept the following props:

  • block: A Block object. See src/utils/types.ts for details.
  • readonly: A boolean, which sets whether the block/editor is in read-only mode.

The custom block component can also optionally expose the following methods (remember to call defineExpose):

  • onSet: This is triggered when a user converts any block into this blocktype. It is called before the blocktype is changed.
  • onUnset: This is triggered when a user converts this block into any blocktype. It is called before the blocktype is changed.
<template>
  <div>
    🧴
  </div>
</template>
<script setup lang="ts">
import { PropType } from 'vue'
import { types } from '../src'

const props = defineProps({
  block: {
    type: Object as PropType<types.Block>,
    required: true,
  },
  readonly: {
    type: Boolean,
    default: false,
  },
})

function onSet () {
  alert('Moisturizing...')
}

function onUnset () {
  alert('Moisturized!')
}

defineExpose({
  onSet,
  onUnset,
})
</script>

4. Register custom components

See examples/Example.vue for an example of registering a custom block.

After creating the custom component, register it as follows:

import CustomBlock from './CustomBlock.vue'
import { addIcons } from "oh-vue-icons"
import { FaPumpSoap } from "oh-vue-icons/icons"
import { registerBlock } from '@dashibase/lotion'

// Add the icon (from oh-vue-icons.js.org/)
addIcons(FaPumpSoap)
// Register the block
// registerBlock('<BLOCK_TYPE_ID>', '<BLOCK_TYPE_LABEL>', <BLOCK_COMPONENT>, 'BLOCK_ICON')
registerBlock('LOTION', 'Moisturize', CustomBlock, 'fa-pump-soap')
</script>

After that, you should be able to see the custom block when the user opens the menu to switch to different blocks.

Contributing

1. Clone this repository, go to the root directory and install packages

git clone https://github.com/dashibase/lotion
cd lotion
npm i

2. Run dev

npm run dev

If you head to http://localhost:5173 on your browser, you should see what looks like the screenshot above.

3. Contribute!

Lotion is quite limited for now but we hope it serves as a good starting point for other folks looking to build their own editors.

We would love to make Lotion more extensible and welcome any suggestions or contributions!

See CONTRIBUTING.md for details.

Acknowledgements

This was made much easier with the following libraries and frameworks, thank you!