Skip to content

Commit

Permalink
chore: update eslint config and files format
Browse files Browse the repository at this point in the history
  • Loading branch information
abdul-alhasany committed Apr 23, 2024
1 parent c8d7305 commit 12968d1
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 83 deletions.
7 changes: 0 additions & 7 deletions .eslintrc.cjs

This file was deleted.

90 changes: 53 additions & 37 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -1,83 +1,99 @@
import { defineConfig } from 'vitepress'
import { defineConfig } from 'vitepress';

// https://vitepress.dev/reference/site-config
export default defineConfig({
title: "Documentation",
description: "Documentation for VuePopper Dashboard",
base: "/docs/",
title: 'Documentation',
description: 'Documentation for VuePopper Dashboard',
base: '/docs/',
themeConfig: {
logo: './logo.svg',
siteTitle: "VuePopper",
siteTitle: 'VuePopper',
outline: 'deep',
socialLinks: [
{ icon: 'github', link: 'https://github.com/kalimah-apps' },
{ icon: 'twitter', link: 'https://twitter.com/KalimahApps' },
{
icon: 'github',
link: 'https://github.com/kalimah-apps',
},
{
icon: 'twitter',
link: 'https://twitter.com/KalimahApps',
},
],
nav: [
{ text: "Guide", link: "/guide/overview" },
{ text: "Changelog", link: "/changelog" },
{ text: "Links", link: "/links" },
{
text: 'Guide',
link: '/guide/overview',
},
{
text: 'Changelog',
link: '/changelog',
},
{
text: 'Links',
link: '/links',
},
],
sidebar: [
{
text: "Getting started",
text: 'Getting started',
collapsable: false,
items: [
{
text: "Overview",
link: "/guide/overview",
}, {
text: "Installation",
link: "/guide/installation",
text: 'Overview',
link: '/guide/overview',
},
{
text: "Usage",
link: "/guide/usage",
text: 'Installation',
link: '/guide/installation',
},
{
text: 'Usage',
link: '/guide/usage',
items:
[
{
text: "Component",
link: "/guide/usage/component",
text: 'Component',
link: '/guide/usage/component',
},
{
text: "Composition API",
link: "/guide/usage/composition-api",
}
]
text: 'Composition API',
link: '/guide/usage/composition-api',
},
],

},
{
text: "Defaults",
link: "/guide/defaults",
text: 'Defaults',
link: '/guide/defaults',
},

],
},
{
text: "API",
text: 'API',
collapsable: false,
items: [
{
text: "Props & options",
link: "/guide/props-options",
text: 'Props & options',
link: '/guide/props-options',
},
{
text: "Events",
link: "/guide/events",
text: 'Events',
link: '/guide/events',
},
{
text: "Slots",
link: "/guide/slots",
text: 'Slots',
link: '/guide/slots',
},
{
text: "Styling",
link: "/guide/styling",
text: 'Styling',
link: '/guide/styling',
},
],
}
},
],
footer: {
message: "Released under the MIT License.",
message: 'Released under the MIT License.',
},
},
});
8 changes: 5 additions & 3 deletions docs/.vitepress/theme/VuePopper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,22 @@
<template #content>
<div>
<div class="tooltip-text">
<slot name="default"> Hi, from vue-popper! 🍿</slot>
<slot name="default">
Hi, from vue-popper! 🍿
</slot>
</div>
</div>
</template>
</VuePopperComponent>
</template>

<script setup lang="ts">
import VuePopperComponent from "@kalimahapps/vue-popper";
import VuePopperComponent from '@kalimahapps/vue-popper';
defineProps({
text: {
type: String,
default: "Button",
default: 'Button',
},
});
</script>
Expand Down
12 changes: 6 additions & 6 deletions docs/.vitepress/theme/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import DefaultTheme from 'vitepress/theme'
import DefaultTheme from 'vitepress/theme';
import VuePopper from './VuePopper.vue';

import './custom.css';

export default {
...DefaultTheme,
enhanceApp(ctx) {
DefaultTheme.enhanceApp(ctx)
ctx.app.component('VuePopper', VuePopper)
}
}
enhanceApp(context) {
DefaultTheme.enhanceApp(context);
context.app.component('VuePopper', VuePopper);
},
};
4 changes: 2 additions & 2 deletions docs/components/VuePopperAnimations.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<template>
<div class="grid">
<VuePopper v-for="animation in animations" :text="animation" :animation="animation"/>
<VuePopper v-for="animation in animations" :text="animation" :animation="animation" />
</div>
</template>

