1.0.0 • Published 3 years ago

@eatsjobs/type-writer v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Typewriter web component

a type-writer web component

type-writer

npm i @eatsjobs/type-writer
import '@eatsjobs/type-writer'

or

<script type="module">
  import 'node_modules/@eatsjobs/type-writer';
</script>
  <type-writer
      style="
        --playground-background: #282a36;
        --text-color: #50fa7b;
        --font-family: Special Elite, cursive;
        --font-size: 2.5rem;
        --cursor-width: 1.5rem;
        --cursor-height: 0.5rem;
      "
      autostart
      linebreakdelay='1000'
      typingdelay='75'      
    >
      Hello I'm @eatsjobs.
      This is a type-writer web component
      To style it you have some css variables:
        --text-color
      --playground-background
      --font-family
      --font-size
      --cursor-width
      --cursor-height
      You also have some attributes and properties to be able to interact with:
      - linebreakdelay
      - typingdelay
      - autostart
      And also some methods to stop, restart, pause and resume the typewriting.
  </type-writer>

Documentation

Attributes

AttributeTypeDescription
autostartBooleanstart on mount
linebreakdelayNumberthe delay between after linebreak \n
typingdelayNumberthe delay between each word in ms

Properties

PropertyType
autoStartboolean
lineBreakDelaynumber
typingDelaynumber

Methods

MethodType
clean(): void
createLetterGenerator(): Generator<string, string, unknown>
pause(): Promise<void>
restart(): Promise<void \| null>
resume(): void
start(): Promise<void \| null>
stop(): Promise<void>

Events

EventTypeDescription
doneCustomEvent<any>Dispatched when type-writing naturally finish

CSS Custom Properties

PropertyDescription
--cursor-heightthe height of the cursor;
--cursor-widththe width of the cursor
--font-familyfont-family
--font-sizefont-size
--playground-backgroundthe background of the container
--text-colorthe color of the text