Skip to content

Commit

Permalink
#268 - export types (#269)
Browse files Browse the repository at this point in the history
* refactor: refactored types and exported public types

* refactor: added consistent type imports

* chore(deps): updated dependencies

* chore: incremented version

* fix: ensure consitent type path

* refactor: rename folder symbol

* refactor: renamed folder symbols

* refactor: removed redundant paths to components in tests
  • Loading branch information
nandi95 authored Jul 23, 2021
1 parent 533ed51 commit 7b273b0
Show file tree
Hide file tree
Showing 69 changed files with 527 additions and 564 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ module.exports = {
'@typescript-eslint/func-call-spacing': ['error', 'never'],
'@typescript-eslint/comma-spacing': 'warn',
'@typescript-eslint/keyword-spacing': 'warn',
// '@typescript-eslint/consistent-indexed-object-style': ['error', 'record'], // waiting on dependency updates
// '@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }],
'@typescript-eslint/consistent-indexed-object-style': ['error', 'record'],
'@typescript-eslint/consistent-type-imports': ['error', { prefer: 'type-imports' }],
'@typescript-eslint/member-delimiter-style': 'warn',
'@typescript-eslint/type-annotation-spacing': 'warn',
'@typescript-eslint/naming-convention': [
Expand Down
2 changes: 1 addition & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { pathsToModuleNameMapper } from 'ts-jest/utils';
import { compilerOptions } from './tsconfig.json';
import { InitialOptionsTsJest } from 'ts-jest/dist/types';
import type { InitialOptionsTsJest } from 'ts-jest/dist/types';

export default {
clearMocks: true,
Expand Down
818 changes: 385 additions & 433 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@karnama/vueish",
"version": "0.6.0",
"version": "0.6.1",
"files": [
"dist",
"types"
Expand Down
8 changes: 4 additions & 4 deletions src/DemoBoard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@

<script lang="ts">
import { computed, defineComponent, getCurrentInstance, ref, watch } from 'vue';
import UIToggle from '@components/toggle/UIToggle.vue';
import LocalCache from '@helpers/cache/LocalCache';
import { Router, RouteRecord } from 'vue-router';
import UIButton from '@components/button/UIButton.vue';
import UIToggle from 'components/toggle/UIToggle.vue';
import LocalCache from '@/helpers/cache/LocalCache';
import type { Router, RouteRecord } from 'vue-router';
import UIButton from 'components/button/UIButton.vue';
import { getIcon } from '@/helpers';
import { getVersion } from '@/main';
Expand Down
2 changes: 1 addition & 1 deletion src/components/avatar/Demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

<script lang="ts">
import { defineComponent } from 'vue';
import type { Avatar } from '@/types';
import type { Avatar } from 'types';
export default defineComponent({
name: 'Avatar',
Expand Down
2 changes: 1 addition & 1 deletion src/components/avatar/UIAvatar.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { mount } from '@vue/test-utils';
import UIAvatar from '@components/avatar/UIAvatar.vue';
import UIAvatar from './UIAvatar.vue';

describe('UIAvatar', () => {
it('should correctly display', () => {
Expand Down
6 changes: 3 additions & 3 deletions src/components/avatar/UIAvatarGroup.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { mount } from '@vue/test-utils';
import UIAvatarGroup from '@components/avatar/UIAvatarGroup.vue';
import { Avatar } from '@/types';
import UIAvatar from '@components/avatar/UIAvatar.vue';
import UIAvatarGroup from './UIAvatarGroup.vue';
import type { Avatar } from 'types';
import UIAvatar from './UIAvatar.vue';

const avatars: Avatar[] = [
{},
Expand Down
4 changes: 2 additions & 2 deletions src/components/avatar/UIAvatarGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
<script lang="ts">
import { computed, defineComponent } from 'vue';
import type { PropType, VNode } from 'vue';
import UIAvatar from '@components/avatar/UIAvatar.vue';
import type { Avatar } from '@/types';
import UIAvatar from 'components/avatar/UIAvatar.vue';
import type { Avatar } from 'types';
import { omit } from 'lodash-es';
export default defineComponent({
Expand Down
2 changes: 1 addition & 1 deletion src/components/badge/Demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

<script lang="ts">
import { defineComponent } from 'vue';
import { horizontal, vertical } from '@/types';
import { horizontal, vertical } from 'types';
export default defineComponent({
name: 'Badge',
Expand Down
2 changes: 1 addition & 1 deletion src/components/badge/UIBadge.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { mount } from '@vue/test-utils';
import UIBadge from '@components/badge/UIBadge.vue';
import UIBadge from './UIBadge.vue';

describe('UIBadge', () => {
it('should correctly display', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/badge/UIBadge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<script lang="ts">
import { defineComponent, computed, ref } from 'vue';
import type { PropType } from 'vue';
import { horizontal, vertical } from '@/types';
import { horizontal, vertical } from 'types';
export default defineComponent({
name: 'UIBadge',
Expand Down
2 changes: 1 addition & 1 deletion src/components/button-toggle/Demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

<script lang="ts">
import { defineComponent, ref } from 'vue';
import type { Option } from '@/types';
import type { Option } from 'types';
export default defineComponent({
name: 'ButtonToggle',
Expand Down
2 changes: 1 addition & 1 deletion src/components/button-toggle/UIButtonToggle.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { mount } from '@vue/test-utils';
import UIButtonToggle from './UIButtonToggle.vue';
import type { Option } from '@/types';
import type { Option } from 'types';

const options: Record<string, any>[] = [
{ label: 'Places', value: 'places' },
Expand Down
11 changes: 6 additions & 5 deletions src/components/button-toggle/UIButtonToggle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@
<script lang="ts">
import { defineComponent, watch } from 'vue';
import type { PropType } from 'vue';
import UIButtonGroup, { props } from '@components/button-group/UIButtonGroup.vue';
import { large, category } from '@composables/style';
import { useVModel, disabled, clearable } from '@composables/input';
import UIButton from '@components/button/UIButton.vue';
import UIButtonGroup, { props } from 'components/button-group/UIButtonGroup.vue';
import { large, category } from 'composables/style';
import { useVModel, disabled, clearable } from 'composables/input';
import UIButton from 'components/button/UIButton.vue';
import { isEqual, uniq } from 'lodash-es';
import type { MaybeArray, Option } from '@/types';
import type { MaybeArray } from 'types/utilities';
import type { Option } from 'types';
import { wrap } from '@/helpers';
export default defineComponent({
Expand Down
2 changes: 1 addition & 1 deletion src/components/button/Demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

<script lang="ts">
import { defineComponent, ref } from 'vue';
import { styleTypes } from '@/types';
import { styleTypes } from 'types';
export default defineComponent({
// eslint-disable-next-line vue/no-reserved-component-names
Expand Down
2 changes: 1 addition & 1 deletion src/components/button/UIButton.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { mount } from '@vue/test-utils';
import UIButton from './UIButton.vue';
import { styleTypes } from '@/types';
import { styleTypes } from 'types';

describe('UIButton', () => {
it('should render correctly', async () => {
Expand Down
10 changes: 5 additions & 5 deletions src/components/button/UIButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@

<script lang="ts">
import { computed, defineComponent } from 'vue';
import type { StyleType } from '@/types';
import { category, large } from '@composables/style';
import { label, disabled } from '@composables/input';
import UISpinnerLoader from '@components/loader-spinner/UISpinnerLoader.vue';
import UIFadeTransition from '@components/transitions/UIFadeTransition.vue';
import type { StyleType } from 'types';
import { category, large } from 'composables/style';
import { label, disabled } from 'composables/input';
import UISpinnerLoader from 'components/loader-spinner/UISpinnerLoader.vue';
import UIFadeTransition from 'components/transitions/UIFadeTransition.vue';
export default defineComponent({
name: 'UIButton',
Expand Down
4 changes: 2 additions & 2 deletions src/components/checkbox/UICheckbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@

<script lang="ts">
import { computed, defineComponent } from 'vue';
import { label, disabled, name, error } from '@composables/input';
import { label, disabled, name, error } from 'composables/input';
import { isEqual, omit } from 'lodash-es';
import { getIcon } from '@/helpers';
import UIExpandTransition from '@components/transitions/UIExpandTransition.vue';
import UIExpandTransition from 'components/transitions/UIExpandTransition.vue';
export default defineComponent({
name: 'UICheckbox',
Expand Down
2 changes: 1 addition & 1 deletion src/components/dropdown/UIDropdown.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { mount } from '@vue/test-utils';
import UIDropdown from '@components/dropdown/UIDropdown.vue';
import UIDropdown from './UIDropdown.vue';
import { h, nextTick } from 'vue';

describe('UIDropdown', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/dropdown/UIDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import { computed, defineComponent, ref, reactive } from 'vue';
import type { PropType } from 'vue';
import clickAway from '@/directives/click-away';
import { getPxValue } from '@composables/style';
import { getPxValue } from 'composables/style';
export default defineComponent({
name: 'UIDropdown',
Expand Down
12 changes: 6 additions & 6 deletions src/components/file-input/UIFileInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@
import { computed, defineComponent, ref, watch } from 'vue';
import type { PropType } from 'vue';
import { createFileList, getSizeString } from '@composables/utils';
import { name, label, clearable, autofocus, disabled, positiveOptionalNumber, error } from '@composables/input';
import { large } from '@composables/style';
import { createFileList, getSizeString } from 'composables/utils';
import { name, label, clearable, autofocus, disabled, positiveOptionalNumber, error } from 'composables/input';
import { large } from 'composables/style';
import { omit } from 'lodash-es';
import { getIcon } from '@/helpers';
import UIFadeTransition from '@components/transitions/UIFadeTransition.vue';
import UIExpandTransition from '@components/transitions/UIExpandTransition.vue';
import { FileError } from '@/types';
import UIFadeTransition from 'components/transitions/UIFadeTransition.vue';
import UIExpandTransition from 'components/transitions/UIExpandTransition.vue';
import type { FileError } from 'types';
export default defineComponent({
name: 'UIFileInput',
Expand Down
2 changes: 1 addition & 1 deletion src/components/file-uploader/UIFile.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { mount } from '@vue/test-utils';
import UIFile from '@components/file-uploader/UIFile.vue';
import UIFile from './UIFile.vue';

describe('UIFile', () => {
const file = new File(['foo'], 'foo.txt', {
Expand Down
11 changes: 6 additions & 5 deletions src/components/file-uploader/UIFile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@
</template>

<script lang="ts">
import { computed, defineComponent, onMounted, PropType, ref, watch } from 'vue';
import UIAvatar from '@components/avatar/UIAvatar.vue';
import type { PropType } from 'vue';
import { computed, defineComponent, onMounted, ref, watch } from 'vue';
import UIAvatar from 'components/avatar/UIAvatar.vue';
import { getIcon } from '@/helpers';
import UISpinnerLoader from '@components/loader-spinner/UISpinnerLoader.vue';
import UIFadeTransition from '@components/transitions/UIFadeTransition.vue';
import { getSizeString, isImage as fileIsImage, getExtension } from '@composables/utils';
import UISpinnerLoader from 'components/loader-spinner/UISpinnerLoader.vue';
import UIFadeTransition from 'components/transitions/UIFadeTransition.vue';
import { getSizeString, isImage as fileIsImage, getExtension } from 'composables/utils';
// todo accept a composable (returns a ref for progress) for upload
export default defineComponent({
Expand Down
12 changes: 6 additions & 6 deletions src/components/file-uploader/UIFileUploader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ import { defineComponent, ref } from 'vue';
import type { PropType } from 'vue';
import UIFile from './UIFile.vue';
import { getIcon } from '@/helpers';
import UIButton from '@components/button/UIButton.vue';
import { FileError } from '@/types';
import UIFadeTransition from '@components/transitions/UIFadeTransition.vue';
import UIExpandTransition from '@components/transitions/UIExpandTransition.vue';
import { error } from '@composables/input';
import { positiveOptionalNumber } from '@composables/input';
import UIButton from 'components/button/UIButton.vue';
import type { FileError } from 'types';
import UIFadeTransition from 'components/transitions/UIFadeTransition.vue';
import UIExpandTransition from 'components/transitions/UIExpandTransition.vue';
import { error } from 'composables/input';
import { positiveOptionalNumber } from 'composables/input';
// todo - UIFile may make the uploader overflow if the side menu is open when using files with long titles
export default defineComponent({
Expand Down
11 changes: 6 additions & 5 deletions src/components/input/UIInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@
</template>

<script lang="ts">
import { defineComponent, onMounted, PropType, ref, watch } from 'vue';
import type { PropType } from 'vue';
import { defineComponent, onMounted, ref, watch } from 'vue';
import {
autofocus,
label,
Expand All @@ -113,12 +114,12 @@ import {
disabled,
useVModel,
error
} from '@composables/input';
import { large } from '@composables/style';
} from 'composables/input';
import { large } from 'composables/style';
import { getIcon, getPrecision } from '@/helpers';
import { omit } from 'lodash-es';
import UIFadeTransition from '@components/transitions/UIFadeTransition.vue';
import UIExpandTransition from '@components/transitions/UIExpandTransition.vue';
import UIFadeTransition from 'components/transitions/UIFadeTransition.vue';
import UIExpandTransition from 'components/transitions/UIExpandTransition.vue';
const types = [
'text',
Expand Down
2 changes: 1 addition & 1 deletion src/components/loader-linear/UILinearLoader.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import UILinearLoader from './UILinearLoader.vue';
import { mount } from '@vue/test-utils';
import { disableConsoleWarn, enableConsoleWarn } from '@helpers/test';
import { disableConsoleWarn, enableConsoleWarn } from 'helpers/test';

let wrapper: ReturnType<typeof mount>;

Expand Down
2 changes: 1 addition & 1 deletion src/components/loader-linear/UILinearLoader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<script lang="ts">
import { defineComponent, computed } from 'vue';
import { inheritColor, progress, steps, determinate } from '@composables/style';
import { inheritColor, progress, steps, determinate } from 'composables/style';
export default defineComponent({
name: 'UILinearLoader',
Expand Down
2 changes: 1 addition & 1 deletion src/components/loader-spinner/UISpinnerLoader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<script lang="ts">
import { computed, defineComponent, ref, watch, onMounted, onUnmounted } from 'vue';
import { inheritColor, determinate, steps, progress } from '@composables/style';
import { inheritColor, determinate, steps, progress } from 'composables/style';
export default defineComponent({
name: 'UISpinnerLoader',
Expand Down
4 changes: 2 additions & 2 deletions src/components/modal/UIModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@

<script lang="ts">
import { defineComponent, ref } from 'vue';
import UIButton from '@components/button/UIButton.vue';
import UIPanel from '@components/panel/UIPanel.vue';
import UIButton from 'components/button/UIButton.vue';
import UIPanel from 'components/panel/UIPanel.vue';
import type { PropType } from 'vue';
import { getIcon } from '@/helpers';
Expand Down
4 changes: 2 additions & 2 deletions src/components/pagination/UIPagination.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@

<script lang="ts">
import { computed, defineComponent } from 'vue';
import { useVModel, disabled } from '@composables/input';
import { useVModel, disabled } from 'composables/input';
import { getIcon } from '@/helpers';
import UIButton from '@components/button/UIButton.vue';
import UIButton from 'components/button/UIButton.vue';
export default defineComponent({
name: 'UIPagination',
Expand Down
8 changes: 4 additions & 4 deletions src/components/panel/UIPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@
</template>

<script lang="ts">
import UIFadeTransition from '@components/transitions/UIFadeTransition.vue';
import UIExpandTransition from '@components/transitions/UIExpandTransition.vue';
import UILinearLoader from '@components/loader-linear/UILinearLoader.vue';
import UIFadeTransition from 'components/transitions/UIFadeTransition.vue';
import UIExpandTransition from 'components/transitions/UIExpandTransition.vue';
import UILinearLoader from 'components/loader-linear/UILinearLoader.vue';
import LocalCache from '@/helpers/cache/LocalCache';
import { defineComponent, ref, computed, watch } from 'vue';
import UISpinnerLoader from '@components/loader-spinner/UISpinnerLoader.vue';
import UISpinnerLoader from 'components/loader-spinner/UISpinnerLoader.vue';
let cache: LocalCache;
Expand Down
2 changes: 1 addition & 1 deletion src/components/pill/Demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<script lang="ts">
import { defineComponent } from 'vue';
import { styleTypes } from '@/types';
import { styleTypes } from 'types';
export default defineComponent({
name: 'Pill',
Expand Down
6 changes: 3 additions & 3 deletions src/components/pill/UIPill.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

<script lang="ts">
import { computed, defineComponent } from 'vue';
import { label } from '@composables/input';
import { category } from '@composables/style';
import { StyleType } from '@/types';
import { label } from 'composables/input';
import { category } from 'composables/style';
import type { StyleType } from 'types';
const categoryClasses = {
default: 'text-gray-700 bg-gray-200',
Expand Down
2 changes: 1 addition & 1 deletion src/components/radio/UIRadio.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { mount } from '@vue/test-utils';
import type { DOMWrapper } from '@vue/test-utils';
import UIRadio from './UIRadio.vue';
import UIRadioGroup from './UIRadioGroup.vue';
import { disableConsoleWarn, enableConsoleWarn } from '@helpers/test';
import { disableConsoleWarn, enableConsoleWarn } from 'helpers/test';

describe('UIRadio', () => {
it('should bind attributes to the input', () => {
Expand Down
Loading

0 comments on commit 7b273b0

Please sign in to comment.