Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/typescript declarations #259

Merged
merged 9 commits into from
Apr 12, 2024
2 changes: 1 addition & 1 deletion docs/examples/accordion-example.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

<script lang="ts">
import ExampleContainer from "./example-container.vue"
import SldsAccordion from "../slds-accordion/slds-accordion.vue"
import SldsAccordion from "../../src/components/slds-accordion/slds-accordion.vue"
import SldsAccordionSection from "../../src/components/slds-accordion/slds-accordion-section.vue"
import { defineComponent } from "vue"
import { AccordionSection } from "../../src/components/slds-accordion/accordion-section"
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/spinner-example.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<script lang="ts">
import ExampleContainer from "./example-container.vue"
import SldsSpinner from "../slds-spinner/slds-spinner.vue"
import SldsSpinner from "../../src/components/slds-spinner/slds-spinner.vue"
import { defineComponent } from "vue"

export default defineComponent({
Expand Down
5 changes: 0 additions & 5 deletions env.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
/// <reference types="vite/client" />

declare module "*.vue" {
import Vue from "vue"
export default Vue
}
4,288 changes: 615 additions & 3,673 deletions package-lock.json

Large diffs are not rendered by default.

49 changes: 19 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
{
"name": "vuetning",
"version": "0.0.0",
"main": "./dist/vuetning.es.js",
"module": "./dist/vuetning.es.js",
"type": "module",
"types": "src/main.ts",
"main": "./dist/vuetning.umd.js",
"module": "./dist/vuetning.es.js",
"exports": {
".": {
"import": "./dist/vuetning.es.js"
"import": "./dist/vuetning.es.js",
"require": "./dist/vuetning.umd.js"
},
"./dist/style.css": "./dist/style.css"
"./style.css": "./dist/vuetning.css"
},
"files": [
"dist",
"src"
],
"types": "./dist/main.d.ts",
"scripts": {
"docs:dev": "vitepress dev docs",
"docs:build": "vitepress build docs",
"build": "run-p type-check build-only",
"test:unit": "vitest --coverage",
"build-only": "vite build",
"type-check": "vue-tsc --noEmit --composite false",
"lint": "eslint --ext .ts,vue --ignore-path .gitignore .",
"lint:fix": "eslint --fix --ext .ts,vue --ignore-path .gitignore ."
"build": "vite build && vue-tsc --emitDeclarationOnly",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"type-check": "vue-tsc --noEmit --composite false"
},
"dependencies": {
"@formkit/auto-animate": "^0.8.1",
Expand All @@ -38,30 +36,21 @@
"vue-observe-visibility": "^2.0.0-alpha.1"
},
"devDependencies": {
"@babel/types": "^7.24.0",
"@rushstack/eslint-patch": "^1.7.2",
"@tsconfig/node20": "^20.1.2",
"@types/jsdom": "^21.1.6",
"@types/node": "^20.11.28",
"@types/numeral": "^2.0.5",
"@types/scrollparent": "^2.0.3",
"@types/uuid": "^9.0.8",
"@rushstack/eslint-patch": "^1.10.2",
"@tsconfig/node20": "^20.1.4",
"@types/node": "^20.12.7",
"@vitejs/plugin-vue": "^5.0.4",
"@vitest/coverage-v8": "^1.4.0",
"@vue/eslint-config-typescript": "^13.0.0",
"@vue/test-utils": "^2.4.5",
"@vue/tsconfig": "^0.5.1",
"eslint": "^8.57.0",
"eslint-plugin-vue": "^9.23.0",
"jsdom": "^24.0.0",
"npm-run-all": "^4.1.5",
"eslint-plugin-vue": "^9.24.1",
"npm-run-all2": "^6.1.2",
"postcss": "^8.4.35",
"postcss-prefix-selector": "^1.16.0",
"sass": "^1.72.0",
"typescript": "^5.3.3",
"vite": "^5.1.6",
"vitepress": "^1.0.0-rc.45",
"vitest": "^1.4.0",
"vue-tsc": "^2.0.6"
"sass": "^1.74.1",
"typescript": "~5.4.0",
"vite": "^5.2.8",
"vitepress": "^1.1.0",
"vue-tsc": "^2.0.12"
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Option } from "@/components/commons/option"
import type { Option } from "../commons/option"

export interface CheckboxButtonGroupOption extends Option {
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Option } from "@/components/commons/option"
import type { Option } from "../commons/option"

export interface CheckboxGroupOption extends Option {
/**
Expand Down
17 changes: 17 additions & 0 deletions src/components/slds-data-table/data-table-column-configuration.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
import { v4 as newId } from "uuid"

export class DataTableColumnConfiguration {
id: string
type: string
label?: string
fieldName?: string
width?: number
hasCopyButton: boolean
isResizable: boolean
sortable: boolean
sortBy?: string
hasMenu: boolean
typeAttributes?: any
sortedAscending: boolean
sortedDescending: boolean
fullWidth?: number
offsetLeft?: number
left?: number

constructor(column) {
this.id = newId()
this.type = (column.type != null) ? column.type : "text"
Expand Down
12 changes: 0 additions & 12 deletions src/components/slds-spinner/__tests__/slds-spinner.spec.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Option } from "@/components/commons/option"
import type { Option } from "../commons/option"

export interface WideRadioGroupOption extends Option {
/**
Expand Down
13 changes: 3 additions & 10 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
import { EVENTS } from "./events"
import { ICON_CATEGORIES, ICONS } from "./icons"
import { KEYS } from "./keys"

export {
EVENTS,
ICON_CATEGORIES,
ICONS,
KEYS,
}
export { EVENTS } from "./events"
export { ICON_CATEGORIES, ICONS } from "./icons"
export { KEYS } from "./keys"
11 changes: 3 additions & 8 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
import { type App } from "vue"
import "./assets/styles/main.scss"

import type { App } from "vue"
import * as components from "./components"
import * as stencils from "./stencils"
import "./assets/styles/main.scss"

export * as components from "./components"
export * as stencils from "./stencils"
export default { install }
export * from "./constants"

export type { AccordionSection } from "./components/slds-accordion/accordion-section"
export type { Breadcrumb } from "./components/slds-breadcrumbs/breadcrumb"
export type { CheckboxGroupOption } from "./components/slds-checkbox-group/checkbox-group-option"
Expand All @@ -21,8 +18,6 @@ export type { PageHeaderDropdownOption } from "./components/slds-page-header/pag
export type { Tab } from "./components/slds-tabs/tab"
export type { WideRadioGroupOption } from "./components/slds-wide-radio-group/wide-radio-group-option"

export default { install }

interface ComponentDictionary {
[key: string]: any
}
Expand Down
21 changes: 0 additions & 21 deletions tsconfig.app.json

This file was deleted.

32 changes: 25 additions & 7 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,32 @@
{
"files": [],
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": [
"ES2020",
"DOM",
"DOM.Iterable"
],
"skipLibCheck": true,
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"outDir": "dist",
"declaration": true,
"allowSyntheticDefaultImports": true
},
"include": [
"src/**/*.ts",
"src/**/*.d.ts",
"src/**/*.tsx",
"src/components/*.vue"
],
"references": [
{
"path": "./tsconfig.node.json"
},
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.vitest.json"
}
]
}
19 changes: 7 additions & 12 deletions tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
{
"extends": "@tsconfig/node20/tsconfig.json",
"include": [
"vite.config.*",
"vitest.config.*",
"cypress.config.*",
"nightwatch.conf.*",
"playwright.config.*"
],
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"composite": true,
"module": "ESNext",
"types": [
"node"
]
}
"moduleResolution": "bundler",
"skipLibCheck": true
},
"include": [
"vite.config.ts"
]
}
12 changes: 0 additions & 12 deletions tsconfig.vitest.json

This file was deleted.

21 changes: 10 additions & 11 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
import { defineConfig } from "vite"
import vue from "@vitejs/plugin-vue"
import { defineConfig } from "vite"
import { resolve } from "path"

export default defineConfig({
plugins: [vue()],
build: {
lib: {
entry: resolve(__dirname, "src/main.ts"),
name: "Vuetning",
formats: ["es"],
fileName: (format) => `vuetning.${format}.js`,
fileName: (format) => `vuetning.${format}.js`
},
rollupOptions: {
external: ["vue"],
output: {
assetFileNames: "vuetning.[ext]",
exports: "named",
globals: {
vue: "Vue",
},
},
},
},
plugins: [
vue(),
],
vue: "Vue"
}
}
}
}
})
18 changes: 0 additions & 18 deletions vitest.config.ts

This file was deleted.

Loading