WildflowerJS Reactive JS, No BS*

A no-build reactive JavaScript framework, rooted in the web platform.
No build step. No dependencies. No lock-in.

<script src="wildflower.min.js"></script> ...and start building.

Back to Basics

The code you write is 100% web standard code. HTML stays HTML. JavaScript stays JavaScript. CSS stays CSS. No JSX, no templating language, no custom syntax to learn. If you know the web platform, you already know how to use this.

WildflowerJS extends the web platform. It doesn't replace it.

Your Development Simplified

Because you develop with 100% web standards, every tool in your existing chain already understands the code: IDE, browser DevTools, linter, formatter, screen reader, SEO crawler. Nothing to install, no custom file types, no sourcemaps. Save the file, refresh, and your change is live.

Just be a web developer.

Batteries Included: One Mental Model

Router, SSR, stores, computed properties, two-way binding, event modifiers, data pools, and TypeScript types, all built in, all speaking the same language. Learn data-bind once and you know binding everywhere: lists, pools, stores, forms. There's no five-library stack to keep in sync.

One script tag. Everything you need.

<div data-component="counter">
  <span data-bind="count"></span>
  <button data-action="increment">
    +1
  </button>
</div>

<script>
wildflower.component('counter', {
  state: { count: 0 },
  increment() { this.count++ }
})
</script>

How It Works

data-bind connects state to the DOM.

data-action connects events to methods.

this.count++ triggers a precise DOM update.

Mutate state. The DOM updates.

Two Reactivity Modes

data-list for automatic reactivity: mutate state, DOM updates. data-pool for explicit control: plain objects, zero proxy overhead, you say what changed.

Same template syntax. Different performance profile. From interactive forms to per-frame particle systems. You choose the right tradeoff for the job.

Try it. Right-click, inspect this demo. Every dot is a real DOM element.

See full demo →

* Build Step

Zero Toolchain

Modern frameworks ask you to install a compiler, a bundler, a package manager, hundreds of fragile transitive dependencies, and a framework-specific file format, before you write a single line of your application.

WildflowerJS was built starting from a single principle: no build step, no tooling. Ever.

WildflowerJS asks you to add a script tag.

There's no CLI scaffolding step, no config files, no .vue/.jsx/.svelte source format. You don't debug through sourcemaps or wait on a build pipeline. Your project has zero dependencies.

Performance isn't a tradeoff. Build steps optimize bundle delivery, not the runtime work that follows it. WildflowerJS writes directly to the DOM, with no virtual DOM or reconciliation pass between state change and update, so it doesn't need a build step to be fast.

The framework is full-featured without the toolchain: router, SSR, stores, computed properties, transitions, pools. You don't need a toolchain to use any of it.

my-app/
  index.html
  app.js
  style.css
  wildflower.min.js

That's the entire project. No package.json.
No node_modules. No config files. Ship it.

Zero Install. Zero Attack Surface.

Every dependency you install is trust extended to a maintainer you've never met, running scripts on your dev machine and in your CI. A typical React + Vite + UI‑lib setup pulls in 300+ transitive packages before you write a feature.

Each one is a potential intrusion vector. NPM worms, OAuth chains compromising deploy platforms, postinstall hijacking: the supply chain is now where production code gets compromised, not the deploy. And signing isn't a backstop: Mini Shai‑Hulud (May 2026) compromised 170+ packages whose malicious versions carried valid SLSA Build Level 3 provenance, because the attestation came from build infrastructure the worm had already taken over.

WildflowerJS users don't have this attack surface, by construction. There is no npm install, no postinstall script, no transitive package graph. The framework is one file you copy or pin by hash.

As of v1.1, the same holds for building the framework itself. WildflowerJS bundles with a vendored rollup and terser pipeline pulled as three SHA‑512‑pinned tarballs: no npm install, no transitive packages, no postinstall scripts in the build path. The entire toolchain is three files you verify by hash.

Zero dependencies is the absence of a problem the rest of the industry has not properly addressed.

A typical React/Vue project:

  npm install
  ├── hundreds of packages
  ├── from hundreds of maintainers
  ├── postinstall scripts run on install
  └── tens to hundreds of MB of transitive code

WildflowerJS:

  <script src="wildflower.min.js"></script>
  └── 1 file.
      No transitive dependencies.

Zero Lock-in

WildflowerJS works with the DOM, not instead of it. There's no virtual DOM intercepting your code and no compiler rewriting your markup. The render cycle is yours.

That means Leaflet, DataTables, Chart.js, D3, Three.js, any library that touches the DOM, just works. No wrapper packages or framework-specific escape hatches required. Drop in a script tag and use it.

Because your code is standard HTML and JavaScript, you're never locked in. Your skills transfer and your code is more portable. If you outgrow the framework, your knowledge doesn't expire.

This also means your "ecosystem" is all of the world of vanilla JS. Without compromises or hacks.

<!-- Use any library directly -->
<div data-component="map-view">
  <div id="map" style="height: 400px"></div>
</div>
wildflower.component('map-view', {
  state: { lat: 51.505, lng: -0.09 },
  init() {
    // Leaflet works as-is. No wrappers.
    this._map = L.map('map')
      .setView([this.lat, this.lng], 13);
    L.tileLayer('https://{s}.tile.osm.org'
      + '/{z}/{x}/{y}.png').addTo(this._map);
  }
})

Precise Reactivity

When you write this.count++, WildflowerJS updates the single DOM node bound to count. Nothing else is touched. There's no tree diffing or reconciliation pass to figure that out.

This isn't a tradeoff. You get fine-grained updates and a simple mental model. Change a property, the bound element updates. That's the entire reactivity model.

Other frameworks ask you to learn signals, accessors, memos, effects, and subscription lifecycles to achieve what WildflowerJS does with a property assignment.

wildflower.component('dashboard', {
  state: {
    users: 1420,
    status: 'healthy'
  },
  computed: {
    summary() {
      return this.users + ' users, ' + this.status;
    }
  },
  refresh() {
    this.users = 1421;
    // Only the elements bound to 'users'
    // and 'summary' update. Everything
    // else on the page is untouched.
  }
})

One Reactivity Model. Everywhere.

Components, Stores, and Plugins all share the same reactive foundation. State, computed properties, and methods work identically no matter where they live. Learn it once, it works the same way in a UI component, a global store, or a framework plugin.

