-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jakub Freisler <jakub@frsource.org>
- Loading branch information
Showing
15 changed files
with
6,961 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
|
||
[*.{js,json,yml}] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
dist | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
module.exports = { | ||
root: true, | ||
plugins: [ | ||
'@typescript-eslint', | ||
'eslint-comments' | ||
], | ||
env: { | ||
es6: true, | ||
node: true | ||
}, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:eslint-comments/recommended', | ||
'prettier' | ||
], | ||
overrides: [ | ||
{ | ||
files: ['**.ts'], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
sourceType: 'module', | ||
project: [ | ||
'./tsconfig.json', | ||
'./packages/*/tsconfig.json', | ||
], | ||
tsconfigRootDir: __dirname, | ||
warnOnUnsupportedTypeScriptVersion: false, | ||
EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true, | ||
}, | ||
rules: { | ||
'@typescript-eslint/explicit-module-boundary-types': 'off' | ||
} | ||
}, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# These are supported funding model platforms | ||
|
||
github: [FRSOURCE] | ||
patreon: frsource | ||
custom: ['https://www.buymeacoffee.com/FRSOURCE'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
name: Bug report | ||
about: Create a report to help us improve | ||
title: '' | ||
labels: bug | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Describe the bug** | ||
A clear and concise description of what the bug is. | ||
|
||
**To Reproduce** | ||
Steps to reproduce the behavior: | ||
1. Go to '...' | ||
2. Click on '....' | ||
3. Scroll down to '....' | ||
4. See error | ||
|
||
**Expected behavior** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**Screenshots** | ||
If applicable, add screenshots to help explain your problem. | ||
|
||
**Please complete the following information:** | ||
- OS and version: [e.g. Windows 10 build. 19043.1319] | ||
- Browser and version [e.g. chrome 22] | ||
|
||
**Additional context** | ||
Add any other context about the problem here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea for this project | ||
title: '' | ||
labels: enhancement | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] | ||
|
||
**Describe the solution you'd like** | ||
A clear and concise description of what you want to happen. | ||
|
||
**Describe alternatives you've considered** | ||
A clear and concise description of any alternative solutions or features you've considered. | ||
|
||
**Additional context** | ||
Add any other context or screenshots about the feature request here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "npm" | ||
directory: "/" | ||
schedule: | ||
interval: "monthly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
name: Lint | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
cache: | ||
name: CI cache | ||
runs-on: ubuntu-latest | ||
outputs: | ||
yarn-cache-key: ${{ steps.yarn-cache-key.outputs.key }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16.x' | ||
- name: Remove git auth | ||
run: git config --unset http.https://github.com/.extraheader | ||
- name: Generate yarn cache-key | ||
id: yarn-cache-key | ||
run: echo "::set-output name=key::${{ runner.os }}-yarn-ci-cache-v3-${{ hashFiles('./yarn.lock') }}-${{ hashFiles('**/yarn.lock') }}" | ||
- name: Configure Yarn cache | ||
uses: actions/cache@v2 | ||
with: | ||
key: ${{ steps.yarn-cache-key.outputs.key }} | ||
path: | | ||
.yarn | ||
node_modules | ||
- name: Install dependencies | ||
run: yarn --immutable | ||
|
||
lint: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
needs: cache | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16.x' | ||
- name: remove git auth | ||
run: git config --unset http.https://github.com/.extraheader | ||
- name: Configure Yarn cache | ||
uses: actions/cache@v2 | ||
with: | ||
key: ${{ needs.cache.outputs.yarn-cache-key }} | ||
path: | | ||
.yarn | ||
node_modules | ||
- name: Install dependencies | ||
run: yarn --immutable | ||
- name: Lint | ||
run: yarn lint:ci | ||
- name: Prettify | ||
run: yarn prettify:ci | ||
|
||
build-and-release: | ||
name: build and release | ||
runs-on: ubuntu-latest | ||
needs: [cache, lint] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
# pulls all commits (needed for lerna / semantic release to correctly version) | ||
fetch-depth: "0" | ||
- name: Setup git user | ||
run: | | ||
git config --global user.name "$(git --no-pager log --format=format:'%an' -n 1)" | ||
git config --global user.email "$(git --no-pager log --format=format:'%ae' -n 1)" | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16.x' | ||
- name: remove git auth | ||
run: git config --unset http.https://github.com/.extraheader | ||
- name: Configure Yarn cache | ||
uses: actions/cache@v2 | ||
with: | ||
key: ${{ needs.cache.outputs.yarn-cache-key }} | ||
path: | | ||
.yarn | ||
node_modules | ||
- name: Install dependencies | ||
run: yarn --immutable | ||
- name: Authenticate with Registry | ||
run: | | ||
echo "registry=http://registry.npmjs.org/" >> .npmrc | ||
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc | ||
npm whoami | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
- name: build | ||
run: yarn build | ||
- name: release package | ||
if: ${{ success() && github.actor != 'dependabot[bot]' && github.ref == 'refs/heads/main' && github.event_name == 'push' }} | ||
run: yarn release:ci | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
NPM_CONFIG_REGISTRY: https://registry.npmjs.org/ | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,77 @@ | ||
# autoresize-textarea | ||
Minimalistic plugin to autosize your textareas 💪 | ||
<p align="center"> | ||
<a href="https://www.npmjs.com/package/@frsource/autoresize-textarea"> | ||
<img src="https://img.shields.io/npm/v/@frsource/autoresize-textarea" alt="NPM version badge"> | ||
</a> | ||
<a href="https://bundlephobia.com/result?p=@frsource/autoresize-textarea" title="Visit bundlephobia for more details!"> | ||
<img src="https://img.shields.io/bundlephobia/minzip/@frsource/autoresize-textarea" alt="Core bundle size badge. Data from bundlephobia.com"> | ||
</a> | ||
<a href="https://github.com/semantic-release/semantic-release"> | ||
<img src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg" alt="semantic-relase badge"> | ||
</a> | ||
<a href="https://bundlephobia.com/result?p=@frsource/autoresize-textarea"> | ||
<img src="https://badgen.net/bundlephobia/tree-shaking/@frsource/autoresize-textarea" alt="Tree shaking supported"> | ||
</a> | ||
<a href="https://github.com/FRSOURCE/autoresize-textarea/blob/master/LICENSE"> | ||
<img src="https://img.shields.io/github/license/FRSOURCE/autoresize-textarea" alt="license MIT badge"> | ||
</a> | ||
</p> | ||
|
||
<h1 align="center">Autoresize Textarea - minimalistic plugin to autosize your textareas! 💪</h1> | ||
|
||
<p align="center"> | ||
<a href="#quick-start">Getting Started</a> | ||
· | ||
<a href="https://www.frsource.org/autoresize-textarea" target="_blank">Demo</a> | ||
. | ||
<a href="#contribution">Contribution</a> | ||
· | ||
<a href="https://github.com/FRSOURCE/autoresize-textarea/issues">File an Issue</a> | ||
· | ||
<a href="#questions">Have a question or an idea?</a> | ||
<br> | ||
</p> | ||
|
||
<p align="center"> | ||
<br> | ||
<i>Tiny library which make your textareas fluid. | ||
<br>Mobile & desktop-friendly | ||
<br>Performant & small bundle size. | ||
<br>Published as separate bundles for JS ES5 or modern browsers thanks to <a href="https://www.npmjs.com/package/microbundle">microbundle</a>. | ||
<br>Written completely in <a href="https://www.typescriptlang.org">typescript</a>.</i> | ||
<br>Published under [MIT](https://opensource.org/licenses/MIT) license.</i> | ||
<br> | ||
<br> | ||
</p> | ||
|
||
## Quick start | ||
|
||
### ES/Typescript | ||
|
||
```ts | ||
import { attach } from "@frsource/autoresize-textarea"; | ||
const textarea = document.querySelector("textarea"); | ||
attach(textarea); | ||
``` | ||
|
||
### UMD | ||
|
||
```js | ||
const textarea = document.querySelector("textarea"); | ||
window.autoresizeTextarea.attach(textarea); | ||
``` | ||
|
||
For working example, check out [our demo](https://www.frsource.org/autoresize-textarea). | ||
|
||
## Questions | ||
|
||
Don’t hesitate to ask a question directly on the [discussions board](https://github.com/FRSOURCE/autoresize-textarea/discussions)! | ||
|
||
## Changelog | ||
|
||
Changes for every release are documented in the [release notes](https://github.com/FRSOURCE/autoresize-textarea/releases) and [CHANGELOG file](https://github.com/FRSOURCE/autoresize-textarea/tree/master/CHANGELOG.md). | ||
|
||
## License | ||
|
||
[MIT](https://opensource.org/licenses/MIT) | ||
|
||
Copyright (c) 2022-present, Jakub FRS Freisler, FRSOURCE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<html lang="en"> | ||
<head> | ||
<link rel="stylesheet" href="https://unpkg.com/@picocss/pico@latest/css/pico.classless.min.css"> | ||
<style> | ||
textarea { | ||
resize: vertical; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<main> | ||
<section> | ||
<hgroup> | ||
<h1>@frsource/autoresize-textarea</h1> | ||
<h2>Minimalistic plugin to autosize your textareas! 💪</h2> | ||
</hgroup> | ||
<article> | ||
<hgroup> | ||
<h4>Autoresizing, fluid textarea demo</h4> | ||
<h5>Try adding new lines to textarea below</h5> | ||
</hgroup> | ||
<form> | ||
<label> | ||
<textarea rows="1">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec eleifend commodo interdum. Donec tincidunt consequat semper. Nulla id magna viverra, egestas est sit amet, lacinia felis. Donec ut mauris nunc. Vivamus ex sem, tempor ac felis ut, congue laoreet lectus. Etiam urna augue, iaculis in metus eu, pharetra lobortis tortor.</textarea> | ||
</label> | ||
</form> | ||
|
||
<details open> | ||
<summary>ES/TS code example</summary> | ||
<pre><code><<b>textarea</b> <i>row</i>=<u>"2"</u>><span style="white-space: normal;">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec eleifend commodo interdum. Donec tincidunt consequat semper. Nulla id magna viverra, egestas est sit amet, lacinia felis. Donec ut mauris nunc. Vivamus ex sem, tempor ac felis ut, congue laoreet lectus. Etiam urna augue, iaculis in metus eu, pharetra lobortis tortor.</span></<b>textarea</b>> | ||
|
||
<<b>script</b>> | ||
<b>import</b> { attach } <b>from</b> <u>"@frsource/autoresize-textarea"</u>; | ||
<b>const</b> textarea = document.<i>querySelector</i>(<u>"textarea"</u>); | ||
attach(textarea); | ||
</<b>script</b>></code></pre> | ||
</details> | ||
|
||
<details> | ||
<summary>UMD code example</summary> | ||
<pre><code><<b>textarea</b> <i>row</i>=<u>"2"</u>><span style="white-space: normal;">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec eleifend commodo interdum. Donec tincidunt consequat semper. Nulla id magna viverra, egestas est sit amet, lacinia felis. Donec ut mauris nunc. Vivamus ex sem, tempor ac felis ut, congue laoreet lectus. Etiam urna augue, iaculis in metus eu, pharetra lobortis tortor.</span></<b>textarea</b>> | ||
|
||
<<b>script</b>> | ||
<b>const</b> textarea = document.<i>querySelector</i>(<u>"textarea"</u>); | ||
window.autoresizeTextarea.<i>attach</i>(textarea); | ||
</<b>script</b>></code></pre> | ||
</details> | ||
</article> | ||
</section> | ||
</main> | ||
<script src="https://unpkg.com/@frsource/autoresize-textarea"></script> | ||
<script src="../dist/index.umd.js"></script> | ||
<script> | ||
const textarea = document.querySelector("textarea"); | ||
window.autoresizeTextarea.attach(textarea); | ||
</script> | ||
</body> | ||
</html> |
Oops, something went wrong.