dom_tools 1.2.9

  • Readme
  • Changelog
  • Installing
  • 74

dom_tools #

DOM rich elements and tools

Usage #

A simple usage example:

import 'package:dom_tools/dom_tools.dart';

main() {

  // Example of an image that only loads when visualized in viewport: 

  TrackElementInViewport tracker = TrackElementInViewport() ;
  var imageElement = ImageElement() ;
  
  tracker.track(imageElement, onEnterViewport: (elem) {
    imageElement.src = 'http://api.host/path/to/image' ;
  });

}

Features and bugs #

Please file feature requests and bugs at the issue tracker.

Author #

Graciliano M. Passos: gmpassos@GitHub.

License #

Dart free & open-source license.

1.2.9 #

  • getElementHref(), getElementSrc().
  • getElementByValues(), getElementByHref(), getElementBySrc().
  • getAnchorElementByHref(), getLinkElementByHref(), getScriptElementBySrc().
  • elementOnLoad().
  • toCanvasElement(), canvasToImageElement(), rotateImageElement(), rotateCanvasImageSource().
  • NodeValidatorBuilder: Added tags svg, nav, li, ul, ol, label.
  • addJavaScriptCode(), addJavaScriptSource().
  • addCssSource(), getComputedStyle().
  • showDialogText(), showDialogHTML(), showDialogImage(), showDialogElement().
  • swiss_knife: ^2.4.0
  • highlight: ^0.6.0

