Skip to content

Releases: carbon-design-system/sveld

v0.14.1

09 Apr 21:34
Compare
Choose a tag to compare

Fixes

  • svg $$restProps should extend the correct attributes

    - export interface IconProps extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["svg"]> {
    + export interface IconProps extends svelte.JSX.SVGAttributes<SVGSVGElement> {

v0.14.0

09 Apr 20:16
Compare
Choose a tag to compare

Features

  • add sveltekit:prefetch, sveltekit:noscroll attributes to props that extend a attributes

    Input

    <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 props

    import type { SvelteComponentTyped } from "svelte";
    import type { AccordionProps } from "./Accordion.svelte";

v0.13.4

26 Feb 21:13
Compare
Choose a tag to compare

Fixes

  • use file name as module name if library only has a single default export (08844fd)

v0.13.3

13 Feb 23:14
Compare
Choose a tag to compare

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

10 Feb 15:47
Compare
Choose a tag to compare

Fixes

  • do not wrap TS @event detail in CustomEvent if type contains CustomEvent (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

22 Jan 20:45
Compare
Choose a tag to compare

Fixes

    • return original entry point instead of resolved path in getSvelteEntry (47bd04a)

v0.13.0

22 Jan 20:40
Compare
Choose a tag to compare

Features

  • export sveld for programmatic usage (6782da6, #66)
  • upgrade prettier, rollup, svelte, svelte-preprocess, typescript (1c8366a)

v0.12.1

21 Jan 03:14
Compare
Choose a tag to compare
  • include @default annotation for undefined prop values (i.e., let prop1; let prop2 = undefined) (146ebc9, #64)

    Input

    <script>
      /** @type {boolean} */
      export let prop;
    </script>

    Output

    export interface InputProps {
      /**
      * @default undefined
      */
      prop?: boolean;
    }

v0.12.0

02 Jan 19:33
Compare
Choose a tag to compare

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, {}, {}> {}

v0.11.1

31 Dec 16:30
Compare
Choose a tag to compare

Fixes

  • replace backslashes with forward slashes in filePath values (73d899a, #60 contributed by @brunnerh)