<script setup lang="ts">
const animations = ["none", "fade", "shift-in", "shift-out", "scale"];
const animations = ['none', 'fade', 'shift-in', 'shift-out', 'scale'];
</script>

<style scoped>
Expand Down
2 changes: 1 addition & 1 deletion docs/components/VuePopperAnimationsDuration.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</template>

<script setup lang="ts">
const animations = ["fade", "shift-in", "shift-out", "scale"];
const animations = ['fade', 'shift-in', 'shift-out', 'scale'];
const durations = [
[0, 200],
[300, 1000],
Expand Down
2 changes: 2 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import eslintConfig from '@kalimahapps/eslint-config';
export default [...eslintConfig];
26 changes: 13 additions & 13 deletions src/VuePopper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { computed } from 'vue';
import type { PositioningStrategy, Placement, Modifier } from '@popperjs/core';
import { useVuePopper } from './composable';
const props = defineProps({
const properties = defineProps({
/**
* Trigger element on hover
*/
Expand Down Expand Up @@ -150,22 +150,22 @@ const props = defineProps({
const emit = defineEmits(['opened', 'closed', 'transition']);
// Deprecate popperOptions in favor of multiple props
if (Object.keys(props.popperOptions).length > 0) {
if (Object.keys(properties.popperOptions).length > 0) {
console.warn('@kalimahapps/vue-popper: popperOptions is deprecated. Use the individual props instead.');
}
const { popperInstance, triggerElement, tooltipElement, isOpened, toggleTooltip } = useVuePopper({
hover: props.hover,
disableClickOutside: props.disableClickOutside,
openDelay: props.openDelay,
closeDelay: props.closeDelay,
showArrow: props.showArrow,
strategy: props.strategy,
modifiers: props.modifiers,
animation: props.animation,
placement: props.placement,
interactive: props.interactive,
animationDuration: props.animationDuration,
hover: properties.hover,
disableClickOutside: properties.disableClickOutside,
openDelay: properties.openDelay,
closeDelay: properties.closeDelay,
showArrow: properties.showArrow,
strategy: properties.strategy,
modifiers: properties.modifiers,
animation: properties.animation,
placement: properties.placement,
interactive: properties.interactive,
animationDuration: properties.animationDuration,
onTransition: (transition: string, element: HTMLElement) => {
emit('transition', transition, element);
Expand Down
22 changes: 11 additions & 11 deletions src/composable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ const popperDefaultOptions = {
/**
* Generate a css text from style object
*
* @param {object} style List of style properties
* @param {object} extra Extra style properties
* @return {string} Css string
* @param {object} style List of style properties
* @param {object} extra Extra style properties
* @returns {string} Css string
*/
const createCssText = function (style: object = {}, extra: object = {}): string {
const combined = {
Expand Down Expand Up @@ -253,11 +253,11 @@ const useVuePopper = function (suppliedOptions: Options = {}) {
/**
* Build trigger element
*
* @param {object} props Props passed to the component
* @param {SetupContext} context Context passed to the component
* @return {VNode} Trigger element
* @param {object} props Props passed to the component
* @param {SetupContext} context Context passed to the component
* @returns {VNode} Trigger element
*/
const triggerElement = function (props: object, context: SetupContext): VNode {
const triggerElement = function (properties: object, context: SetupContext): VNode {
const { slots } = context;
return h('div',
{
Expand Down Expand Up @@ -383,11 +383,11 @@ const useVuePopper = function (suppliedOptions: Options = {}) {
/**
* Build tooltip element
*
* @param {object} props Props passed to the component
* @param {SetupContext} context Context passed to the component
* @return {VNode} Tooltip element
* @param {object} props Props passed to the component
* @param {SetupContext} context Context passed to the component
* @returns {VNode} Tooltip element
*/
const tooltipElement = function (props: object, context: SetupContext): VNode {
const tooltipElement = function (properties: object, context: SetupContext): VNode {
const { slots } = context;
return h(Transition,
{ name: getTransitionNames.value.outer },
Expand Down
6 changes: 3 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
test: {
globals: true,
environment: 'jsdom',
}
},
});

0 comments on commit 12968d1

Please sign in to comment.