Releases: carbon-design-system/sveld
Releases · carbon-design-system/sveld
v0.14.1
v0.14.0
Features
-
add
sveltekit:prefetch
,sveltekit:noscroll
attributes to props that extenda
attributesInput
<a href="/" {...$$restProps}><slot /></a>
Output
/// <reference types="svelte" /> import type { SvelteComponentTyped } from "svelte"; export interface LinkProps extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["a"]> { /** * SvelteKit attribute to enable data prefetching * if a link is hovered over or touched on mobile. * @see https://kit.svelte.dev/docs/a-options#sveltekit-prefetch * @default false */ "sveltekit:prefetch"?: boolean; /** * SvelteKit attribute to prevent scrolling * after the link is clicked. * @see https://kit.svelte.dev/docs/a-options#sveltekit-prefetch * @default false */ "sveltekit:noscroll"?: boolean; } export default class Input extends SvelteComponentTyped<InputProps, {}, { default: {} }> {}
-
use type-only imports for
SvelteComponentTyped
and extended propsimport type { SvelteComponentTyped } from "svelte"; import type { AccordionProps } from "./Accordion.svelte";
v0.13.4
v0.13.3
Fixes
-
component module exports should not be recognized as accessors (ae85e72)
Input
<script context="module"> /** * Log something (export) * @type {(message: string) => void} */ export function log(message) { console.log(message); } </script> <script> /** * Log something (accessor) * @type {(message: string) => void} */ export function log(message) { console.log(message); } </script>
Output
/// <reference types="svelte" /> import { SvelteComponentTyped } from "svelte"; /** * Log something (export) */ export type log = (message: string) => void; export interface InputProps {} export default class Input extends SvelteComponentTyped<InputProps, {}, {}> { /** * Log something (accessor) */ log: (message: string) => void; }
v0.13.2
Fixes
-
do not wrap TS
@event
detail inCustomEvent
if type containsCustomEvent
(792bc09)Input
<script> /** * @event {FocusEvent | CustomEvent<FocusEvent>} blur */ import { createEventDispatcher } from "svelte"; const dispatcher = createEventDispatcher(); </script> <button on:blur on:blur={(e) => { dispatcher("blur", e); }} />
Output
/// <reference types="svelte" /> import { SvelteComponentTyped } from "svelte"; export interface ComponentProps {} export default class Component extends SvelteComponentTyped< ComponentProps, { blur: FocusEvent | CustomEvent<FocusEvent>; }, {} > {}
v0.13.1
v0.13.0
v0.12.1
v0.12.0
Features
-
support props defined via renamed exports (31aec44, #62 contributed by @aabounegm)
Input:
<script> let className = "test"; /** * Just your average CSS class string. * @type {string|null} */ export { className as class }; </script>
Output:
/// <reference types="svelte" /> import { SvelteComponentTyped } from "svelte"; export interface InputProps { /** * Just your average CSS class string. * @default "test" */ class?: string | null; } export default class Input extends SvelteComponentTyped<InputProps, {}, {}> {}