From a401a7a4f1325e8364aef55d1728a27167dc1c91 Mon Sep 17 00:00:00 2001 From: Daybrush Date: Sat, 20 May 2023 16:46:01 +0900 Subject: [PATCH] feat: support svelte types --- packages/svelte-guides/package.json | 2 +- packages/svelte-guides/src/index.d.ts | 31 +++++++++------------------ 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/packages/svelte-guides/package.json b/packages/svelte-guides/package.json index 2b69aa1..72d745e 100644 --- a/packages/svelte-guides/package.json +++ b/packages/svelte-guides/package.json @@ -1,6 +1,6 @@ { "name": "svelte-guides", - "version": "0.25.5", + "version": "0.25.6", "description": "A Svelte Guides component that can draw ruler and manage guidelines.", "svelte": "./src/index.js", "sideEffects": false, diff --git a/packages/svelte-guides/src/index.d.ts b/packages/svelte-guides/src/index.d.ts index 6bea5e5..9b0a34b 100644 --- a/packages/svelte-guides/src/index.d.ts +++ b/packages/svelte-guides/src/index.d.ts @@ -1,27 +1,16 @@ -import { GuidesInterface } from "@scena/guides"; +/// +import { SvelteComponentTyped } from "svelte"; +import { GuidesInterface, GuidesOptions, GuidesEvents } from "@scena/guides"; - -interface ComponentOptions { - target: HTMLElement; - anchor?: HTMLElement | null; - props?: {}; - hydrate?: boolean; - intro?: boolean; +export type SvelteGuidesEvents = { + [key in keyof GuidesEvents]: CustomEvent; } +export default class GuidesComponent extends SvelteComponentTyped< + GuidesOptions, + SvelteGuidesEvents +> { } -interface GuidesComponent extends GuidesInterface { - new(options: ComponentOptions): any; - // client-side methods - $set(props: {}): void; - $on(event: string, callback: (event: CustomEvent) => void): void; - $destroy(): void; - // server-side methods - render(props?: {}): { - html: string; - css: { code: string; map: string | null }; - head?: string; - }; +export default interface GuidesComponent extends GuidesInterface { } -export default GuidesComponent; export * from "@scena/guides";