This commit is contained in:
Daniëlle Huisman 2024-11-24 13:03:20 +01:00
parent 719f62a655
commit 49a2c4915b
17 changed files with 328 additions and 0 deletions

2
.github/FUNDING.yml vendored Normal file
View file

@ -0,0 +1,2 @@
github: RustForWeb
open_collective: rustforweb

25
.github/labels.yml vendored Normal file
View file

@ -0,0 +1,25 @@
- name: 'type: bug'
description: 'Bug'
color: '3e63dd'
- name: 'type: documentation'
description: 'Documentation'
color: '3e63dd'
- name: 'type: feature'
description: 'Feature'
color: '3e63dd'
- name: 'type: maintenance'
description: 'Maintenance'
color: '3e63dd'
- name: 'type: question'
description: 'Question'
color: '3e63dd'
- name: 'framework: dioxus'
description: 'Dioxus'
color: 'd6409f'
- name: 'framework: leptos'
description: 'Leptos'
color: 'd6409f'
- name: 'framework: yew'
color: 'd6409f'
description: 'Yew'

3
.github/renovate.json vendored Normal file
View file

@ -0,0 +1,3 @@
{
"extends": ["config:recommended", "schedule:weekly", ":prConcurrentLimitNone", ":prHourlyLimitNone"]
}

17
.github/workflows/labels.yml vendored Normal file
View file

@ -0,0 +1,17 @@
name: Labels
on:
workflow_dispatch:
jobs:
sync-labels:
name: Sync Labels
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: .github/labels.yml
- uses: EndBug/label-sync@v2
with:
config-file: .github/labels.yml

22
book/book.toml Normal file
View file

@ -0,0 +1,22 @@
[book]
authors = ["Daniëlle Huisman"]
language = "en"
multilingual = false
src = "src"
title = "Rust Lucide"
[preprocessor.tabs]
[preprocessor.trunk]
[output.html]
additional-css = ["theme/tabs.css", "theme/theme.css", "theme/trunk.css"]
additional-js = ["theme/tabs.js", "theme/theme.js", "theme/trunk.js"]
edit-url-template = "https://github.com/RustForWeb/lucide/edit/main/book/{path}"
git-repository-url = "https://github.com/RustForWeb/lucide"
[output.trunk]
serve = true
[rust]
edition = "2021"

8
book/src/SUMMARY.md Normal file
View file

@ -0,0 +1,8 @@
# Summary
- [Introduction](./introduction.md)
- [Frameworks](./frameworks/README.md)
- [Dioxus](./frameworks/dioxus.md)
- [Leptos](./frameworks/leptos.md)
- [Yew](./frameworks/yew.md)
- [Contributing]()

View file

@ -0,0 +1,5 @@
# Frameworks
- [Dioxus](./dioxus.md)
- [Leptos](./leptos.md)
- [Yew](./yew.md)

View file

@ -0,0 +1,3 @@
# Lucide Dioxus
TODO

View file

@ -0,0 +1,3 @@
# Lucide Leptos
TODO

View file

@ -0,0 +1,3 @@
# Lucide Yew
TODO

27
book/src/introduction.md Normal file
View file