Other frameworks make you learn a different system for each layer. React components use hooks, but stores need Redux or Zustand, which are completely different APIs. Vue components use reactive data, but Pinia stores have their own patterns. Every layer is a new mental model.

In WildflowerJS, there's one model. A store is a component without a template. A plugin is an entity that extends the framework itself, adding directives, lifecycle hooks, and services. The same this.count++ triggers the same reactivity everywhere.

This unlocks patterns other frameworks can't express. A store can run headless physics simulations with tick(), feeding data into a component that renders it through a pool, all using the same reactive primitives, no glue code required.

// Component: reactive UI
wildflower.component('cart', {
  state: { items: [] },
  computed: {
    total() { return this.items.length; }
  }
})

// Store: global shared state
wildflower.store('user', {
  state: { name: '', role: 'guest' },
  computed: {
    isAdmin() { return this.role === 'admin'; }
  }
})

// Plugin: extends the framework
wildflower.plugin({
  name: 'notifications',
  state: { items: [], unreadCount: 0 },
  computed: {
    hasUnread() { return this.unreadCount > 0; }
  },
  add(msg) { this.items.push(msg); this.unreadCount++; }
})
// Access globally: wildflower.$notifications.add(...)

// Same state. Same computed. Same methods.

Data Pools

Every framework wraps collection items in reactive proxies, whether the item needs it or not. WildflowerJS gives you a choice: data-list for push reactivity (automatic), data-pool for pull reactivity (explicit control, zero proxy overhead).

Pools render plain objects with the same template syntax as lists. Mutate the object, call markDirty(), and only that item updates. Full CRUD, selection, bulk operations, all faster than the push-reactive path.

And because pools use pull-based rendering, they scale to simulations, games, particle systems, and data visualizations at native frame rate. Use cases that would choke a virtual DOM. No other framework has anything like this.

<div data-component="user-table">
  <tbody data-pool="users" data-key="id">
    <template>
      <tr>
        <td data-bind="name"></td>
        <td data-bind="status"
            data-bind-class="status === 'active'
              ? 'badge success'
              : 'badge inactive'"></td>
      </tr>
    </template>
  </tbody>
</div>
wildflower.component('user-table', {
  pools: { users: {} },

  init() {
    // Populate: plain objects, no proxies
    data.forEach(u => this.pools.users.add(u));
  },

  // Optional: add tick() and the same pool
  // renders every frame. Same template, same
  // data, different rendering frequency.
  // That's the only difference between a
  // display table and a particle system.
})

Built for AI-Assisted Development

Because WildflowerJS is standard HTML and JavaScript, AI code assistants already know how to write it. There's no custom syntax to hallucinate or compiler quirks to work around. The code an AI generates runs exactly as written, with no build step between generation and execution.

We go further. WildflowerJS ships an AI-optimized reference page with patterns, anti-patterns, and examples designed for code generation context windows. Our llms.txt file follows the llms.txt convention for machine-readable documentation.

And for structured app generation, our Universal App Manifest lets you describe an entire application as a JSON schema (components, state, computed properties, methods, templates) and have an AI generate the working code from the manifest, mediated through framework-specific idiom files.

You: "Build me a todo app with
WildflowerJS"

AI reads llms.txt or ai-assistant.html
     ↓
Generates standard HTML + JS
     ↓
<div data-component="todo-app">
  <input data-model="newItem">
  <button data-action="addItem">
    Add
  </button>
  <ul data-list="items">
    <template>
      <li data-bind="text"></li>
    </template>
  </ul>
</div>
     ↓
Open in your browser. It works, and you can read and understand the code.

Lists & Iteration

WildflowerJS renders arrays as dynamic lists using data-list and HTML <template> elements, automatically updating only the items that change.

💡 Key Concept: WildflowerJS automatically renders arrays as lists, updating only changed items for optimal performance.

Basic List Rendering

Use data-list to render arrays with HTML templates:

<div data-component="simple-list">
    <p class="text-muted">Demonstrates basic list operations with automatic updates.</p>

    <div class="mb-3">
        <button data-action="addItem" class="btn btn-primary me-2">
            Add Item
        </button>
        <button data-action="addMultiple" class="btn btn-success me-2">
            Add 3 Items
        </button>
        <button data-action="shuffle" class="btn btn-secondary me-2">
            Shuffle Order
        </button>
        <button data-action="clearAll" class="btn btn-danger">
            Clear All
        </button>
    </div>

    <div class="row mb-3">
        <div class="col-md-8">
            <p><strong>Total items:</strong> <span data-bind="itemCount" class="badge bg-primary"></span></p>
        </div>
        <div class="col-md-4">
            <small class="text-muted">Next ID: <span data-bind="nextId"></span></small>
        </div>
    </div>

    <!-- List with HTML template -->
    <ul class="list-group" data-list="items">
        <template>
            <li class="list-group-item d-flex justify-content-between align-items-center">
                <div class="d-flex align-items-center flex-grow-1">
                    <span class="badge bg-secondary me-3">#<span data-bind="id"></span></span>
                    <div>
                        <strong data-bind="name"></strong>
                        <br>
                        <small class="text-muted">
                            Created: <span data-bind="created"></span>
                        </small>
                    </div>
                </div>
                    <button data-action="moveUp"
                            class="btn btn-sm me-2"
                            data-bind-class="_first || _length === 1 ? 'btn-secondary disabled' : 'btn-primary'">
                        ↑
                    </button>
                    <button data-action="moveDown"
                            class="btn btn-sm me-2"
                            data-bind-class="_last || _length === 1 ? 'btn-secondary disabled' : 'btn-primary'">
                        ↓
                    </button>
                    <button data-action="removeItem" class="btn btn-sm btn-danger">
                        Remove
                    </button>
            </li>
        </template>
    </ul>

    <!-- Empty state -->
    <div data-show="isEmpty" class="text-center py-4">
        <div class="text-muted">
            <h5>No items in the list</h5>
            <p>Click "Add Item" to get started!</p>
        </div>
    </div>
