domino 0.4.2

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

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/helpers.dart';

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

class SimpleComponent extends Component {
  int counter = 0;

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

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

Changelog

0.4.1

  • Enabled Dart2.

0.4.0

Breaking API changes:

  • renamed Event to EventContext
  • renamed getNodeBySymbol to getNode (in Event/EventContext)

Updates:

  • Support multiple event handler signature.

0.3.4

  • Support Element.innerHtml setter.
  • Putting every VDom type check inside a type-based switch statement (to improve static type checking if there is a new type there).
  • Support no-arg functions in generic content.

0.3.3

  • Do not override attributes and styles when the value matches the previous one (and the DOM may be different).
  • Relax DOM reuse restrictions on style properties.
  • Relax DOM reuse restrictions on event listeners.
  • Ability to use non-tracked event handlers (on('click', fn, tracked: false)).
  • Access current View with Event.view.

0.3.2+1

  • Fix strong-mode cast issue with unfold in ClassAdder.

0.3.2

  • Fix StatefulComponent path handling bug.
  • Fix strong-mode cast issue.
  • Switching to Timer-based view invalidation, because event bubbling would be triggered on a wrong state.

0.3.1

  • Fix readme's example.
  • New implementation for StatefulComponent.
  • Conditional content structure with addIf.
  • Breaking change: matching clazzIf with addIf signature.

0.3.0

Breaking changes: full API rewrite:

  • Building Elements become simpler.
  • Setter become first-class build pattern.
  • #symbols become first-class patterns (replace previous key). Event.getNodeBySymbol may access referenced Elements within the scope of the current Component.
  • Removed StatefulComponent (still working on a better state handling).
  • Misc API simplification (e.g. Event.domElement => Event.element).

Updates:

  • Fixed attribute update issues.

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/helpers.dart';

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

class SimpleComponent extends Component {
  int counter = 0;

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

  void _onClick() {
    counter++;
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  domino: ^0.4.2

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 flutter 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.4.2 Sep 9, 2018 Go to the documentation of domino 0.4.2 Download domino 0.4.2 archive
0.4.0 May 10, 2018 Go to the documentation of domino 0.4.0 Download domino 0.4.0 archive
0.3.4 Apr 4, 2018 Go to the documentation of domino 0.3.4 Download domino 0.3.4 archive
0.3.3 Mar 1, 2018 Go to the documentation of domino 0.3.3 Download domino 0.3.3 archive
0.3.2+1 Feb 28, 2018 Go to the documentation of domino 0.3.2+1 Download domino 0.3.2+1 archive
0.3.2 Feb 26, 2018 Go to the documentation of domino 0.3.2 Download domino 0.3.2 archive
0.3.1 Feb 25, 2018 Go to the documentation of domino 0.3.1 Download domino 0.3.1 archive
0.3.0 Feb 24, 2018 Go to the documentation of domino 0.3.0 Download domino 0.3.0 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

All 13 versions...

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

We analyzed this package on Dec 5, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7

Platforms

Detected platforms: Flutter, web, other

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

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
async_tracker ^0.1.1 0.1.1
Dev dependencies
test ^1.3.0