Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(types): improve formatting of prop comments #1779

Merged
merged 1 commit into from
Jul 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
188 changes: 94 additions & 94 deletions COMPONENT_INDEX.md

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions docs/src/COMPONENT_API.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
{
"name": "title",
"kind": "let",
"description": "Specify the title of the accordion item heading\nAlternatively, use the \"title\" slot (e.g., <div slot=\"title\">...</div>)",
"description": "Specify the title of the accordion item heading.\nAlternatively, use the \"title\" slot (e.g., `<div slot=\"title\">...</div>`)",
"type": "string",
"value": "\"title\"",
"isFunction": false,
Expand Down Expand Up @@ -1024,7 +1024,7 @@
{
"name": "code",
"kind": "let",
"description": "Set the code snippet text\nAlternatively, use the default slot (e.g., <CodeSnippet>{`code`}</CodeSnippet>)\nYou must use the `code` prop to copy the code",
"description": "Set the code snippet text.\nAlternatively, use the default slot (e.g., `<CodeSnippet>{code}</CodeSnippet>`).\n\nNOTE: you *must* use the `code` prop for the copy-to-clipboard functionality.",
"type": "string",
"isFunction": false,
"isFunctionDeclaration": false,
Expand All @@ -1035,7 +1035,7 @@
{
"name": "copy",
"kind": "let",
"description": "Override the default copy behavior of using the navigator.clipboard.writeText API to copy text",
"description": "By default, this component uses `navigator.clipboard.writeText` API to copy text to the user's clipboard.\n\nProvide a custom function to override this behavior.",
"type": "(code: string) => void",
"value": "async (code) => { try { await navigator.clipboard.writeText(code); } catch (e) { console.log(e); } }",
"isFunction": true,
Expand Down Expand Up @@ -1071,7 +1071,7 @@
{
"name": "disabled",
"kind": "let",
"description": "Set to `true` for the disabled variant\nOnly applies to the \"single\", \"multi\" types",
"description": "Set to `true` for the disabled variant.\nOnly applies to the \"single\", \"multi\" types",
"type": "boolean",
"value": "false",
"isFunction": false,
Expand All @@ -1083,7 +1083,7 @@
{
"name": "wrapText",
"kind": "let",
"description": "Set to `true` to wrap the text\nNote that `type` must be \"multi\"",
"description": "Set to `true` to wrap the text.\n\nNOTE: this prop only works with the `type=\"multi\"` variant",
"type": "boolean",
"value": "false",
"isFunction": false,
Expand Down Expand Up @@ -1165,7 +1165,7 @@
{
"name": "showLessText",
"kind": "let",
"description": "Specify the show less text\n`type` must be \"multi\"",
"description": "Specify the show less text.\n\nNOTE: this prop only works with the `type=\"multi\"` variant",
"type": "string",
"value": "\"Show less\"",
"isFunction": false,
Expand All @@ -1177,7 +1177,7 @@
{
"name": "showMoreText",
"kind": "let",
"description": "Specify the show more text\n`type` must be \"multi\"",
"description": "Specify the show more text\n\nNOTE: this prop only works with the `type=\"multi\"` variant",
"type": "string",
"value": "\"Show more\"",
"isFunction": false,
Expand Down Expand Up @@ -2127,7 +2127,7 @@
{
"name": "labelText",
"kind": "let",
"description": "Specify the label text\nAlternatively, use the \"labelText\" slot (e.g., <span slot=\"labelText\">...</span>)",
"description": "Specify the label text.\nAlternatively, use the \"labelText\" slot (e.g., `<span slot=\"labelText\">...</span>`)",
"type": "string",
"value": "\"\"",
"isFunction": false,
Expand Down Expand Up @@ -2163,7 +2163,7 @@
{
"name": "shortcutText",
"kind": "let",
"description": "Specify the shortcut text\nAlternatively, use the \"shortcutText\" slot (e.g., <span slot=\"shortcutText\">...</span>)",
"description": "Specify the shortcut text.\nAlternatively, use the \"shortcutText\" slot (e.g., `<span slot=\"shortcutText\">...</span>`)",
"type": "string",
"value": "\"\"",
"isFunction": false,
Expand Down Expand Up @@ -4892,7 +4892,7 @@
{
"name": "text",
"kind": "let",
"description": "Specify the text\nAlternatively, use the named slot \"text\" (e.g., <div slot=\"text\">...</div>)",
"description": "Specify the text.\nAlternatively, use the named slot \"text\" (e.g., `<div slot=\"text\">...</div>`)",
"type": "string",
"isFunction": false,
"isFunctionDeclaration": false,
Expand Down Expand Up @@ -8128,7 +8128,7 @@
{
"name": "text",
"kind": "let",
"description": "Specify the item text\nAlternatively, use the default slot for a custom element",
"description": "Specify the item text.\nAlternatively, use the default slot",
"type": "string",
"value": "\"Provide text\"",
"isFunction": false,
Expand Down Expand Up @@ -11215,7 +11215,7 @@
{
"name": "labelText",
"kind": "let",
"description": "Specify the label text.\nAlternatively, use the \"labelText\" slot (e.g., <span slot=\"labelText\">...</span>)",
"description": "Specify the label text.\nAlternatively, use the \"labelText\" slot (e.g., `<span slot=\"labelText\">...</span>`)",
"type": "string",
"value": "\"\"",
"isFunction": false,
Expand Down Expand Up @@ -11613,7 +11613,7 @@
{
"name": "text",
"kind": "let",
"description": "Specify the switch text\nAlternatively, use the \"text\" slot (e.g., <span slot=\"text\">...</span>)",
"description": "Specify the switch text.\nAlternatively, use the \"text\" slot (e.g., `<span slot=\"text\">...</span>`)",
"type": "string",
"value": "\"Provide text\"",
"isFunction": false,
Expand Down Expand Up @@ -11697,7 +11697,7 @@
{
"name": "label",
"kind": "let",
"description": "Specify the tab label\nAlternatively, use the default slot (e.g., <Tab><span>Label</span></Tab>)",
"description": "Specify the tab label.\nAlternatively, use the default slot (e.g., `<Tab><span>Label</span></Tab>`)",
"type": "string",
"value": "\"\"",
"isFunction": false,
Expand Down
4 changes: 2 additions & 2 deletions src/Accordion/AccordionItem.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script>
/**
* Specify the title of the accordion item heading
* Alternatively, use the "title" slot (e.g., <div slot="title">...</div>)
* Specify the title of the accordion item heading.
* Alternatively, use the "title" slot (e.g., `<div slot="title">...</div>`)
*/
export let title = "title";

Expand Down
26 changes: 16 additions & 10 deletions src/CodeSnippet/CodeSnippet.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@
export let type = "single";

/**
* Set the code snippet text
* Alternatively, use the default slot (e.g., <CodeSnippet>{`code`}</CodeSnippet>)
* You must use the `code` prop to copy the code
* Set the code snippet text.
* Alternatively, use the default slot (e.g., `<CodeSnippet>{code}</CodeSnippet>`).
*
* NOTE: you *must* use the `code` prop for the copy-to-clipboard functionality.
* @type {string}
*/
export let code = undefined;

/**
* Override the default copy behavior of using the navigator.clipboard.writeText API to copy text
* By default, this component uses `navigator.clipboard.writeText` API to copy text to the user's clipboard.
*
* Provide a custom function to override this behavior.
* @type {(code: string) => void}
*/
export let copy = async (code) => {
Expand All @@ -38,14 +41,15 @@
export let hideCopyButton = false;

/**
* Set to `true` for the disabled variant
* Set to `true` for the disabled variant.
* Only applies to the "single", "multi" types
*/
export let disabled = false;

/**
* Set to `true` to wrap the text
* Note that `type` must be "multi"
* Set to `true` to wrap the text.
*
* NOTE: this prop only works with the `type="multi"` variant
*/
export let wrapText = false;

Expand Down Expand Up @@ -74,14 +78,16 @@
export let feedbackTimeout = 2000;

/**
* Specify the show less text
* `type` must be "multi"
* Specify the show less text.
*
* NOTE: this prop only works with the `type="multi"` variant
*/
export let showLessText = "Show less";

/**
* Specify the show more text
* `type` must be "multi"
*
* NOTE: this prop only works with the `type="multi"` variant
*/
export let showMoreText = "Show more";

Expand Down
4 changes: 2 additions & 2 deletions src/ContentSwitcher/Switch.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script>
/**
* Specify the switch text
* Alternatively, use the "text" slot (e.g., <span slot="text">...</span>)
* Specify the switch text.
* Alternatively, use the "text" slot (e.g., `<span slot="text">...</span>`)
*/
export let text = "Provide text";

Expand Down
8 changes: 4 additions & 4 deletions src/ContextMenu/ContextMenuOption.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
export let icon = undefined;

/**
* Specify the label text
* Alternatively, use the "labelText" slot (e.g., <span slot="labelText">...</span>)
* Specify the label text.
* Alternatively, use the "labelText" slot (e.g., `<span slot="labelText">...</span>`)
*/
export let labelText = "";

Expand All @@ -34,8 +34,8 @@
export let selectable = false;

/**
* Specify the shortcut text
* Alternatively, use the "shortcutText" slot (e.g., <span slot="shortcutText">...</span>)
* Specify the shortcut text.
* Alternatively, use the "shortcutText" slot (e.g., `<span slot="shortcutText">...</span>`)
*/
export let shortcutText = "";

Expand Down
4 changes: 2 additions & 2 deletions src/OverflowMenu/OverflowMenuItem.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script>
/**
* Specify the item text
* Alternatively, use the default slot for a custom element
* Specify the item text.
* Alternatively, use the default slot
*/
export let text = "Provide text";

Expand Down
2 changes: 1 addition & 1 deletion src/Slider/Slider.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

/**
* Specify the label text.
* Alternatively, use the "labelText" slot (e.g., <span slot="labelText">...</span>)
* Alternatively, use the "labelText" slot (e.g., `<span slot="labelText">...</span>`)
*/
export let labelText = "";

Expand Down
4 changes: 2 additions & 2 deletions src/Tabs/Tab.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script>
/**
* Specify the tab label
* Alternatively, use the default slot (e.g., <Tab><span>Label</span></Tab>)
* Specify the tab label.
* Alternatively, use the default slot (e.g., `<Tab><span>Label</span></Tab>`)
*/
export let label = "";

Expand Down
4 changes: 2 additions & 2 deletions src/UIShell/HeaderAction.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
export let closeIcon = Close;

/**
* Specify the text
* Alternatively, use the named slot "text" (e.g., <div slot="text">...</div>)
* Specify the text.
* Alternatively, use the named slot "text" (e.g., `<div slot="text">...</div>`)
* @type {string}
*/
export let text = undefined;
Expand Down
4 changes: 2 additions & 2 deletions types/Accordion/AccordionItem.svelte.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ type RestProps = SvelteHTMLElements["li"];

export interface AccordionItemProps extends RestProps {
/**
* Specify the title of the accordion item heading
* Alternatively, use the "title" slot (e.g., <div slot="title">...</div>)
* Specify the title of the accordion item heading.
* Alternatively, use the "title" slot (e.g., `<div slot="title">...</div>`)
* @default "title"
*/
title?: string;
Expand Down
26 changes: 16 additions & 10 deletions types/CodeSnippet/CodeSnippet.svelte.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@ export interface CodeSnippetProps {
type?: "single" | "inline" | "multi";

/**
* Set the code snippet text
* Alternatively, use the default slot (e.g., <CodeSnippet>{`code`}</CodeSnippet>)
* You must use the `code` prop to copy the code
* Set the code snippet text.
* Alternatively, use the default slot (e.g., `<CodeSnippet>{code}</CodeSnippet>`).
*
* NOTE: you *must* use the `code` prop for the copy-to-clipboard functionality.
* @default undefined
*/
code?: string;

/**
* Override the default copy behavior of using the navigator.clipboard.writeText API to copy text
* By default, this component uses `navigator.clipboard.writeText` API to copy text to the user's clipboard.
*
* Provide a custom function to override this behavior.
* @default async (code) => { try { await navigator.clipboard.writeText(code); } catch (e) { console.log(e); } }
*/
copy?: (code: string) => void;
Expand All @@ -34,15 +37,16 @@ export interface CodeSnippetProps {
hideCopyButton?: boolean;

/**
* Set to `true` for the disabled variant
* Set to `true` for the disabled variant.
* Only applies to the "single", "multi" types
* @default false
*/
disabled?: boolean;

/**
* Set to `true` to wrap the text
* Note that `type` must be "multi"
* Set to `true` to wrap the text.
*
* NOTE: this prop only works with the `type="multi"` variant
* @default false
*/
wrapText?: boolean;
Expand Down Expand Up @@ -84,15 +88,17 @@ export interface CodeSnippetProps {
feedbackTimeout?: number;

/**
* Specify the show less text
* `type` must be "multi"
* Specify the show less text.
*
* NOTE: this prop only works with the `type="multi"` variant
* @default "Show less"
*/
showLessText?: string;

/**
* Specify the show more text
* `type` must be "multi"
*
* NOTE: this prop only works with the `type="multi"` variant
* @default "Show more"
*/
showMoreText?: string;
Expand Down
4 changes: 2 additions & 2 deletions types/ContentSwitcher/Switch.svelte.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ type RestProps = SvelteHTMLElements["button"];

export interface SwitchProps extends RestProps {
/**
* Specify the switch text
* Alternatively, use the "text" slot (e.g., <span slot="text">...</span>)
* Specify the switch text.
* Alternatively, use the "text" slot (e.g., `<span slot="text">...</span>`)
* @default "Provide text"
*/
text?: string;
Expand Down
8 changes: 4 additions & 4 deletions types/ContextMenu/ContextMenuOption.svelte.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export interface ContextMenuOptionProps extends RestProps {
icon?: typeof import("svelte").SvelteComponent<any>;

/**
* Specify the label text
* Alternatively, use the "labelText" slot (e.g., <span slot="labelText">...</span>)
* Specify the label text.
* Alternatively, use the "labelText" slot (e.g., `<span slot="labelText">...</span>`)
* @default ""
*/
labelText?: string;
Expand All @@ -50,8 +50,8 @@ export interface ContextMenuOptionProps extends RestProps {
selectable?: boolean;

/**
* Specify the shortcut text
* Alternatively, use the "shortcutText" slot (e.g., <span slot="shortcutText">...</span>)
* Specify the shortcut text.
* Alternatively, use the "shortcutText" slot (e.g., `<span slot="shortcutText">...</span>`)
* @default ""
*/
shortcutText?: string;
Expand Down
4 changes: 2 additions & 2 deletions types/OverflowMenu/OverflowMenuItem.svelte.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ type RestProps = SvelteHTMLElements["li"];

export interface OverflowMenuItemProps extends RestProps {
/**
* Specify the item text
* Alternatively, use the default slot for a custom element
* Specify the item text.
* Alternatively, use the default slot
* @default "Provide text"
*/
text?: string;
Expand Down
2 changes: 1 addition & 1 deletion types/Slider/Slider.svelte.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export interface SliderProps extends RestProps {

/**
* Specify the label text.
* Alternatively, use the "labelText" slot (e.g., <span slot="labelText">...</span>)
* Alternatively, use the "labelText" slot (e.g., `<span slot="labelText">...</span>`)
* @default ""
*/
labelText?: string;
Expand Down
Loading