</div>
wildflower.component('simple-list', {
    state: {
        items: [
            { id: 1, name: 'First Item', created: '10:00:00' },
            { id: 2, name: 'Second Item', created: '10:01:00' },
            { id: 3, name: 'Third Item', created: '10:02:00' }
        ],
        nextId: 4
    },

    computed: {
        itemCount() {
            return this.items.length
        },

        isEmpty() {
            return this.items.length === 0
        },

    },

    addItem() {
        const newItem = {
            id: this.nextId++,
            name: `Dynamic Item ${this.nextId - 1}`,
            created: new Date().toLocaleTimeString()
        }
        this.items.push(newItem)
        console.log('Added item:', newItem)
    },

    addMultiple() {
        const itemsToAdd = [
            { id: this.nextId++, name: `Batch Item A`, created: new Date().toLocaleTimeString() },
            { id: this.nextId++, name: `Batch Item B`, created: new Date().toLocaleTimeString() },
            { id: this.nextId++, name: `Batch Item C`, created: new Date().toLocaleTimeString() }
        ]

        // Add all items at once
        this.items.push(...itemsToAdd)
        console.log('Added multiple items:', itemsToAdd)
    },

    removeItem(event, element, details) {
        // Get the index from the framework's action context
        const index = details.index
        const removedItem = this.items[index]

        this.items.splice(index, 1)
        console.log('Removed item:', removedItem)
    },

    moveUp(event, element, details) {
        if (details.first) return  // Already at top
        const { index, item } = details
        this.items.splice(index, 1)
        this.items.splice(index - 1, 0, item)
        console.log('Moved item up:', item)
    },

    moveDown(event, element, details) {
        if (details.last) return  // Already at bottom
        const { index, item } = details
        this.items.splice(index, 1)
        this.items.splice(index + 1, 0, item)
        console.log('Moved item down:', item)
    },

    shuffle() {
        // Fisher-Yates shuffle algorithm
        const items = [...this.items]
        for (let i = items.length - 1; i > 0; i--) {
            const j = Math.floor(Math.random() * (i + 1))
            ;[items[i], items[j]] = [items[j], items[i]]
        }
        this.items = items
        console.log('Shuffled items')
    },

    clearAll() {
        if (this.items.length > 0) {
            const count = this.items.length
            this.items = []
            console.log(`Cleared ${count} items`)
        }
    }
})
Live Preview

Primitive Lists

Lists of strings, numbers, or other primitives use $item to bind the item value directly:

<!-- List of strings -->
<ul data-list="tags">
    <template>
        <li data-bind="$item"></li>
    </template>
</ul>
wildflower.component('tag-list', {
    state: {
        tags: ['html', 'css', 'javascript']
    }
})

$item refers to the current item itself, rather than a property on the item. This works with any primitive type:

<!-- List of numbers -->
<ol data-list="scores">
    <template>
        <li>Score: <span data-bind="$item"></span></li>
    </template>
</ol>
💡 Tip: $item is the only way to bind primitive list items. For object arrays, use property names directly (e.g., data-bind="name").

Interactive Lists with State

List items can have their own state and interactive elements:

<div data-component="todo-manager">
    <p class="text-muted">A fully interactive todo list with individual item state and bulk operations.</p>

    <!-- Add new todo form -->
    <form data-action="addTodo" class="mb-3">
        <div class="d-flex gap-2">
            <input type="text"
                   data-model="newTodo"
                   placeholder="Add a new todo..."
                   class="form-control"
                   required>
            <button type="submit" class="btn btn-primary">
                Add Todo
            </button>
        </div>
    </form>

    <!-- Bulk operations -->
    <div class="mb-3">
        <button data-action="markAllComplete" class="btn btn-sm btn-success me-2">
            Mark All Complete
        </button>
        <button data-action="clearCompleted"
                class="btn btn-sm btn-warning me-2"
                data-bind-attr="{ disabled: noCompleted }">
            Clear Completed (<span data-bind="completedCount"></span>)
        </button>
        <button data-action="clearAll"
                class="btn btn-sm btn-danger"
                data-bind-attr="{ disabled: isEmpty }">
            Clear All
        </button>
    </div>

    <!-- Statistics -->
    <div class="mb-3">
        <span class="me-3">
            Total: <span class="text-primary fw-bold" data-bind="totalCount"></span>
        </span>
        <span class="me-3">
            Complete: <span class="text-success fw-bold" data-bind="completedCount"></span>
        </span>
        <span class="me-3">
            Remaining: <span class="text-warning fw-bold" data-bind="remainingCount"></span>
        </span>
        <span>
            Progress: <span class="text-info fw-bold" data-bind="progressPercentage"></span>%
        </span>
    </div>

    <!-- Todo list with interactive items -->
    <div data-list="todos">
        <template>
            <div class="card mb-2" data-bind-class="cardClass">
                <div class="card-body py-2">
                    <div class="d-flex align-items-center gap-2">
                        <input type="checkbox"
                               data-model="completed"
                               class="form-check-input flex-shrink-0">
                        <div class="flex-grow-1">
                            <span data-bind="text"
                                  data-bind-class="completed ? 'text-decoration-line-through text-muted' : ''"></span>
                            <br>
                            <small class="text-muted">
                                <span class="badge badge-sm me-1" data-bind-class="priorityBadgeClass">
                                    <span data-bind="priority"></span>
                                </span>
                                <span data-bind="created"></span>
                            </small>
                        </div>
                        <div class="d-flex align-items-center flex-shrink-0">
                                <button data-action="duplicateTodo"
                                        class="btn btn-sm btn-info me-1">
                                    Copy
                                </button>
                                <button data-action="deleteTodo"
                                        class="btn btn-sm btn-danger">
                                    Delete
                                </button>
                        </div>
                    </div>
                </div>
            </div>
        </template>
    </div>

    <!-- Empty state -->
    <div data-show="isEmpty" class="text-center py-4">
        <div class="text-muted">
            <h5>No todos yet</h5>
            <p>Add a todo above to get started with your task management!</p>
        </div>
    </div>
