Skip to content

Commit

Permalink
feat: LeaferApp comp types
Browse files Browse the repository at this point in the history
  • Loading branch information
FliPPeDround committed Oct 10, 2024
1 parent 239d85b commit c7cb2c6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
1 change: 0 additions & 1 deletion packages/vue3/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from './components/application/index'
export * from './types/index'
4 changes: 2 additions & 2 deletions packages/vue3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"sideEffects": false,
"exports": {
".": {
"types": "./dist/index.d.ts",
"types": "./dist/types/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
Expand All @@ -29,7 +29,7 @@
"main": "dist/index.cjs",
"module": "dist/index.js",
"unpkg": "dist/index.js",
"types": "dist/index.d.ts",
"types": "dist/types/index.d.ts",
"typesVersions": {
"*": {
"*": [
Expand Down
4 changes: 3 additions & 1 deletion packages/vue3/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ export default defineConfig ((options) => {
tsconfig: './tsconfig.json',
clean: true,
minify: !isWatch,
dts: true,
dts: {
entry: ['compiler.ts', 'types/index.ts'],
},
onSuccess: async () => {
const leaferVueEsm = fs.readFileSync('./dist/index.js', 'utf-8')
fs.writeFileSync('./../../docs/public/leafer-vue.proxy.js', leaferVueEsm)
Expand Down
9 changes: 7 additions & 2 deletions packages/vue3/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IBoxInputData, ICanvasInputData, IEllipseInputData, IFrameInputData, IGroupInputData, IImageInputData, ILeaferInputData, ILineInputData, IPathInputData, IPenInputData, IPolygonInputData, IRectInputData, IStarInputData, ITextInputData } from '@leafer-ui/interface'
import type { IAppInputData, IBoxInputData, ICanvasInputData, IEllipseInputData, IFrameInputData, IGroupInputData, IImageInputData, ILeaferInputData, ILineInputData, IPathInputData, IPenInputData, IPolygonInputData, IRectInputData, IStarInputData, ITextInputData } from '@leafer-ui/interface'
import type { _LeaferEvent } from './LeaferEventType'
import type { LeaferVueComponent } from './LeaferVueComponent'

Expand All @@ -21,7 +21,9 @@ interface LeaferVueComponents {
Canvas: LeaferVueComponent<ICanvasInputData>

Text: LeaferVueComponent<ITextInputData>
Custom: LeaferVueComponent<{ is: new () => unknown }>
Custom: LeaferVueComponent<{
is: new () => unknown
}>
}

declare module 'vue' {
Expand All @@ -35,3 +37,6 @@ declare module '@vue/runtime-core' {
declare module '@vue/runtime-dom' {
interface GlobalComponents extends LeaferVueComponents {}
}

declare const LeaferApp: LeaferVueComponent<IAppInputData>
export { LeaferApp }

0 comments on commit c7cb2c6

Please sign in to comment.