Skip to content

Commit

Permalink
chore(libs/ui): extract component prop types to own file
Browse files Browse the repository at this point in the history
  • Loading branch information
vnphanquang committed Jun 3, 2024
1 parent b28eebc commit 04d03db
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .changeset/yellow-kangaroos-promise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltevietnam/ui': patch
---

extract props types of enhanced-code-block components to own file
2 changes: 1 addition & 1 deletion libs/ui/src/lib/components/EnhancedCodeBlock.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import FileIcon from './FileIcon.svelte';
import { EnhancedCodeBlockGroupContext } from './enhanced-code-block-group-context.svelte.js';
/** @type {import('./EnhancedCodeBlock.svelte').EnhancedCodeBlockProps} */
/** @type {import('./types.d.ts').EnhancedCodeBlockProps} */
let {
lang,
title,
Expand Down
2 changes: 1 addition & 1 deletion libs/ui/src/lib/components/EnhancedCodeBlockGroup.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script>
import { EnhancedCodeBlockGroupContext } from './enhanced-code-block-group-context.svelte.js';
/** @type {import('./EnhancedCodeBlockGroup.svelte').EnhancedCodeBlockGroupProps} */
/** @type {import('./types.d.ts').EnhancedCodeBlockGroupProps} */
let { cols, name, display, title, children, class: cls, style, ...rest } = $props();
EnhancedCodeBlockGroupContext.set({ name, display, title });
Expand Down
11 changes: 0 additions & 11 deletions libs/ui/src/lib/components/EnhancedCodeBlockGroup.svelte.d.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getContext, setContext, hasContext } from 'svelte';
/**
* @typedef EnhancedCodeBlockGroupContextInit
* @property {string} name - name for the code block group, mapped to the checkbox input `name` field
* @property {import('./EnhancedCodeBlockGroup.svelte').EnhancedCodeBlockGroupProps['display']} display - display mode of the code block group
* @property {import('./types.d.ts').EnhancedCodeBlockGroupProps['display']} display - display mode of the code block group
* @property {string} [title] - initial code block identifier to display
*/

Expand All @@ -12,7 +12,7 @@ export class EnhancedCodeBlockGroupContext {

// eslint-disable-next-line no-undef
name = $state('');
/** @type {import('./EnhancedCodeBlockGroup.svelte').EnhancedCodeBlockGroupProps['display']} */
/** @type {import('./types.d.ts').EnhancedCodeBlockGroupProps['display']} */
// eslint-disable-next-line no-undef
display = $state('files');
/** @type {string | undefined} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,13 @@ interface EnhancedCodeBlockProps extends HTMLAttributes<HTMLElement> {
*/
collapsed?: 'disabled' | string;
}

interface EnhancedCodeBlockGroupProps extends HTMLAttributes<HTMLElement> {
cols: number;
name: string;
display?: 'files' | 'tabs';
/**
* bindable, title of the current active child code block
*/
title?: string;
}

0 comments on commit 04d03db

Please sign in to comment.