</div>
wildflower.component('todo-manager', {
    state: {
        todos: [
            {
                text: 'Learn WildflowerJS Lists',
                completed: false,
                priority: 'High',
                created: '09:00',
                id: 1
            },
            {
                text: 'Build an interactive todo app',
                completed: false,
                priority: 'Medium',
                created: '09:15',
                id: 2
            },
            {
                text: 'Write comprehensive documentation',
                completed: true,
                priority: 'Low',
                created: '09:30',
                id: 3
            }
        ],
        newTodo: '',
        nextId: 4
    },

    computed: {
        totalCount() {
            return this.todos.length
        },

        completedCount() {
            return this.todos.filter(todo => todo.completed).length
        },

        remainingCount() {
            return this.todos.filter(todo => !todo.completed).length
        },

        progressPercentage() {
            if (this.todos.length === 0) return 0
            return Math.round((this.completedCount / this.todos.length) * 100)
        },

        isEmpty() {
            return this.todos.length === 0
        },

        noCompleted() {
            return this.completedCount === 0
        },

        // Item-level computed properties
        cardClass() {
            return this.completed ? 'bg-light border-success' : 'border-primary'
        },

        priorityBadgeClass() {
            const classes = {
                'High': 'bg-danger',
                'Medium': 'bg-warning text-dark',
                'Low': 'bg-success'
            }
            return classes[this.priority] || 'bg-secondary'
        }
    },

    addTodo(event, element) {
        // Prevent form submission
        event.preventDefault()

        const text = this.newTodo.trim()
        if (text) {
            const newTodo = {
                text: text,
                completed: false,
                priority: 'Medium',
                created: new Date().toLocaleTimeString().substring(0, 5),
                id: this.nextId++
            }

            this.todos.push(newTodo)
            this.newTodo = ''
            console.log('Added todo:', newTodo)
        }
    },

    deleteTodo(event, element, details) {
        const index = details.index
        const todo = this.todos[index]

        if (confirm(`Delete "${todo.text}"?`)) {
            this.todos.splice(index, 1)
            console.log('Deleted todo:', todo)
        }
    },

    duplicateTodo(event, element, details) {
        const index = details.index
        const originalTodo = this.todos[index]

        const duplicatedTodo = {
            text: `${originalTodo.text} (Copy)`,
            completed: false,
            priority: originalTodo.priority,
            created: new Date().toLocaleTimeString().substring(0, 5),
            id: this.nextId++
        }

        // Insert duplicate right after the original
        this.todos.splice(index + 1, 0, duplicatedTodo)
        console.log('Duplicated todo:', duplicatedTodo)
    },

    increasePriority(event, element, details) {
        const index = details.index
        const priorities = ['Low', 'Medium', 'High']
        const currentIndex = priorities.indexOf(this.todos[index].priority)

        if (currentIndex < priorities.length - 1) {
            this.todos[index].priority = priorities[currentIndex + 1]
            console.log('Increased priority for todo:', this.todos[index])
        }
    },

    decreasePriority(event, element, details) {
        const index = details.index
        const priorities = ['Low', 'Medium', 'High']
        const currentIndex = priorities.indexOf(this.todos[index].priority)

        if (currentIndex > 0) {
            this.todos[index].priority = priorities[currentIndex - 1]
            console.log('Decreased priority for todo:', this.todos[index])
        }
    },

    markAllComplete() {
        const incompleteCount = this.remainingCount
        this.todos.forEach(todo => {
            todo.completed = true
        })
        console.log(`Marked ${incompleteCount} todos as complete`)
    },

    clearCompleted() {
        const completedCount = this.completedCount
        this.todos = this.todos.filter(todo => !todo.completed)
        console.log(`Cleared ${completedCount} completed todos`)
    },

    clearAll() {
        if (confirm('Clear all todos?')) {
            const totalCount = this.todos.length
            this.todos = []
            console.log(`Cleared all ${totalCount} todos`)
        }
    }
})
Live Preview

Item-Level Computed Properties

Use item-level computed properties for per-item calculations that need access to external data (like stores) with automatic reactivity.

The signature declares the scope.
  • Item-level: name(item, index, info) { ... } runs per row in a list. item is the current row, index is its position, info is { first, last, length }. this is the component context, so this.state.X, this.stores.X, this.props.X, and this.computed.X all work.
  • Component-level: name() { ... } runs once per component. this is the component. Used for derived values that don't depend on a list row.
Item-level computeds must declare an item parameter. A zero-arg computed referenced inside a list-template binding is treated as component-level: same value for every row. If your binding renders the same value for every row when you expected per-row variation, your computed is missing the item parameter.
wildflower.store('cart', {
    state: { items: [] },
    addItem(id) {
        const existing = this.items.find(i => i.id === id);
        if (existing) {
            existing.qty++;
            this.items = [...this.items];
        } else {
            this.items = [...this.items, { id, qty: 1 }];
        }
    }
});

wildflower.component('product-list', {
    state: {
        products: [
            { id: 1, name: 'Widget', price: 10 },
            { id: 2, name: 'Gadget', price: 20 }
        ]
    },
    computed: {
        // Item-level: receives (item, index) - evaluated per list item
        inCartQty(item) {
            const cart = wildflower.getStore('cart');
            return cart.items.find(i => i.id === item.id)?.qty || 0;
        },
        isInCart(item) {
            return this.computed.inCartQty(item) > 0;  // Can call other item-level computeds
        },
        rowClass(item, index) {
            return index % 2 === 0 ? 'even' : 'odd';
        },
        // Item-level computed returning a STYLE OBJECT for data-bind-style
        itemStyle(item) {
            return {
                backgroundColor: item.featured ? '#fffde7' : '#ffffff',
                borderColor: item.featured ? '#ffc107' : '#dee2e6'
            };
        }
    },
    addToCart(event, element, details) {
        wildflower.getStore('cart').addItem(details.item.id);
    }
});
<div data-component="product-list">
    <div data-list="products" data-key="id">
        <template>
            <!-- data-bind-style uses computed that returns style object -->
            <div class="product" data-bind-class="rowClass" data-bind-style="itemStyle">
                <span data-bind="name"></span>
                <span class="badge" data-bind="inCartQty"></span>
                <span data-show="isInCart">IN CART</span>
                <button data-action="addToCart">Add to Cart</button>
            </div>
        </template>
    </div>
</div>

Benefits:

  • When the cart store changes, only the affected item bindings update - not the entire list
  • No need for pre-computed patterns that map over the entire array
  • Works with every binding that takes an expression: data-bind, data-show, data-render, data-bind-class, data-bind-style, and data-bind-attr
Style Binding Note: When using data-bind-style with computeds, the computed must return a style object like {backgroundColor: '#fff', color: 'red'}. The syntax data-bind-style="backgroundColor:colorProp" is NOT valid.

Reusing One Computed Across Scopes (Group + Row)

