Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
4832b61
migration to 0.21
goodidea-kp Jun 5, 2024
0a7dbd5
migration to 0.21
goodidea-kp Jun 5, 2024
2af7b60
migration to 0.21
goodidea-kp Jun 5, 2024
0587d3e
migration to 0.21
goodidea-kp Jun 5, 2024
8383158
migration to 0.21
goodidea-kp Jun 5, 2024
14e16a3
migration to 0.21
goodidea-kp Jun 5, 2024
131b3fa
remove debug comments
goodidea-kp Jun 5, 2024
21236f9
remove debug comments
goodidea-kp Jun 5, 2024
a14f0e8
remove debug comments
goodidea-kp Jun 5, 2024
d3c2c8e
remove debug comments
goodidea-kp Jun 5, 2024
8dd3f61
Merge pull request #1 from goodidea-kp/migration-0.21
goodidea-kp Jun 5, 2024
a01f607
add Calendar with datetime type
goodidea-kp Jun 5, 2024
cfb00ba
Create rust.yml
goodidea-kp Jun 5, 2024
67edac7
fix tests
goodidea-kp Jun 5, 2024
a288677
Merge remote-tracking branch 'origin/master'
goodidea-kp Jun 5, 2024
da2fc54
fix defect
goodidea-kp Jun 6, 2024
34c6e26
fix defect in format
goodidea-kp Jun 6, 2024
49e2d19
added calendar use example, fix minor warnings
goodidea-kp Jun 9, 2024
bf5f8bb
added calendar use example, fix minor warnings
goodidea-kp Jun 9, 2024
b695db7
Update ci.yaml
goodidea-kp Jun 10, 2024
61eb951
formatting
goodidea-kp Jun 10, 2024
79abc54
Merge pull request #2 from goodidea-kp/feature/accordion
goodidea-kp Jun 10, 2024
139d50f
Update README.md
goodidea-kp Jun 10, 2024
3df8a06
fix defect and add step
goodidea-kp Jun 13, 2024
4bf15d8
formatting
goodidea-kp Jun 13, 2024
39c10a0
formatting
goodidea-kp Jun 13, 2024
6ba7297
Merge pull request #3 from goodidea-kp/fix/defect-in-calendar
goodidea-kp Jun 13, 2024
80c65f8
simplify and fix defect
goodidea-kp Jun 15, 2024
2b15270
remove logging
goodidea-kp Jun 15, 2024
99bbf84
formatting
goodidea-kp Jun 15, 2024
c053415
Merge pull request #4 from goodidea-kp/fix/calendar-defect
goodidea-kp Jun 15, 2024
27fe1b5
add autocomplete
goodidea-kp Jun 21, 2024
c225aca
Update autocomplete component with dynamic fetching
goodidea-kp Jun 22, 2024
64259cc
Refactor autocomplete component and remove unnecessary logs
goodidea-kp Jun 23, 2024
5805e73
Change field label and placeholder in AutoComplete
goodidea-kp Jun 23, 2024
7e5ddf5
Remove console log from autocomplete setup
goodidea-kp Jun 23, 2024
aa949d2
Refactor string properties to use Rc<str>
goodidea-kp Jun 23, 2024
81e93c4
Replace String with Rc<str> in accordion component
goodidea-kp Jun 24, 2024
f7fd9e1
Add initial value support to the dynamic autocomplete function
goodidea-kp Jun 24, 2024
2f84fa6
Merge pull request #5 from goodidea-kp/feature/autocomplete
goodidea-kp Jun 24, 2024
8d5559a
Update progress bar functionality
goodidea-kp Jun 30, 2024
0950821
Merge pull request #6 from goodidea-kp/fix/progress
goodidea-kp Jun 30, 2024
40f626f
Add interactive textarea and ChatGPT icon
goodidea-kp Jul 7, 2024
5981dfa
Merge pull request #7 from goodidea-kp/fix/progress
goodidea-kp Jul 7, 2024
5c89c5a
update web-sys to 0.3.77
goodidea-kp Jul 22, 2025
703f273
cleanup formatting in examples/basic/src/main.rs
goodidea-kp Jul 22, 2025
01d5028
bump serde to 1.0.228 and update CI workflow
goodidea-kp Oct 16, 2025
9bbbab1
bump edition to 2024, update dependencies, and simplify derive_more d…
goodidea-kp Oct 16, 2025
abff6bd
organize imports and fix duplicate `Box` export
goodidea-kp Oct 16, 2025
f56a4ed
Merge branch 'master' into migration-0.21
goodidea-kp Oct 17, 2025
daf436a
Merge pull request #8 from goodidea-kp/migration-0.21
goodidea-kp Oct 17, 2025
093af37
organize and deduplicate imports in components
goodidea-kp Oct 17, 2025
9355f16
Merge pull request #9 from goodidea-kp/fix/defects
goodidea-kp Oct 17, 2025
0848fbf
add example pages for panel, card, form, table, columns, calendar, an…
goodidea-kp Oct 28, 2025
7de9985
Replace all section and container elements with `ybc::Section` and `y…
goodidea-kp Oct 28, 2025
d2e4f6a
Add calendar component example with date/time picker integration
goodidea-kp Oct 28, 2025
b83f251
Refactor initialization and formatting preferences
goodidea-kp Oct 28, 2025
99bb37b
Merge pull request #10 from goodidea-kp/feature/catalog
goodidea-kp Oct 28, 2025
f3c06fa
Refactor unused variable bindings and update module reference paths
goodidea-kp Oct 28, 2025
344ef3a
Merge pull request #11 from goodidea-kp/feature/catalog
goodidea-kp Oct 28, 2025
31aacc7
Add GitHub Pages workflow and enhance documentation configuration
goodidea-kp Oct 28, 2025
64ae902
Remove `doc_auto_cfg` feature flag for docs.rs compatibility
goodidea-kp Oct 28, 2025
0dca28a
Update README link to new repository URL in documentation
goodidea-kp Oct 28, 2025
96fafe3
Merge pull request #12 from goodidea-kp/feature/pub-step
goodidea-kp Oct 28, 2025
7e4c5c6
Add `configure-pages` step to GitHub Pages workflow (#13)
goodidea-kp Oct 28, 2025
189cf72
Enable GitHub Pages configuration in `docs-pages` workflow (#14)
goodidea-kp Oct 28, 2025
24666a5
Enable GitHub Pages configuration in `docs-pages` workflow (#15)
goodidea-kp Oct 28, 2025
a334cd4
Feature/pub 4 (#16)
goodidea-kp Oct 28, 2025
8d978d3
Update Cargo.toml with repository metadata and YBC dependency from Gi…
goodidea-kp Oct 29, 2025
65cea52
Update `navbar` and `modal` examples with additional usage rules in t…
goodidea-kp Oct 29, 2025
2f6bbe3
Fix select component value handling and enhance modal documentation (…
goodidea-kp Oct 30, 2025
97c2136
Bump Yew-related dependencies and update package version to 0.4.2 (#20)
goodidea-kp Dec 9, 2025
aee737a
Refactor modal components and update dependencies (#21)
goodidea-kp Feb 18, 2026
59a6202
Add accessibility enhancements and state management for components (#22)
goodidea-kp Feb 19, 2026
fb38982
Add accessibility attributes and replace modal close buttons with `De…
goodidea-kp May 25, 2026
6de9d97
Update `yew` and `yew-router` dependencies, bump versions for `ybc`, …
goodidea-kp May 25, 2026
b437973
Fix ModalCard title/body overflowing the viewport for long content (#24)
goodidea-kp Jul 11, 2026
3b2ab05
Fix/modal card title overflow (#25)
goodidea-kp Jul 11, 2026
f5a8a72
Make ModalCard containment viewport-safe regardless of breakpoint (#26)
goodidea-kp Jul 11, 2026
ca521fd
Fix extra line break in README introduction
goodidea-kp Jul 15, 2026
f1e564d
Fix PanelTabs a11y: drop role="tablist" (aria-required-children) (#27)
goodidea-kp Jul 15, 2026
b046442
Add maxlength prop to Input and TextArea (#28)
goodidea-kp Jul 17, 2026
8a7bac0
Bump version to 0.4.8 in Cargo.toml
goodidea-kp Jul 17, 2026
958bba0
Feat/tab example (#29)
goodidea-kp Jul 17, 2026
6871205
fix(calendar): guard bulma-calendar destroy() against a removed DOM n…
goodidea-kp Jul 24, 2026
ad2752e
Feature/components improve (#31)
goodidea-kp Sep 14, 2026
23153ff
calendar change (#32)
goodidea-kp Oct 3, 2026
afc37d2
fix(calendar): hide the native fallback under Bulma, keep the picker'…
goodidea-kp Oct 3, 2026
484651c
fix(calendar): Cancel closes the picker (#33)
goodidea-kp Oct 3, 2026
ec2ad55
feat(modal): scroll shadows on a modal body that scrolls; share the s…
goodidea-kp Oct 5, 2026
477263f
feat(a11y): Callout, CopyButton, ReasonedButton, IconText; keyboard-r…
goodidea-kp Oct 5, 2026
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
73 changes: 73 additions & 0 deletions .claude/skills/rust-code-style/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
name: rust-code-style
description: Project conventions for this Yew/WASM frontend — Rust coding style grounded in programmer-cognition research (Felienne Hermans' "The Programmer's Brain") plus Yew 0.23 framework best practices. Use when writing, reviewing, or refactoring code in this project to keep names descriptive, functions short and single-purpose, error handling explicit, Rust idioms (iterators, `?`, exhaustive matching, newtypes) applied consistently, AND Yew components correct (pure `view`, side effects driven by messages not `changed()`, keyed lists, no panics in WASM, deliberate cloning).
---

# Rust + Yew Code Style

Conventions for writing and reviewing this project's code. It is a **Yew 0.23** WASM single-page app
(struct components, `yew-router`, `ybc`/Bulma, `gloo-*`, `reqwasm`), so the rules cover both general
Rust style **and** Yew framework usage. The guiding rule: **write code for the human brain, not the computer.** Code is read far more often than written, so every decision should reduce the reader's cognitive load.

## Core Principles

1. **Optimize for reading, not writing** — code is read ~10x more than written.
2. **Reduce cognitive load** — working memory holds ~7 items; don't waste slots on cryptic names.
3. **Make intent explicit** — names reveal purpose without forcing the reader to hold context in their head.
4. **Favor clear beacons** — readers scan for recognizable patterns; descriptive names beat single letters.

These cash out into four defaults: full names over abbreviations, explicit over implicit, simple over clever, readable over writeable.

## The non-negotiable rule

**Never use single-letter variable names**, except in three narrow cases: tiny (1–2 line) closures with obvious context, math formulas matching standard domain notation (`dx`, `dy`), and generic type parameters (`T`, `U`). When in doubt, use a full name.

## Reference guides

Load the relevant guide when working in that area — each contains DON'T/DO examples:

- **[references/naming.md](references/naming.md)** — variable, loop, iterator, boolean, function, and domain naming; abbreviations; pronounceability.
- **[references/functions.md](references/functions.md)** — function length (≤25 lines), single responsibility, parameter limits (≤3), nesting depth (≤2), guard clauses.
- **[references/rust-idioms.md](references/rust-idioms.md)** — explicit signatures, type aliases, newtypes, enums for state, avoiding `unwrap()`/`expect()`, error context, exhaustive matching, `#[must_use]`, iterators, `?`, `let-else`, `LazyLock`/`OnceLock`, `NonZero<T>`, `#[non_exhaustive]`.
- **[references/organization-and-quality.md](references/organization-and-quality.md)** — module structure, file size limits, comments (why not what), public-API docs, error design, testing conventions, anti-patterns (god objects, magic numbers, clever code).
- **[references/yew-best-practices.md](references/yew-best-practices.md)** — Yew 0.23 component conventions: pure `view`, side effects from messages (not `changed()`), keyed lists, no panics in WASM (`SessionStorage`/header/JSON `unwrap`), deliberate cloning + `Rc`, `Properties` design, initial-load placement, callbacks, shared context, `yew-router`, and when to use function components + hooks. **Load this whenever touching anything under `src/components/`, `src/pages/`, or `lib.rs`.**

## Code review checklist

Tooling (run first — catches most mechanical issues automatically):
- [ ] `cargo fmt` applied
- [ ] `cargo clippy -- -D warnings` passes

Naming and structure:
- [ ] No single-letter variable names (except the limited exceptions above)
- [ ] All names are clear and descriptive
- [ ] Functions are short and focused (<25 lines)
- [ ] Nesting depth is minimal (≤2 levels) — use `let-else` for destructuring guards

Error handling:
- [ ] No `unwrap()` or `expect()` in production code
- [ ] Error handling is explicit with context
- [ ] String formatting uses capture syntax: `"{val}"` not `"{}"` + val

API design:
- [ ] Public APIs have documentation
- [ ] Public enums in library code are `#[non_exhaustive]` if they may grow
- [ ] Types make invalid states unrepresentable where possible

Yew components (see [references/yew-best-practices.md](references/yew-best-practices.md) for details):
- [ ] `view` is pure — no I/O, storage writes, `unwrap()`/panics, or heavy computation
- [ ] No side effects in `changed()` — only prop→state reconciliation (a user action → `Msg` → effect)
- [ ] Every `.map()`-rendered list element has a stable `key` (uuid/id, not the array index)
- [ ] No `unwrap()`/`expect()` on `SessionStorage`, response headers, or JSON — route to `Msg::Error`/`Logoff` (WASM panics blank the page)
- [ ] `.clone()` limited to values moved into closures/`async move`; large shared data uses `Rc<T>`
- [ ] `Properties` derive `PartialEq`, stay small, pass `Callback`s/ids (or `Rc<…>`) not big owned collections
- [ ] Initial data loads in `create`/`rendered(first_render)`, never in `view`
- [ ] In-app navigation uses `yew-router` (`Navigator`/`Link`), not `window.location`

General:
- [ ] File is ≤500 lines — split by responsibility if over; target is 200–300
- [ ] Tests are comprehensive with descriptive names
- [ ] No commented-out code
- [ ] No magic numbers — all constants are named
- [ ] Code follows existing patterns in the codebase (struct components stay struct components)
- [ ] Rust idioms are used (iterators, `?`, `let-else`, pattern matching)
125 changes: 125 additions & 0 deletions .claude/skills/rust-code-style/references/functions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Function Design

## Contents
- [Keep functions short](#keep-functions-short)
- [Single Responsibility Principle](#single-responsibility-principle)
- [Limit function parameters](#limit-function-parameters)
- [No deep nesting](#no-deep-nesting)

## Keep functions short

**Target:** 5–15 lines. **Maximum:** 25 lines. If longer, extract smaller functions with descriptive names.

## Single Responsibility Principle

Each function does one thing well.

**DON'T:**
```rust
fn process_user(id: i32) -> Result<()> {
let user = db.fetch(id)?;
if user.email.is_empty() { return Err(Error::Invalid); }
let perms = calc_perms(&user)?;
db.update_perms(user.id, perms)?;
email::send(&user.email, "Welcome")?;
log::info("User processed: {}", user.id);
cache.invalidate(user.id);
Ok(())
}
```

**DO:**
```rust
fn process_user(id: i32) -> Result<()> {
let user = fetch_and_validate_user(id)?;
grant_user_permissions(&user)?;
notify_user_by_email(&user)?;
log_user_activity(&user)?;
invalidate_user_cache(&user)?;
Ok(())
}
```

## Limit function parameters

**Maximum:** 3 parameters. If more are needed, use a struct/config object.

**DON'T:**
```rust
fn create_user(
name: String,
email: String,
age: i32,
role: String,
dept: String,
manager: String,
location: String
) -> User
```

**DO:**
```rust
struct CreateUserRequest {
name: String,
email: String,
age: i32,
role: String,
department: String,
manager: String,
location: String,
}

fn create_user(request: CreateUserRequest) -> User
```

## No deep nesting

**Maximum nesting level:** 2. Use early returns, guard clauses, and `let-else` for destructuring guards (stable since 1.65).

**DON'T:**
```rust
fn process(data: Option<Data>) -> Result<()> {
if let Some(d) = data {
if d.is_valid() {
if d.has_permission() {
if d.is_ready() {
// deeply nested work
}
}
}
}
Ok(())
}
```

**DO:**
```rust
fn process(data: Option<Data>) -> Result<()> {
let data = data.ok_or(Error::NoData)?;

if !data.is_valid() {
return Err(Error::Invalid);
}
if !data.has_permission() {
return Err(Error::Forbidden);
}
if !data.is_ready() {
return Err(Error::NotReady);
}

// work at top level
Ok(())
}
```

When the guard involves destructuring, prefer `let-else` over `if let` + nesting:

```rust
fn process(event: Option<Event>) -> Result<()> {
let Some(event) = event else {
return Ok(());
};
// event is in scope here, no extra nesting
handle(event)
}
```
Loading