Skip to content

Commit

Permalink
initial commit with 0.1.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
dgknca committed Sep 29, 2021
0 parents commit b70b2e2
Show file tree
Hide file tree
Showing 21 changed files with 2,532 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# don't ever lint node_modules
node_modules
# don't lint build output (make sure it's set to your correct build folder name)
dist
19 changes: 19 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
root: true,
// https://eslint.org/docs/rules/no-undef#nodejs
env: {
node: true,
},
parser: 'vue-eslint-parser',
// https://github.com/vuejs/vue-eslint-parser#parseroptionsparser
parserOptions: {
parser: '@typescript-eslint/parser',
},
plugins: ['@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:vue/vue3-recommended',
'prettier',
],
}
121 changes: 121 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test
.env.production

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

# Project
dist-ssr
*.local
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ignore artifacts:
dist
5 changes: 5 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
semi: false,
singleQuote: true,
trailingComma: 'es5',
}
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["johnsoncodehk.volar"]
}
12 changes: 12 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021-present, Doğukan Çavuş (https://github.com/dgknca/v-collapse-it)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
116 changes: 116 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# v-collapse-it

A super simple Vue directive to expand/collapse elements.

## Install

```bash
yarn add v-collapse-it
```

## Browser

```html
<!-- From CDN -->
<script src="https://unpkg.com/[email protected]/dist/v-collapse-it.umd.js"></script>
```

## Demo

[Codepen](https://codepen.io/dgknca/pen/JjJwYgo) | [Codesandbox Accordion Example](https://codesandbox.io/s/v-collapse-it-accordion-example-1tzb9)

## Options

| Option | Type | Default | Description |
| --------- | -------- | ---------------- | -------------------------------------------------------------------- |
| directive | string | 'collapse' | Name of the directive (v-collapse). |
| speed | number | 300 | Transition duration in miliseconds. |
| collapsed | boolean | false | Collapse state of elements used the directive. |
| ease | **Ease** | 'easeInOutCubic' | A string indicating which easing function to use for the transition. |

#### Ease Type

```ts
export type Ease =
| 'linear'
| 'easeInQuad'
| 'easeOutQuad'
| 'easeInOutQuad'
| 'easeInCubic'
| 'easeOutCubic'
| 'easeInOutCubic'
| 'easeInQuart'
| 'easeOutQuart'
| 'easeInOutQuart'
| 'easeInQuint'
| 'easeOutQuint'
| 'easeInOutQuint'
```
## Usage
Import the plugin in your main.js file
```js
import VCollapse from 'v-collapse-it'

const app = createApp(App)
// use the plugin
app.use(VCollapse)
// or you can set your default options
app.use(VCollapse, {
speed: 500,
})
app.mount('#app')
```

Example usage:

```vue
<template>
<div>
<!-- you can directly use a single boolean value like this -->
<div v-collapse="isCollapsed" class="box"></div>
<!-- or use an object witrh available configs -->
<div
v-collapse="{
speed: 1000,
collapsed: isCollapsed,
}"
class="box"
></div>
<button @click="toggle">toggle</button>
</div>
</template>
<script>
import { ref } from 'vue'
export default {
setup() {
const isCollapsed = ref(false)
const toggle = () => {
isCollapsed.value = !isCollapsed.value
}
return {
isCollapsed,
toggle,
}
},
}
</script>
<style scoped>
.box {
height: 300px;
width: 300px;
background: pink;
padding: 50px;
margin: 50px;
}
</style>
```
1 change: 1 addition & 0 deletions dist/v-collapse-it.es.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/v-collapse-it.umd.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
36 changes: 36 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "v-collapse-it",
"version": "0.1.0",
"scripts": {
"dev": "vite",
"build": "vue-tsc --noEmit && vite build",
"serve": "vite preview",
"format": "prettier --write .",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx,.vue",
"lint-fix": "eslint --fix . --ext .js,.jsx,.ts,.tsx,.vue"
},
"main": "./dist/v-collapse-it.umd.js",
"module": "./dist/v-collapse-it.es.js",
"exports": {
".": {
"import": "./dist/v-collapse-it.es.js",
"require": "./dist/v-collapse-it.umd.js"
}
},
"devDependencies": {
"@types/node": "^16.10.1",
"@typescript-eslint/eslint-plugin": "^4.31.2",
"@typescript-eslint/parser": "^4.31.2",
"@vitejs/plugin-vue": "^1.9.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-vue": "^7.18.0",
"prettier": "^2.4.1",
"typescript": "^4.4.3",
"vite": "^2.5.10",
"vite-plugin-eslint": "^1.3.0",
"vue": "^3.2.13",
"vue-eslint-parser": "^7.11.0",
"vue-tsc": "^0.3.0"
}
}
8 changes: 8 additions & 0 deletions src/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/// <reference types="vite/client" />

declare module '*.vue' {
import { DefineComponent } from 'vue'
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
const component: DefineComponent<{}, {}, any>
export default component
}
Loading

0 comments on commit b70b2e2

Please sign in to comment.