Sometimes the same per-row decoration applies to two different list scopes: e.g. a status icon that paints both the group-header row and each issue row inside the group. Make the parameterised computed shape-portable by reading a field that exists on both shapes:

computed: {
    // Outer list emits group rows shaped { id, status, statusName, count, rows }.
    // Inner list emits issue rows that also carry .status. Both shapes have
    // .status, so the same parameterised computed serves both.
    statusIcon(item) {
        if (!item || item.status === undefined) return '';
        return wildflower.getStore('pm').getStatus(item.status)?.icon || '○';
    }
}

Used as data-bind="statusIcon" inside both the group template and the row template. The framework passes whatever the current iteration's item is. No special form needed; just keep the field name consistent in your list-source design.

Item-Level Computeds in Compound Expressions

Bare references like data-bind-class="rowClass" are the simplest way to use an item-level computed, but you can also drop the same computed into any expression that an attribute accepts: object literals, ternaries, logical operators, string concatenation. The framework re-evaluates per row and tracks the same fine-grained dependencies.

Object syntax for class

<li data-bind-class="{ saved: isSaved }">

Ternary in class

<li data-bind-class="isSaved ? 'saved' : ''">

Object syntax for attr

<button data-bind-attr="({ 'aria-pressed': isSaved })">

Compound show / render

<span data-show="isSaved && !isLocked">

Ternary in text bind

<span data-bind="isSaved ? '✓ ' + name : name">

Style object

<li data-bind-style="({ borderColor: badgeColor })">

Each form reads isSaved(item) (or badgeColor(item)) once per row with that row's data. Mutating the state the computed reads — for example, this.state.saved[item.id] = true — re-runs only the affected row's bindings.

Live: per-item computed driving five binding types

This product list uses a single item-level computed, isSaved(item), to drive a class binding, two data-show branches, an attribute binding, and the row-level pill text. Click the bookmark to save; the row's bindings flip without re-rendering anything else.

<div data-component="saveable-products">
    <div class="d-flex justify-content-between align-items-center mb-3">
        <span class="text-muted small">
            <strong data-bind="savedCount">0</strong>
            <span data-bind="savedLabel"> saved</span>
        </span>
        <button class="btn btn-sm btn-outline-secondary"
                data-show="hasSaved"
                data-action="clearSaved">Clear saved</button>
    </div>

    <ul class="list-group" data-list="products" data-key="id">
        <template>
            <li class="list-group-item d-flex justify-content-between align-items-center"
                data-bind-class="{ 'list-group-item-success': isSaved }">

                <!-- Ternary in text bind: prepend ✓ when saved -->
                <span data-bind="isSaved ? '✓ ' + name : name"></span>

                <span class="d-flex align-items-center gap-2">
                    <span class="text-muted small" data-bind="price"></span>

                    <!-- Compound data-show with item-level computed -->
                    <span class="badge bg-success" data-show="isSaved">Saved</span>

                    <!-- Object-syntax attr binding (aria-pressed) plus
                         compound show/!show on the same button text -->
                    <button class="btn btn-sm btn-outline-primary"
                            data-action="toggleSave"
                            data-bind-attr="({ 'aria-pressed': isSaved })"
                            data-bind="isSaved ? 'Remove' : 'Save'"></button>
                </span>
            </li>
        </template>
    </ul>
</div>
wildflower.component('saveable-products', {
    state: {
        products: [
            { id: 'p1', name: 'Wireless headphones', price: '$89' },
            { id: 'p2', name: 'Mechanical keyboard', price: '$129' },
            { id: 'p3', name: 'USB-C hub',           price: '$45'  },
            { id: 'p4', name: 'Standing desk mat',   price: '$72'  },
            { id: 'p5', name: 'Webcam 1080p',        price: '$58'  }
        ],
        // Sibling state keyed by item.id: the canonical lookup-map shape
        // for item-level computeds.
        saved: { p3: { savedAt: Date.now() } }
    },

    computed: {
        // Zero-arg computeds resolve in component scope. Note the bare
        // `this.saved`: no `this.state.` prefix needed; the context proxy
        // routes it. Same for `this.savedCount` from another computed.
        savedCount() { return Object.keys(this.saved).length; },
        hasSaved()   { return this.savedCount > 0; },
        savedLabel() {
            const n = this.savedCount;
            return n === 1 ? ' product saved' : ' products saved';
        },

        // Item-level computed: fn.length > 0, called once per row.
        // Reads from state.saved keyed by item.id. When state.saved.
        // changes (direct mutation), only the affected row re-evaluates.
        isSaved(item) { return !!this.saved[item.id]; }
    },

    toggleSave(event, element, details) {
        const item = details && details.item;
        if (!item) return;
        // Direct nested mutation triggers reactivity. No spread needed.
        if (this.saved[item.id]) {
            delete this.saved[item.id];
        } else {
            this.saved[item.id] = { savedAt: Date.now() };
        }
    },

    clearSaved() {
        this.saved = {};
    }
});
Live Preview

Single computed, five binding types — class, attr, two text bindings, two show branches — all driven from one source of truth.

Item-Level Computeds as Nested-List Sources

Item-level computeds also resolve as the source array of a nested data-list. Inside a parent list template, an inner data-list="someComputed" evaluates the computed against each parent row when the path isn't a raw field on the row. This means you don't have to pre-decorate parent rows with the inner array.

wildflower.component('thread', {
    state: {
        // Each comment carries raw `reactions` keyed by emoji.
        comments: [
            { id: 'c1', body: 'Looks great!', reactions: { '👍': ['u-1', 'u-2'] } },
            { id: 'c2', body: 'Ship it.',     reactions: {} }
        ],
        currentUser: 'u-1'
    },
    computed: {
        // Per-comment chip list. `this.id` and `this.reactions` are the
        // current comment's fields when this evaluates inside the outer
        // data-list template.
        reactionChips() {
            if (this.id === undefined) return []
            const c = this
            const me = this.currentUser
            return ['👍','❤️','🚀'].map(emoji => {
                const users = (c.reactions && c.reactions[emoji]) || []
                return {
                    id: c.id + ':' + emoji,
                    emoji,
                    chipClass: users.indexOf(me) !== -1 ? 'chip is-mine' : 'chip'
                }
            })
        }
    }
})
<div data-list="comments" data-key="id">
    <template>
        <div class="comment">
            <p data-bind="body"></p>
            <!-- reactionChips is a computed; raw comments don't have it -->
            <div class="reactions" data-list="reactionChips" data-key="id">
                <template>
                    <button data-bind-class="chipClass" data-bind="emoji"></button>
                </template>
            </div>
        </div>
    </template>
