domino 0.2.1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new50

Domino

An experimental virtual dom library in Dart, which allows mixing DOM elements with components.

Main features:

  • Virtual DOM nodes and stateful components can be mixed.
  • Supports server-side rendering.

Usage

A simple usage example:

import 'dart:html' as html;

import 'package:domino/domino.dart';
import 'package:domino/html_view.dart';
import 'package:domino/node_helpers.dart';

main() {
  registerHtmlView(html.querySelector('#main'), new SimpleComponent());
}

class SimpleComponent extends Component {
  int counter = 0;

  @override
  build(BuildContext context) {
    return [
      div(content: [
        div(content: 'Counter: $counter'),
        button(content: 'Increment', onClick: _onClick),
      ]),
    ];
  }

  void _onClick(_) {
    counter++;
  }
}

Changelog

0.2.1

  • Element Setter for shortcut certain build patterns.
  • Enable String and embedded Lists to set for Element.classes and clazz setters.
  • View.track to execute (async) actions that will trigger the invalidation of the View.
  • View.escape to escape the tracker zone for EventHandlers that are registered inside the View.
  • Expose View in BuildContext.
  • Experimental SubView.
  • Experimental StatefulComponent (moved to experimental.dart).

0.2.0+1

  • Fix NPE.

0.2.0

Breaking changes:

  • Removed Element.text and Element.children, using Element.content instead.
  • content items that are not List, Component, String, Node or BuildFn will be converted to String (and to Text).

Updates:

  • Fix: BuildContext.ancestors did not include Components.
  • Fix: classes were not updated when the new Element had no class.
  • Fix: attributes were not updated when the new Element had no attributes.
  • Fix: reduce the non-keyed reuse of DOM Elements that have non-matching style properties. (using key reuses them)

0.1.1

  • Fix: root component was not added to ancestor list.
  • Enable multiple (and non-component) children as root for a View.
  • New node helper (br).

0.1.0

  • Initial version.

example/example.dart

import 'dart:html' as html;

import 'package:domino/domino.dart';
import 'package:domino/html_view.dart';
import 'package:domino/node_helpers.dart';

main() {
  registerHtmlView(html.querySelector('#main'), new SimpleComponent());
}

class SimpleComponent extends Component {
  int counter = 0;

  @override
  build(BuildContext context) {
    return [
      div(content: [
        div(content: 'Counter: $counter'),
        button(content: 'Increment', onClick: _onClick),
      ]),
    ];
  }

  void _onClick(_) {
    counter++;
  }
}

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  domino: "^0.2.1"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:domino/domino.dart';
        
Version Uploaded Documentation Archive
0.2.1 Feb 18, 2018 Go to the documentation of domino 0.2.1 Download domino 0.2.1 archive
0.2.0+1 Feb 13, 2018 Go to the documentation of domino 0.2.0+1 Download domino 0.2.0+1 archive
0.2.0 Feb 13, 2018 Go to the documentation of domino 0.2.0 Download domino 0.2.0 archive
0.1.1 Feb 11, 2018 Go to the documentation of domino 0.1.1 Download domino 0.1.1 archive
0.1.0 Feb 10, 2018 Go to the documentation of domino 0.1.0 Download domino 0.1.0 archive

Analysis

This feature is new.
We welcome feedback.
More details: scoring.

We analyzed this package, and provided a score, details, and suggestions below.

  • completed on Feb 18, 2018
  • Dart: 2.0.0-dev.20.0
  • pana: 0.10.1

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
0 / 100
Health:
Code health derived from static analysis. [more]
100 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
50

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:domino/domino.dart.

Suggestions

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.1 <2.0.0
async_tracker ^0.1.0 0.1.0
Dev dependencies
test ^0.12.30