Thanks to visit codestin.com
Credit goes to github.com

Skip to content

wobyjs/demo

Repository files navigation

Voby's Banne

Join The Discord Chat Open The Playground Donate With Open Collective

Woby Demos

This directory contains various demos showcasing the capabilities of the Woby framework.

Available Demos

  1. Counter - Basic counter component demonstrating custom elements, reactive properties, nested properties, style attributes, and context usage
  2. Counter SSR - Server-side rendering version of the counter component
  3. More demos coming soon...

Documentation

For detailed documentation, please see:

Getting Started

To run the demos:

  1. Ensure all dependencies are installed
  2. Build the Woby framework
  3. Serve the demo directory
  4. Open in a web browser

Each demo directory contains its own README with specific instructions for running that demo.

Voby Demo Projects

This repository contains demo projects showcasing the capabilities of the Woby framework.

Demos

Each demo demonstrates different aspects of Woby's functionality:

Key Features Demonstrated

Reactive State Management

All demos showcase Woby's fine-grained reactivity system using observables:

import { $, $$ } from 'woby'

const count = $(0)  // Create reactive state
const increment = () => count(c => c + 1)  // Update state

Advanced Class Management

Woby includes powerful built-in class management that supports complex class expressions similar to classnames and clsx libraries:

// Array of classes
<div class={['red', 'bold']}>Text</div>

// Nested arrays
<div class={['red', ['bold', ['italic']]]}>Text</div>

// Mixed types with reactive expressions
<div class={[
  "base-class",
  () => ($$(value) % 2 === 0 ? "even" : "odd"),
  { hidden: true, italic: false },
  ['hello', ['world']]
]}>Complex classes</div>

// Object syntax for conditional classes
<div class={{
  'active': isActive,
  'disabled': isDisabled,
  'loading': isLoading
}}>Status element</div>

Component Composition

Demos show various component patterns:

import { customElement } from 'woby'

// Custom elements
customElement('my-counter', Counter, 'value')

// Higher-order components
const withLogging = (Component) => (props) => {
  console.log('Component rendered with props:', props)
  return <Component {...props} />
}

Performance Optimizations

Woby's architecture eliminates the need for virtual DOM and provides automatic fine-grained updates:

  • No VDOM overhead
  • No stale closures
  • No dependency arrays
  • No props diffing
  • No key props needed for lists

Hooks and Utilities

Demos utilize Woby's comprehensive hook system:

import { 
  useAnimationLoop, 
  useEventListener, 
  useInterval, 
  usePromise,
  useMemo
} from 'woby'

// Animation loops
useAnimationLoop((time) => {
  // Update animations
})

// Event listeners
useEventListener('resize', handleResize)

// Intervals
useInterval(() => {
  // Periodic updates
}, 1000)

Getting Started

  1. Clone this repository:

    git clone https://github.com/wobyjs/demo.git
  2. Install dependencies:

    cd demo
    pnpm install
  3. Run any demo:

    cd demo/counter
    pnpm dev

Live Examples

You can also view these demos online:

Documentation

For comprehensive documentation about Woby, visit:

Contributing

Contributions are welcome! Please read our contributing guidelines before submitting pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published