Skip to content

Commit 9fab5e8

Browse files
committedMar 11, 2025
chore: minro change to optimize find
1 parent 90b9769 commit 9fab5e8

File tree

3 files changed

+15
-23
lines changed

3 files changed

+15
-23
lines changed
 

‎README.md

+10-12
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,17 @@ Rokkit provides both composable and data-driven components.
1313
- Data-driven components, make it easier to build dynamic and reactive interfaces. One of the key benefits of this approach is that it allows developers to focus on the data and logic of their application, rather than the implementation of UI elements.
1414

1515
> Rokkit is currently under development and not feature complete yet.
16+
> Rokkit has been rewritten to use Svelte 5 runes
17+
> Some components are yet to be rewritten
1618
1719
## Libraries
1820

19-
Components have been separated into the following packages. Refer to the package [stories](sites/rokkit) for examples of all available UI components. View a live demo [here](https://rokkit.vercel.app/)
21+
Components have been separated into the following packages. Refer to the [stories](sites/learn/lib/stories) for examples of all available UI components. View a live demo [here](https://rokkit.vercel.app/)
2022

2123
- [@rokkit/core](packages/core)
2224
- [@rokkit/data](packages/data)
2325
- [@rokkit/actions](packages/actions)
24-
- [@rokkit/stores](packages/stores)
25-
- [@rokkit/atoms](packages/atoms)
26-
- [@rokkit/molecules](packages/molecules)
27-
- [@rokkit/organisms](packages/organisms)
28-
- [@rokkit/layout](packages/layout)
29-
- [@rokkit/chart](packages/chart)
26+
- [@rokkit/states](packages/states)
3027
- [@rokkit/icons](packages/icons)
3128
- [@rokkit/themes](packages/themes)
3229
- [@rokkit/ui](packages/ui)
@@ -47,9 +44,10 @@ To use Rokkit in your Svelte project, simply import the desired control and use
4744
```svelte
4845
<script>
4946
import { List } from '@rokkit/ui'
47+
let items = $state(['a', 'b', 'c'])
5048
</script>
5149
52-
<List items={['a', 'b', 'c']} />
50+
<List bind:items />
5351
```
5452

5553
## Data-Driven Controls
@@ -60,19 +58,19 @@ One of the key features of Rokkit is its data-driven controls. These controls au
6058
<script>
6159
import { List } from '@rokkit/ui'
6260
63-
let items = ['a', 'b', 'c']
64-
let value
61+
let items = $state(['a', 'b', 'c'])
62+
let value = $state(null)
6563
</script>
6664
67-
<List {items} bind:value />
65+
<List bind:items bind:value />
6866
```
6967

7068
## Themeable Controls
7169

7270
To apply a theme to your controls, simply pass a theme prop to the body element.
7371

7472
```svelte
75-
<svelte:body class="rokkit dark" />
73+
<svelte:body data-style="rokkit" data-mode="dark" />
7674
```
7775

7876
If you want to provide users the option of switching between dark theme and light mode or custom themes, then you can also use the `themable` action with the `ToggleThemeMode` component.

‎sites/learn/src/lib/index.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
* @returns {any}
88
*/
99
export function findItemInMenu(menu, url) {
10+
if (!Array.isArray(menu)) return null
11+
1012
for (const item of menu) {
1113
if (item.route && url.pathname.endsWith(item.route)) return item
12-
if (item.children) {
13-
const found = findItemInMenu(item.children, url)
14-
if (found) return found
15-
}
14+
const childResult = findItemInMenu(item.children, url)
15+
if (childResult) return childResult
1616
}
17+
1718
return null
1819
}

‎sites/learn/src/routes/+page.svelte

-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
<script>
22
import { getContext } from 'svelte'
3-
// import { goto } from '$app/navigation'
4-
// import Button from './Button.svelte'
53
import Background from './Background.svelte'
64
const site = getContext('site')()
75
86
let { data } = $props()
9-
10-
// $effect(() => {
11-
// site.title = data.app.name ?? site.title
12-
// site.description = data.app.about ?? site.description
13-
// })
147
</script>
158

169
<main class="bg-neutral-inset relative flex h-full w-full max-w-full flex-col overflow-auto">

0 commit comments

Comments
 (0)
Please sign in to comment.