</div>

The framework reads item[path] first (fast path) and falls back to evaluating an item-level computed of the same name when the field is undefined. Same behaviour data-bind already had, now extended to nested-list source paths.

Caveats. The fallback only fires when item[path] === undefined and path is a flat name (no dots). A raw field of the same name shadows the computed; if your row has a reactions field and you also want a derived view, name the computed differently (e.g., reactionChips) so the data-list can find it.

Nested Lists and Complex Data

Create nested list structures with complex data relationships:

<div data-component="project-manager">
    <p class="text-muted">Nested lists demonstrating project-task relationships with real-time progress tracking.</p>

    <!-- Project controls -->
    <div class="mb-3">
        <button data-action="addProject" class="btn btn-primary me-2">
            Add Project
        </button>
        <button data-action="addSampleData" class="btn btn-secondary me-2">
            Add Sample Data
        </button>
        <button data-action="clearAll" class="btn btn-danger">
            Clear All
        </button>
    </div>

    <!-- Overall statistics -->
    <div class="row mb-4">
        <div class="col-md-3">
            <div class="card bg-primary text-white">
                <div class="card-body text-center">
                    <h5 class="card-title"><span data-bind="totalProjects"></span></h5>
                    <p class="card-text">Total Projects</p>
                </div>
            </div>
        </div>
        <div class="col-md-3">
            <div class="card bg-success text-white">
                <div class="card-body text-center">
                    <h5 class="card-title"><span data-bind="totalTasks"></span></h5>
                    <p class="card-text">Total Tasks</p>
                </div>
            </div>
        </div>
        <div class="col-md-3">
            <div class="card bg-warning text-white">
                <div class="card-body text-center">
                    <h5 class="card-title"><span data-bind="completedTasks"></span></h5>
                    <p class="card-text">Completed Tasks</p>
                </div>
            </div>
        </div>
        <div class="col-md-3">
            <div class="card bg-info text-white">
                <div class="card-body text-center">
                    <h5 class="card-title"><span data-bind="overallProgress"></span>%</h5>
                    <p class="card-text">Overall Progress</p>
                </div>
            </div>
        </div>
    </div>

    <!-- Projects list with nested tasks -->
    <div data-list="projects">
        <template>
            <div class="card mb-3">
                <div class="card-header">
                    <div class="d-flex justify-content-between align-items-center">
                        <div class="d-flex align-items-center">
                            <h5 class="mb-0 me-3">
                                <span data-bind="name"></span>
                                <span class="badge bg-secondary ms-2">#<span data-bind="id"></span></span>
                            </h5>
                            <div class="me-3">
                                <div class="progress" style="width: 120px; height: 12px;">
                                    <div class="progress-bar"
                                         data-bind-style="progressBarStyle">
                                    </div>
                                </div>
                                <small class="text-muted"><span data-bind="progressPercentage"></span>% complete</small>
                            </div>
                        </div>
                            <button data-action="addTask" class="btn btn-sm btn-primary me-2">
                                Add Task
                            </button>
                            <button data-action="toggleCollapse" class="btn btn-sm btn-secondary me-2">
                                <span data-bind="collapsed ? 'Expand' : 'Collapse'"></span>
                            </button>
                            <button data-action="deleteProject" class="btn btn-sm btn-danger">
                                Delete
                            </button>
                    </div>
                </div>

                <div class="card-body" data-bind-class="collapsed ? 'd-none' : ''">
                    <div class="row mb-3">
                        <div class="col-md-8">
                            <p class="text-muted mb-0"><span data-bind="description"></span></p>
                        </div>
                        <div class="col-md-4">
                            <small class="text-muted">
                                Created: <span data-bind="created"></span> |
                                Tasks: <span data-bind="taskCount"></span>
                            </small>
                        </div>
                    </div>

                    <!-- Task input form -->
                    <form data-action="addTaskForm" class="mb-3">
                        <div class="input-group">
                            <input type="text"
                                   data-model="newTaskName"
                                   placeholder="New task name..."
                                   class="form-control"
                                   required>
                            <select data-model="newTaskPriority" class="form-select" style="max-width: 120px;">
                                <option value="Low">Low</option>
                                <option value="Medium" selected>Medium</option>
                                <option value="High">High</option>
                            </select>
                            <button type="submit" class="btn btn-primary">Add Task</button>
                        </div>
                    </form>

                    <!-- Nested tasks list -->
                    <div data-list="tasks">
                        <template>
                            <div class="card mb-2 border-start border-3" data-bind-class="taskBorderClass">
                                <div class="card-body py-2">
                                    <div class="d-flex align-items-center">
                                        <input type="checkbox"
                                               data-model="completed"
                                               class="form-check-input me-3">
                                        <div class="flex-grow-1">
                                            <div class="d-flex justify-content-between align-items-start">
                                                <div>
                                                    <strong data-bind="name" data-bind-class="completed ? 'text-decoration-line-through text-muted' : ''"></strong>
                                                    <span class="badge badge-sm ms-2" data-bind-class="priorityBadgeClass">
                                                        <span data-bind="priority"></span>
                                                    </span>
                                                </div>
                                                    <button data-action="moveTaskUp"
                                                            class="btn btn-sm me-2"
                                                            data-bind-class="_first || _length === 1 ? 'btn-secondary disabled' : 'btn-primary'">
                                                        ↑
                                                    </button>
                                                    <button data-action="moveTaskDown"
                                                            class="btn btn-sm me-2"
                                                            data-bind-class="_last || _length === 1 ? 'btn-secondary disabled' : 'btn-primary'">
                                                        ↓
                                                    </button>
                                                    <button data-action="deleteTask"
                                                            class="btn btn-sm btn-danger">
                                                        Delete
                                                    </button>
                                            </div>
                                            <small class="text-muted">
                                                Task #<span data-bind="id"></span> |
                                                Created: <span data-bind="created"></span>
                                            </small>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </template>
                    </div>

                    <!-- Empty tasks state -->
                    <div data-show="hasNoTasks" class="text-center py-3">
                        <p class="text-muted mb-0">No tasks yet. Add a task above to get started!</p>
                    </div>
                </div>
            </div>
        </template>
    </div>

    <!-- Empty projects state -->
    <div data-show="hasNoProjects" class="text-center py-4">
        <div class="text-muted">
            <h5>No projects yet</h5>
            <p>Create your first project to start managing tasks!</p>
        </div>
    </div>