@ -0,0 +1,27 @@
<!-- <p align="center">
<img src="./images/logo.svg" width="300" height="200" alt="Rust Lucide Logo">
</p> -->
# Introduction
Rust Lucide is a Rust port of [Lucide](https://lucide.dev/).
[Lucide](https://lucide.dev/) is a beautiful & consistent icon toolkit made by the community.
## Frameworks
Rust Lucide is available for the following frameworks:
- [Dioxus](https://dioxuslabs.com/)
- [Leptos](https://leptos.dev/)
- [Yew](https://yew.rs/)
## License
This project is available under the [MIT license](https://github.com/RustForWeb/lucide/blob/main/LICENSE.md).
## Rust For Web
The Rust Lucide project is part of the [Rust For Web](https://github.com/RustForWeb).
[Rust For Web](https://github.com/RustForWeb) creates and ports web UI libraries for Rust. All projects are free and open source.

25
book/theme/tabs.css Normal file
View file

@ -0,0 +1,25 @@
.mdbook-tabs {
display: flex;
}
.mdbook-tab {
background-color: var(--table-alternate-bg);
padding: 0.5rem 1rem;
cursor: pointer;
border: none;
font-size: 1.6rem;
line-height: 1.45em;
}
.mdbook-tab.active {
background-color: var(--table-header-bg);
font-weight: bold;
}
.mdbook-tab-content {
padding: 1rem 0rem;
}
.mdbook-tab-content table {
margin: unset;
}

75
book/theme/tabs.js Normal file
View file

@ -0,0 +1,75 @@
/**
* Change active tab of tabs.
*
* @param {Element} container
* @param {string} name
*/
const changeTab = (container, name) => {
for (const child of container.children) {
if (!(child instanceof HTMLElement)) {
continue;
}
if (child.classList.contains('mdbook-tabs')) {
for (const tab of child.children) {
if (!(tab instanceof HTMLElement)) {
continue;
}
if (tab.dataset.tabname === name) {
tab.classList.add('active');
} else {
tab.classList.remove('active');
}
}
} else if (child.classList.contains('mdbook-tab-content')) {
if (child.dataset.tabname === name) {
child.classList.remove('hidden');
} else {
child.classList.add('hidden');
}
}
}
};
document.addEventListener('DOMContentLoaded', () => {
const tabs = document.querySelectorAll('.mdbook-tab');
for (const tab of tabs) {
tab.addEventListener('click', () => {
if (!(tab instanceof HTMLElement)) {
return;
}
if (!tab.parentElement || !tab.parentElement.parentElement) {
return;
}
const container = tab.parentElement.parentElement;
const name = tab.dataset.tabname;
const global = container.dataset.tabglobal;
changeTab(container, name);
if (global) {
localStorage.setItem(`mdbook-tabs-${global}`, name);
const globalContainers = document.querySelectorAll(
`.mdbook-tabs-container[data-tabglobal="${global}"]`
);
for (const globalContainer of globalContainers) {
changeTab(globalContainer, name);
}
}
});
}
const containers = document.querySelectorAll('.mdbook-tabs-container[data-tabglobal]');
for (const container of containers) {
const global = container.dataset.tabglobal;
const name = localStorage.getItem(`mdbook-tabs-${global}`);
if (name && document.querySelector(`.mdbook-tab[data-tabname=${name}]`)) {
changeTab(container, name);
}
}
});

3
book/theme/theme.css Normal file
View file

@ -0,0 +1,3 @@
table {
margin: unset;
}

13
book/theme/theme.js Normal file
View file

@ -0,0 +1,13 @@
window.addEventListener('message', (event) => {
if (!event.data.mdbookTrunk) {
return;
}
const data = event.data.mdbookTrunk;
const iframe = Array.from(document.getElementsByTagName('iframe')).find(
(iframe) => iframe.contentWindow === event.source
);
if (iframe) {
iframe.style.height = `${data.height}px`;
}
});

41
book/theme/trunk.css Normal file
View file

@ -0,0 +1,41 @@
.mdbook-trunk-iframe {
display: block;
width: 100%;
border: 0.1em solid var(--quote-border);
}
.mdbook-trunk-files-container {
width: 100%;
border: 0.1em solid var(--quote-border);
border-top: 0em;
background-color: var(--quote-border);
}
.mdbook-trunk-files {
display: flex;
}
.mdbook-trunk-files-header {
padding: 0.5rem 1rem;
font-weight: bold;
font-size: 1.6rem;
line-height: 1.45em;
}
.mdbook-trunk-file {
background-color: var(--table-alternate-bg);
padding: 0.5rem 1rem;
cursor: pointer;
border: none;
font-size: 1.6rem;
line-height: 1.45em;
}
.mdbook-trunk-file.active {
background-color: var(--table-header-bg);
font-weight: bold;
}
.mdbook-trunk-file-content > pre {
margin: 0rem;
}

53
book/theme/trunk.js Normal file
View file

@ -0,0 +1,53 @@
/**
* Change active file of files.
*
* @param {Element} container
* @param {string | null} name
*/
const changeTrunkFile = (container, name) => {
for (const child of container.children) {
if (!(child instanceof HTMLElement)) {
continue;
}
if (child.classList.contains('mdbook-trunk-files')) {
for (const file of child.children) {
if (!(file instanceof HTMLElement)) {
continue;
}
if (file.dataset.file === name) {
file.classList.add('active');
} else {
file.classList.remove('active');
}
}
} else if (child.classList.contains('mdbook-trunk-file-content')) {
if (child.dataset.file === name) {
child.classList.remove('hidden');
} else {
child.classList.add('hidden');
}
}
}
};
document.addEventListener('DOMContentLoaded', () => {
const files = document.querySelectorAll('.mdbook-trunk-file');
for (const file of files) {
file.addEventListener('click', () => {
if (!(file instanceof HTMLElement)) {
return;
}
if (!file.parentElement || !file.parentElement.parentElement) {
return;
}
const container = file.parentElement.parentElement;
const name = file.dataset.file;
changeTrunkFile(container, file.classList.contains('active') ? null : name);
});
}
});