1.2.8 #

  • addJScriptSource()
  • markdownToHtml(): markdown now accepts attributes for url. For example: [GitHub](https://github.com/){:target="_blank"}

1.2.7 #

  • createDiv(), createDivInline(), createHTML()
  • setElementInnerHTML(), appendElementInnerHTML() (with NodeValidatorBuilder).
  • scrollToTop(), scrollToTopAsync(), scrollToBottom(), scrollToLeft(), scrollToRight()
  • setZoom(), resetZoom(), setMetaViewportScale()
  • getElementAttribute(), getElementAttributeRegExp(), getElementAttributeStr()
  • getHrefBaseHost(), getHrefHostAndPort(), getHrefHost(), getHrefPort(), getHrefScheme()
  • isLocalhostHref(), isIPHref(), isIP(), clearSelections(), toHTML(Element)
  • elementMatchesAttributes(), getElementsWithAttributes()
  • isMobileAppStatusBarTranslucent()
  • addJScript(), evalJS(), mapJSFunction(), callObjectMethod(), disableScrolling(), enableScrolling(), disableZooming()
  • swiss_knife: ^2.3.9

1.2.6 #

  • nodeTreeContains(), nodeTreeContainsAny()

1.2.5 #

  • isOrientationInPortraitMode(), isOrientationInLandscapeMode()
  • onOrientationchange()
  • swiss_knife: ^2.3.7

1.2.4 #

  • CSSThemeSet
  • TrackElementInViewport (refactor)
  • TrackElementValue (new)
  • TrackElementResize (new): based in ResizeObserver or TrackElementValue depending of platform.
  • swiss_knife: ^2.3.4

1.2.3 #

  • CSS tools.
  • Document: markdown and coding highlight.
  • html_unescape: ^1.0.1+3
  • markdown: ^2.1.3
  • highlight: ^0.5.0
  • enum_to_string: ^1.0.8

1.2.2 #

  • DataStorageType: browser transparent storage over IdbFactory or window.sessionStorage.
  • json_object_mapper: ^1.0.0
  • swiss_knife: ^2.3.1

1.2.1 #

  • CanvasImageViewer.cropPerspective.

1.2.0 #

  • CanvasImageViewer support for perspective filter.
  • Caches: ImageScaledCache, ImagePerspectiveFilterCache.

1.0.1 #

  • CSS functions: applyCSS(), defineCSS(), hasCSS()
  • Class Color (from dart:ui).
  • Class CanvasImageViewer.

1.0.0 #

  • Initial version, created by Stagehand

Use this package as a library

1. Depend on it

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


dependencies:
  dom_tools: ^1.2.9

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:dom_tools/dom_tools.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
60
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
74
Learn more about scoring.

We analyzed this package on Jul 4, 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:mirrors via the import chain package:dom_tools/dom_tools.dartpackage:dom_tools/src/dom_data_storage.dartpackage:json_object_mapper/json_object_mapper.dartpackage:json_object_mapper/src/json_object.dartpackage:json_object_mapper/src/json_object_mirror.dartdart:mirrors

Package not compatible with runtime flutter-native on ios

Because of the import of dart:mirrors via the import chain package:dom_tools/dom_tools.dartpackage:dom_tools/src/dom_data_storage.dartpackage:json_object_mapper/json_object_mapper.dartpackage:json_object_mapper/src/json_object.dartpackage:json_object_mapper/src/json_object_mirror.dartdart:mirrors

Package not compatible with runtime flutter-native on linux

Because of the import of dart:mirrors via the import chain package:dom_tools/dom_tools.dartpackage:dom_tools/src/dom_data_storage.dartpackage:json_object_mapper/json_object_mapper.dartpackage:json_object_mapper/src/json_object.dartpackage:json_object_mapper/src/json_object_mirror.dartdart:mirrors

Package not compatible with runtime flutter-native on macos

Because of the import of dart:mirrors via the import chain package:dom_tools/dom_tools.dartpackage:dom_tools/src/dom_data_storage.dartpackage:json_object_mapper/json_object_mapper.dartpackage:json_object_mapper/src/json_object.dartpackage:json_object_mapper/src/json_object_mirror.dartdart:mirrors

Package not compatible with runtime flutter-native on windows

Because of the import of dart:mirrors via the import chain package:dom_tools/dom_tools.dartpackage:dom_tools/src/dom_data_storage.dartpackage:json_object_mapper/json_object_mapper.dartpackage:json_object_mapper/src/json_object.dartpackage:json_object_mapper/src/json_object_mirror.dartdart:mirrors

Package not compatible with runtime native-aot

Because of the import of dart:mirrors via the import chain package:dom_tools/dom_tools.dartpackage:dom_tools/src/dom_data_storage.dartpackage:json_object_mapper/json_object_mapper.dartpackage:json_object_mapper/src/json_object.dartpackage:json_object_mapper/src/json_object_mirror.dartdart:mirrors

Package not compatible with runtime native-jit

Because of the import of dart:indexed_db via the import chain package:dom_tools/dom_tools.dartpackage:dom_tools/src/dom_data_storage.dartdart:indexed_db

Health suggestions

Format lib/dom_tools.dart.

Run dartfmt to format lib/dom_tools.dart.

Format lib/src/dom_data_storage.dart.

Run dartfmt to format lib/src/dom_data_storage.dart.

Format lib/src/dom_tools_base.dart.

Run dartfmt to format lib/src/dom_tools_base.dart.

Fix additional 7 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/dom_tools_css.dart (Run dartfmt to format lib/src/dom_tools_css.dart.)
  • lib/src/dom_tools_dialog.dart (Run dartfmt to format lib/src/dom_tools_dialog.dart.)
  • lib/src/dom_tools_document.dart (Run dartfmt to format lib/src/dom_tools_document.dart.)
  • lib/src/dom_tools_js.dart (Run dartfmt to format lib/src/dom_tools_js.dart.)
  • lib/src/dom_tools_paint.dart (Run dartfmt to format lib/src/dom_tools_paint.dart.)
  • lib/src/dom_tools_track.dart (Run dartfmt to format lib/src/dom_tools_track.dart.)
  • lib/src/perspective_filter.dart (Run dartfmt to format lib/src/perspective_filter.dart.)

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and dom_tools.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
enum_to_string ^1.0.8 1.0.9
highlight ^0.6.0 0.6.0
html_unescape ^1.0.1+3 1.0.1+3
intl ^0.16.0 0.16.1
json_object_mapper ^1.0.0 1.0.0
markdown ^2.1.3 2.1.5
swiss_knife ^2.4.0 2.5.3
Transitive dependencies
args 1.6.0
charcode 1.1.3
collection 1.14.13
path 1.7.0
resource_portable 2.1.7
typed_data 1.2.0
Dev dependencies
pedantic ^1.8.0
test ^1.14.4