</div>
wildflower.component('project-manager', {
    state: {
        projects: [
            {
                id: 1,
                name: 'WildflowerJS Documentation',
                description: 'Create comprehensive documentation for the framework',
                created: '09:00',
                collapsed: false,
                newTaskName: '',
                newTaskPriority: 'Medium',
                tasks: [
                    {
                        id: 1,
                        name: 'Setup documentation structure',
                        priority: 'High',
                        completed: true,
                        created: '09:15'
                    },
                    {
                        id: 2,
                        name: 'Write list examples',
                        priority: 'Medium',
                        completed: false,
                        created: '09:30'
                    }
                ]
            },
            {
                id: 2,
                name: 'Framework Testing',
                description: 'Comprehensive testing suite for all framework features',
                created: '10:00',
                collapsed: false,
                newTaskName: '',
                newTaskPriority: 'Medium',
                tasks: [
                    {
                        id: 3,
                        name: 'Unit tests for list rendering',
                        priority: 'High',
                        completed: false,
                        created: '10:15'
                    },
                    {
                        id: 4,
                        name: 'Integration tests',
                        priority: 'Medium',
                        completed: false,
                        created: '10:30'
                    },
                    {
                        id: 5,
                        name: 'Performance benchmarks',
                        priority: 'Low',
                        completed: true,
                        created: '10:45'
                    }
                ]
            }
        ],
        nextProjectId: 3,
        nextTaskId: 6
    },

    computed: {
        // Global statistics
        totalProjects() {
            return this.projects.length
        },

        totalTasks() {
            return this.projects.reduce((total, project) => {
                return total + project.tasks.length
            }, 0)
        },

        completedTasks() {
            return this.projects.reduce((total, project) => {
                return total + project.tasks.filter(task => task.completed).length
            }, 0)
        },

        overallProgress() {
            const total = this.totalTasks
            if (total === 0) return 0
            return Math.round((this.completedTasks / total) * 100)
        },

        hasNoProjects() {
            return this.projects.length === 0
        },

        // Project-level computed properties
        taskCount() {
            // Access tasks from current project context
            return this.tasks ? this.tasks.length : 0
        },

        progressPercentage() {
            // Access tasks from current project context
            const tasks = this.tasks || []
            if (tasks.length === 0) return 0
            const completed = tasks.filter(task => task.completed).length
            return Math.round((completed / tasks.length) * 100)
        },

        progressBarStyle() {
            // Calculate progress inline (can't call this.computed in list context)
            const tasks = this.tasks || []
            let progress = 0
            if (tasks.length > 0) {
                const completed = tasks.filter(task => task.completed).length
                progress = Math.round((completed / tasks.length) * 100)
            }

            let bgColor = '#dc3545' // danger/red
            if (progress === 100) bgColor = '#198754' // success/green
            else if (progress >= 75) bgColor = '#0dcaf0' // info/cyan
            else if (progress >= 50) bgColor = '#ffc107' // warning/yellow

            return {
                width: progress + '%',
                height: '100%',
                backgroundColor: bgColor,
                transition: 'width 0.3s ease'
            }
        },

        hasNoTasks() {
            const tasks = this.tasks || []
            return tasks.length === 0
        },

        // Task-level computed properties
        priorityBadgeClass() {
            const classes = {
                'High': 'bg-danger',
                'Medium': 'bg-warning text-dark',
                'Low': 'bg-success'
            }
            return classes[this.priority] || 'bg-secondary'
        },

        taskBorderClass() {
            const classes = {
                'High': 'border-danger',
                'Medium': 'border-warning',
                'Low': 'border-success'
            }
            return classes[this.priority] || 'border-secondary'
        }
    },

    addProject() {
        const newProject = {
            id: this.nextProjectId++,
            name: `Project ${this.nextProjectId - 1}`,
            description: `Description for project ${this.nextProjectId - 1}`,
            created: new Date().toLocaleTimeString().substring(0, 5),
            collapsed: false,
            newTaskName: '',
            newTaskPriority: 'Medium',
            tasks: []
        }

        this.projects.push(newProject)
        console.log('Added project:', newProject)
    },

    addSampleData() {
        const sampleProjects = [
            {
                id: this.nextProjectId++,
                name: 'Mobile App Development',
                description: 'Build responsive mobile application',
                created: new Date().toLocaleTimeString().substring(0, 5),
                collapsed: false,
                newTaskName: '',
                newTaskPriority: 'Medium',
                tasks: [
                    {
                        id: this.nextTaskId++,
                        name: 'Design user interface',
                        priority: 'High',
                        completed: false,
                        created: new Date().toLocaleTimeString().substring(0, 5)
                    },
                    {
                        id: this.nextTaskId++,
                        name: 'Implement authentication',
                        priority: 'High',
                        completed: false,
                        created: new Date().toLocaleTimeString().substring(0, 5)
                    },
                    {
                        id: this.nextTaskId++,
                        name: 'Add push notifications',
                        priority: 'Medium',
                        completed: false,
                        created: new Date().toLocaleTimeString().substring(0, 5)
                    }
                ]
            },
            {
                id: this.nextProjectId++,
                name: 'Database Migration',
                description: 'Migrate legacy database to new schema',
                created: new Date().toLocaleTimeString().substring(0, 5),
                collapsed: false,
                newTaskName: '',
                newTaskPriority: 'Medium',
                tasks: [
                    {
                        id: this.nextTaskId++,
                        name: 'Backup existing data',
                        priority: 'High',
                        completed: true,
                        created: new Date().toLocaleTimeString().substring(0, 5)
                    },
                    {
                        id: this.nextTaskId++,
                        name: 'Create migration scripts',
                        priority: 'High',
                        completed: false,
                        created: new Date().toLocaleTimeString().substring(0, 5)
                    }
                ]
            }
        ]

        this.projects.push(...sampleProjects)
        console.log('Added sample projects:', sampleProjects)
    },

    deleteProject(event, element, details) {
        const projectIndex = details.index
        const project = this.projects[projectIndex]

        if (confirm(`Delete project "${project.name}" and all its tasks?`)) {
            this.projects.splice(projectIndex, 1)
            console.log('Deleted project:', project)
        }
    },

    toggleCollapse(event, element, details) {
        const projectIndex = details.index
        const project = this.projects[projectIndex]

        // Create new projects array with immutable update
        const updatedProjects = [...this.projects]
        updatedProjects[projectIndex] = {
            ...updatedProjects[projectIndex],
            collapsed: !project.collapsed
        }

        this.projects = updatedProjects
        console.log('Toggled collapse for project:', project.name)
    },

    addTask(event, element, details) {
        const projectIndex = details.index

        const newTask = {
            id: this.nextTaskId++,
            name: `Task ${this.nextTaskId - 1}`,
            priority: 'Medium',
            completed: false,
            created: new Date().toLocaleTimeString().substring(0, 5)
        }

        // Create new projects array with immutable update
        const updatedProjects = [...this.projects]
        updatedProjects[projectIndex] = {
            ...updatedProjects[projectIndex],
            tasks: [...updatedProjects[projectIndex].tasks, newTask]
        }

        this.projects = updatedProjects
        console.log('Added task:', newTask)
    },

    addTaskForm(event, element, details) {
        event.preventDefault()
        const projectIndex = details.index
        const project = this.projects[projectIndex]

        const taskName = project.newTaskName?.trim() || '';
        if (taskName) {
            const newTask = {
                id: this.nextTaskId++,
                name: taskName,
                priority: project.newTaskPriority,
                completed: false,
                created: new Date().toLocaleTimeString().substring(0, 5)
            }

            // Direct nested update: WF's deep reactive proxy handles this
            const targetProject = this.projects[projectIndex];
            targetProject.tasks = [...targetProject.tasks, newTask];
            targetProject.newTaskName = '';
            targetProject.newTaskPriority = 'Medium';

            console.log('Added task via form:', newTask)
        }
    },

    deleteTask(event, element, details) {
        // Get indices from the framework's action context
        const taskIndex = details.index
        const projectIndex = details.parent.index
        const project = this.projects[projectIndex]
        const task = project.tasks[taskIndex]

        if (confirm(`Delete task "${task.name}"?`)) {
            // Create new projects array with immutable update
            const updatedProjects = [...this.projects]
            updatedProjects[projectIndex] = {
                ...updatedProjects[projectIndex],
                tasks: updatedProjects[projectIndex].tasks.filter((_, index) => index !== taskIndex)
            }

            this.projects = updatedProjects
            console.log('Deleted task:', task)
        }
    },

    moveTaskUp(event, element, details) {
        // Get indices from the framework's action context
        const taskIndex = details.index
        const projectIndex = details.parent.index
        const project = this.projects[projectIndex]

        if (taskIndex > 0) {
            const task = project.tasks[taskIndex]

            // Create new projects array with immutable update
            const updatedProjects = [...this.projects]
            const newTasks = [...project.tasks]

            // Swap positions immutably
            newTasks[taskIndex] = newTasks[taskIndex - 1]
            newTasks[taskIndex - 1] = task

            updatedProjects[projectIndex] = {
                ...updatedProjects[projectIndex],
                tasks: newTasks
            }

            this.projects = updatedProjects
            console.log('Moved task up:', task)
        }
    },

    moveTaskDown(event, element, details) {
        // Get indices from the framework's action context
        const taskIndex = details.index
        const projectIndex = details.parent.index
        const project = this.projects[projectIndex]

        if (taskIndex < project.tasks.length - 1) {
            const task = project.tasks[taskIndex]

            // Create new projects array with immutable update
            const updatedProjects = [...this.projects]
            const newTasks = [...project.tasks]

            // Swap positions immutably
            newTasks[taskIndex] = newTasks[taskIndex + 1]
            newTasks[taskIndex + 1] = task

            updatedProjects[projectIndex] = {
                ...updatedProjects[projectIndex],
                tasks: newTasks
            }

            this.projects = updatedProjects
            console.log('Moved task down:', task)
        }
    },

    clearAll() {
        if (confirm('Clear all projects and tasks?')) {
            const projectCount = this.projects.length
            const taskCount = this.totalTasks
            this.projects = []
            console.log(`Cleared ${projectCount} projects and ${taskCount} tasks`)
        }
    }
})
Live Preview

