incremental_dom_bindings 1.0.0+1

  • Readme
  • Changelog
  • Example
  • Installing
  • 72

incremental_dom_bindings #

Dart binding for the Incremental DOM library.

From the original Incremental DOM docuementation:

Incremental DOM is a library for expressing and applying updates to DOM trees. JavaScript can be used to extract, iterate over and transform data into calls generating HTMLElements and Text nodes. It differs from Virtual DOM approaches in that a diff operation is performed incrementally (that is one node at a time) against the DOM, rather than on a virtual DOM tree.

Rather than targeting direct usage, Incremental DOM aims to provide a platform for higher level libraries or frameworks. As you might notice from the examples, Incremental DOM-style markup can be somewhat challenging to write and read. See Why Incremental DOM for an explanation.

Usage #

For a detailed documentation see http://google.github.io/incremental-dom/.

This packages requires the Incremental DOM Javascript library to be loaded. Add

<script src="/packages/incremental_dom/assets/incremental-dom.js"></script>

or

<script src="/packages/incremental_dom/assets/incremental-dom-min.js"></script>

to your index.html.

Example #

This simple example adds an element to the DOM.

import 'dart:html';

import 'package:incremental_dom_bindings/incremental_dom_bindings.dart';

void main() {
  // query the element to patch
  final root = querySelector('#root');

  // patch the element
  patch(root, (_) {
    // open a div element with the attributes id and style
    elementOpen('div', null, [
      'id',
      'testId',
      'style',
      {'color': 'red'}
    ]);

    // add a text inside the div element
    text('Hello World');

    // close the div element
    elementClose('div');
  });
}

Version 1.0.0 #

  • Initial release

Version 1.0.0+1 #

  • Improvements to the pub.dev scoring.

example/main.dart

import 'dart:html';

import 'package:incremental_dom_bindings/incremental_dom_bindings.dart';

void main() {
  // query the element to patch
  final root = querySelector('#root');

  // patch the element
  patch(root, (_) {
    // open a div element with the attributes id and style
    elementOpen('div', null, [
      'id',
      'testId',
      'style',
      {'color': 'red'}
    ]);

    // add a text inside the div element
    text('Hello World');

    // close the div element
    elementClose('div');
  });
}

Use this package as a library

1. Depend on it

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


dependencies:
  incremental_dom_bindings: ^1.0.0+1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:incremental_dom_bindings/incremental_dom_bindings.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
43
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]
72
Learn more about scoring.

We analyzed this package on Jul 2, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13

Analysis suggestions

Package not compatible with runtime flutter-native on android

Because of the import of dart:js via the import chain package:incremental_dom_bindings/incremental_dom_bindings.dartdart:js

Package not compatible with runtime flutter-native on ios

Because of the import of dart:js via the import chain package:incremental_dom_bindings/incremental_dom_bindings.dartdart:js

Package not compatible with runtime flutter-native on linux

Because of the import of dart:js via the import chain package:incremental_dom_bindings/incremental_dom_bindings.dartdart:js

Package not compatible with runtime flutter-native on macos

Because of the import of dart:js via the import chain package:incremental_dom_bindings/incremental_dom_bindings.dartdart:js

Package not compatible with runtime flutter-native on windows

Because of the import of dart:js via the import chain package:incremental_dom_bindings/incremental_dom_bindings.dartdart:js

Package not compatible with runtime native-aot

Because of the import of dart:js via the import chain package:incremental_dom_bindings/incremental_dom_bindings.dartdart:js

Package not compatible with runtime native-jit

Because of the import of dart:js via the import chain package:incremental_dom_bindings/incremental_dom_bindings.dartdart:js

Health suggestions

Format lib/incremental_dom_bindings.dart.

Run dartfmt to format lib/incremental_dom_bindings.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
Dev dependencies
build_runner ^1.7.0
build_web_compilers ^2.7.0
pedantic ^1.9.0
test ^1.11.0