Skip to content

AI-native design editor. Open-source Figma alternative.

Fix Vue package declaration build

Danila Poyarkove52fcf1b8f26
diff --git a/packages/vue/src/global.d.ts b/packages/vue/src/global.d.ts
new file mode 100644
index 000000000..9ebba9189
--- /dev/null
+++ b/packages/vue/src/global.d.ts
@@ -0,0 +1,23 @@
+interface FontData {
+ family: string
+ fullName: string
+ postscriptName: string
+ style: string
+ blob(): Promise<Blob>
+}
+
+interface Window {
+ queryLocalFonts?(): Promise<FontData[]>
+}
+
+interface GestureEvent extends UIEvent {
+ scale: number
+ rotation: number
+ clientX: number
+ clientY: number
+}
+
+declare module '*?raw' {
+ const content: string
+ export default content
+}
diff --git a/packages/vue/src/shared/useInlineRename.ts b/packages/vue/src/shared/useInlineRename.ts
index be8dc13b8..703954598 100644
--- a/packages/vue/src/shared/useInlineRename.ts
+++ b/packages/vue/src/shared/useInlineRename.ts
@@ -1,8 +1,19 @@
import { onClickOutside } from '@vueuse/core'
import { nextTick, ref, type Ref } from 'vue'
-export function useInlineRename<T extends string>(onCommit: (id: T, newName: string) => void) {
- const editingId = ref<T | null>(null)
+export interface InlineRenameState<T extends string> {
+ editingId: Ref<T | null>
+ start: (id: T, currentName: string) => void
+ focusInput: (input: HTMLInputElement | null) => Promise<void>
+ commit: (id: T, input: HTMLInputElement) => void
+ cancel: () => void
+ onKeydown: (e: KeyboardEvent) => void
+}
+
+export function useInlineRename<T extends string>(
+ onCommit: (id: T, newName: string) => void
+): InlineRenameState<T> {
+ const editingId: Ref<T | null> = ref(null)
const inputRef: Ref<HTMLInputElement | null> = ref(null)
let originalName = ''
let cleanupOutsideClick: (() => void) | undefined
diff --git a/packages/vue/tsconfig.json b/packages/vue/tsconfig.json
index 6a33bd6b6..7a083d056 100644
--- a/packages/vue/tsconfig.json
+++ b/packages/vue/tsconfig.json
@@ -1,6 +1,7 @@
{
"compilerOptions": {
- "target": "ESNext",
+ "target": "ES2022",
+ "lib": ["ESNext", "DOM", "DOM.Iterable"],
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
@@ -8,11 +9,18 @@
"declaration": true,
"declarationDir": "./dist",
"outDir": "./dist",
- "rootDir": "./src",
+ "rootDir": "..",
"skipLibCheck": true,
"esModuleInterop": true,
- "resolveJsonModule": true
+ "resolveJsonModule": true,
+ "baseUrl": ".",
+ "paths": {
+ "@open-pencil/vue": ["./src/index.ts"],
+ "@open-pencil/vue/*": ["./src/*"],
+ "@open-pencil/core": ["../core/src/index.ts"],
+ "@open-pencil/core/*": ["../core/src/*"]
+ }
},
- "include": ["src/**/*.ts", "src/**/*.vue"],
+ "include": ["src/**/*.ts", "src/**/*.vue", "src/**/*.d.ts", "../core/src/global.d.ts"],
"exclude": ["node_modules", "dist", "example"]
}