Components in Lists

When a component is rendered inside a data-list template, it can access the list item's data via this.listItem:

Template Setup

<div data-list="tasks" data-key="id">
    <template>
        <div data-component="task-card">...</div>
    </template>
</div>

Component Definition

wildflower.component('task-card', {
    state: {
        taskId: null
    },

    beforeInit() {
        // this.listItem contains the task object for this list item
        if (this.listItem) {
            this.taskId = this.listItem.id;
            console.log('Task title:', this.listItem.title);
        }
    }
});
Key Points:
  • this.listItem is available in beforeInit(), init(), and all lifecycle methods
  • It returns null for components not rendered inside a list
  • It provides a live reference to the data object - changes to the source data are reflected
  • For nested lists, it returns the immediate parent list's item, not an ancestor's
Do not use data-cloak inside list templates. Content inside <template> is inert and invisible until the framework renders it, so there is no flash-of-unstyled-content risk. Using data-cloak inside templates causes data-show toggling to silently fail on dynamically added list items. Use data-cloak only on top-level elements (modals, portals) outside of list templates.

Defensive Pattern

Components that may be used both inside and outside of lists can check for listItem:

beforeInit() {
    // Works whether component is in a list or standalone
    const data = this.listItem || this.element.dataset;
    this.itemId = data.id || data.itemId;
}

Component Boundary Behavior

If a component is nested inside another component within a list, the inner component does not inherit the list item data:

<div data-list="items">
    <template>
        <div data-component="outer-comp">
            <!-- outer-comp.listItem = item data -->
            <div data-component="inner-comp">
                <!-- inner-comp.listItem = null (blocked by component boundary) -->
            </div>
        </div>
    </template>
</div>

This ensures components maintain clear ownership boundaries. If the inner component needs the data, the outer component should explicitly pass it via props or state.

📚 Continue Learning: For advanced list patterns including filtering, sorting, external data sources, and performance optimization, see Advanced Lists. For rendering different templates per item based on a data property (heterogeneous lists), see Dynamic Templates.