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

feat(recursive-list): integrate RecursiveList with v11 #1960

Merged
merged 1 commit into from
Apr 21, 2024
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
8 changes: 4 additions & 4 deletions COMPONENT_INDEX.md
Original file line number Diff line number Diff line change
Expand Up @@ -3071,10 +3071,10 @@ export interface RecursiveListNode {

### Props

| Prop name | Required | Kind | Reactive | Type | Default value | Description |
| :-------- | :------- | :--------------- | :------- | --------------------------------------------------------------------------- | ------------------------ | ---------------------------------- |
| children | No | <code>let</code> | No | <code>Array<RecursiveListNode & { children?: RecursiveListNode[]; }></code> | <code>[]</code> | Specify the children to render |
| type | No | <code>let</code> | No | <code>"unordered" &#124; "ordered" &#124; "ordered-native"</code> | <code>"unordered"</code> | Specify the type of list to render |
| Prop name | Required | Kind | Reactive | Type | Default value | Description |
| :-------- | :------- | :--------------- | :------- | ------------------------------------------------------------------------------------------------ | ------------------------ | ---------------------------------- |
| children | No | <code>let</code> | No | <code>ReadonlyArray<RecursiveListNode & { children?: ReadonlyArray<RecursiveListNode>; }></code> | <code>[]</code> | Specify the children to render |
| type | No | <code>let</code> | No | <code>"unordered" &#124; "ordered" &#124; "ordered-native"</code> | <code>"unordered"</code> | Specify the type of list to render |

### Slots

Expand Down
2 changes: 1 addition & 1 deletion docs/src/COMPONENT_API.json
Original file line number Diff line number Diff line change
Expand Up @@ -9783,7 +9783,7 @@
"name": "children",
"kind": "let",
"description": "Specify the children to render",
"type": "Array<RecursiveListNode & { children?: RecursiveListNode[]; }>",
"type": "ReadonlyArray<RecursiveListNode & { children?: ReadonlyArray<RecursiveListNode>; }>",
"value": "[]",
"isFunction": false,
"isFunctionDeclaration": false,
Expand Down
2 changes: 1 addition & 1 deletion src/RecursiveList/RecursiveList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

/**
* Specify the children to render
* @type {Array<RecursiveListNode & { children?: RecursiveListNode[]; }>}
* @type {ReadonlyArray<RecursiveListNode & { children?: ReadonlyArray<RecursiveListNode>; }>}
*/
export let children = [];

Expand Down
23 changes: 4 additions & 19 deletions tests/RecursiveList.test.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,14 @@
const children = [
{
text: "Item 1",
children: [
{
text: "Item 1a",
children: [{ html: "<h5>HTML content</h5>" }],
},
],
children: [{ text: "Item 1a", children: [] }],
},
{
text: "Item 2",
children: [
{
href: "https://svelte.dev/",
},
{
href: "https://svelte.dev/",
text: "Link with custom text",
},
],
children: [{ href: "https://svelte.dev/" }],
},
{
text: "Item 3",
},
];
{ text: "Item 3" },
] as const;
</script>

<RecursiveList type="ordered" children="{children}" />
4 changes: 3 additions & 1 deletion types/RecursiveList/RecursiveList.svelte.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ export interface RecursiveListProps extends RestProps {
* Specify the children to render
* @default []
*/
children?: Array<RecursiveListNode & { children?: RecursiveListNode[] }>;
children?: ReadonlyArray<
RecursiveListNode & { children?: ReadonlyArray<RecursiveListNode> }
>;

/**
* Specify the type of list to render
Expand Down
Loading