1.6.0 • Published 2 years ago

stretch-font v1.6.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

npm npm GitHub Repo stars

Support

  • 🄶 Freeze text in container
  • 🤩 Watches when elements are added
  • šŸ”„ Hot text replacement (i18n)
  • šŸ–„ Any change in the width and height of the parent element
  • šŸ“± Rotate
  • šŸ“ Multiline
  • āœ… CSS Animation
  • āœ… CSS Transition

See and try... šŸ’«

Installation

npm install stretch-font
yarn add stretch-font

Simple usage

For ES Module

import 'stretch-font/style.css'
import stretchFont from 'stretch-font'

// Run only once if you didn't use "root"
// If you've used root many times, it should be different
stretchFont()

OR for HTML

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/stretch-font/style.min.css">
<script src="https://cdn.jsdelivr.net/npm/stretch-font/stretch-font.min.js"></script>
<script>stretchFont()</script>

Usage

Freeze

<button class="stretch-font">{{ $t("done") }}</button>
...
<span class="stretch-font">{{ $t("message") }}</span>

Stretch X & Y

<div class="SOME_DYNAMICALLY_BLOCK" :style="{ width: x + 'px', height: y + 'px' }">
  <div class="stretch-font" data-stretch>
    {{ $t("message") }}
  </div>
</div>

Link see and try [stretch]

Stretch X

<div class="stretch-font" data-stretch-x>Some text...</div>

Stretch Y

<div class="stretch-font" data-stretch-y>Some text...</div>

Stretch min = n

Link see and try [min / max]

<div class="stretch-font" data-stretch-min="10">
  Font size cannot be less than 10px
</div>

Stretch max = n

<div class="stretch-font" data-stretch-max="20">
  Font size cannot be larger than 20px
</div>

Options

useStretchFont(root, className)

// defaults

root = document
className = "stretch-font"

Mistakes

🚫 Incorrect
<div class="stretch-font" style="font-size: 100px"> ... </div>

āœ… Correct
<div style="font-size: 60px;">
  <div class="stretch-font">
    ...
  </div>
</div>
🚫 Incorrect
<div class="stretch-font fz100">
  ... class fz100 - it's font-size: 100px ...
</div>

āœ… Correct
<div class="fz100">
  <div class="stretch-font">
    ...
  </div>
</div>

License NPM

Distributed under the MIT License. See LICENSE for more information.

1.6.0

2 years ago

1.5.5

2 years ago

1.5.4

2 years ago

1.5.3

2 years ago

1.5.2

2 years ago

1.5.1

2 years ago

1.5.0

2 years ago

1.4.0

2 years ago

1.3.8

2 years ago

1.3.7

2 years ago

1.3.6

2 years ago

1.3.5

2 years ago

1.3.4

2 years ago

1.3.3

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago