dom_tools library

Classes

AnyUriPolicy
Allows anu Uri policy.
CanvasImageViewer
An image viewer that can render points, rectangles, clip and grid over.
Color
Represents a color. [...]
CSSThemeSet
A Theme set, with multiples themes.
CSSValue
DataStorage
Represents a persistent storage in the browser. [...]
FilterResult
ImagePerspectiveFilter
A filter that applies a perspective to an image.
ImagePerspectiveFilterCache
A cache for perspective filers. [...]
ImageScaledCache
A cache for scaled images.
State
A state stored in DataStorage.
StorageValue
Represents a value stored in State.
StyleColor
Specifies a CSS color.
TextStyle
Specifies a CSS text style.
TrackElementInViewport
Tracks a DOM Element to identify when its visible in viewport.
TrackElementResize
Tracks a DOM Element to identify when its size changes.
TrackElementValue
Tracks a DOM Element to identify when a value changes.
ViewerElement<T>
Represents an element in the CanvasImageViewer.

Constants

CODE_THEME_0 → const Map<String, TextStyle>
const {'comment' : const TextStyle(color: const StyleColor(0xffd4d0ab)), 'quote' : const TextStyle(color: const StyleColor(0xffd4d0ab)), 'variable' : const TextStyle(color: con…
CODE_THEME_1 → const Map<String, TextStyle>
const {'root' : const TextStyle(color: const StyleColor(0xff000000), backgroundColor: const StyleColor(0xffffffff)), 'subst' : const TextStyle(fontWeight: FontWeight.normal, color: con…
CODE_THEME_2 → const Map<String, TextStyle>
const {'comment' : const TextStyle(color: const StyleColor(0xff7e7887)), 'quote' : const TextStyle(color: const StyleColor(0xff7e7887)), 'variable' : const TextStyle(color: con…

Properties

CODE_THEME CSSThemeSet
final

Functions

addCssSource(String cssSource, {int insertIndex}) Future<bool>
Add a CSS path using a link element into head DOM node. [...]
addJavaScriptCode(String scriptCode) Future<bool>
Adds a JavaScript code (scriptCode) into DOM.
addJavaScriptSource(String scriptSource, [bool addToBody]) Future<bool>
Adds a JavaScript path (scriptSource] into DOM. [...]
addJSFunction(String name, List<String> parameters, String body) Future<bool>
Adds a JavaScript function into DOM. [...]
appendElementInnerHTML(Element element, String html) → void
Appends to the inner HTML of element with parsed result of html.
applyCSS(CssStyleDeclaration css, Element element, [List<Element> extraElements]) bool
Applies css to element and extraElements list if present.
applyPerspective(CanvasImageSource image, List<Point<num>> perspective) FilterResult
Apply perspective filter to image.
asCssStyleDeclaration(dynamic css) CssStyleDeclaration
Parses dynamic css as CssStyleDeclaration.
buildMetaContent(Map<String, String> map) String
Builds a meta content from map.
callFunction(String method, [List args]) → dynamic
Calls JavaScript a function method with args.
callObjectMethod(dynamic o, String method, [List args]) → dynamic
Calls JavaScript a method in object o with args.
canvasToImageElement(CanvasElement canvas, [String mimeType, num quality]) ImageElement
Converts canvas to ImageElement [...]
clearSelections() → void
Clears selected text in vieport.
copyPoints(List<Point<num>> points) List<Point<num>>
Makes a copy of points.
createDiv([bool inline = false, String html]) DivElement
Creates a div. inline If true sets display: inline-block. html The HTML to parse as content.
createDivInline([String html]) DivElement
Creates a div with display: inline-block. [...]
createDivInlineBlock() DivElement
Creates a div with display: inline-block.
createHTML([String html]) Element
Creates a HTML Element. Returns 1st node form parsed HTML.
createImageElementFromBase64(String base64, [String mimeType]) ImageElement
Creates an image from a Base-64 with mimeType.
createImageElementFromFile(File file) Future<ImageElement>
Creates an image from a file.
createLabel([String html]) LabelElement
Creates a label element. [...]
createScaledImage(CanvasImageSource image, int width, int height, double scale) CanvasImageSource
Creates a new image from image, of width and height, to a scale.
createSpan([String html]) SpanElement
Creates a span element. [...]
cropImage(CanvasImageSource image, int x, int y, int width, int height) CanvasElement
Crops the image using coordinates x, y, width and height, returning new image (CanvasElement).
cropImageByRectangle(CanvasImageSource image, Rectangle<num> crop) CanvasElement
Crops an image using a Rectangle (crop), delegating to method cropImage,
defineCSS(CssStyleDeclaration currentCSS, CssStyleDeclaration appendCSS, [dynamic defaultCSS]) CssStyleDeclaration
Defines a new CssStyleDeclaration merging currentCSS and appendCSS. [...]
disableScrolling() → void
Disables scrolling in browser.
disableZooming() → void
Disables zooming in browser.
elementMatchesAttribute(Element element, String attributeName, dynamic attributeValue) bool
Returns true if element matches attributeName and attributeValue.
elementMatchesAttributes(Element element, Map<String, dynamic> attributes) bool
Returns true if element matches attributes.
elementOnLoad(ImageElement img) Future<bool>
Returns a Future<bool> for when img loads.
enableScrolling() → void
Enables scrolling in browser.
evalJS(String scriptCode) → dynamic
Call eval() with the content of scriptCode and returns the result.
getAnchorElementByHREF(String href) AnchorElement
Selects an AnchorElement in DOM with href.
getComputedStyle({Element parent, Element element, String classes, String style, bool hidden}) CssStyleDeclaration
Returns a CssStyleDeclaration from an element.
getElementAttribute(Element element, dynamic key) String
Returns element attribute with key. [...]
getElementAttributeRegExp(Element element, RegExp key) String
Returns element attribute with RegExp key.
getElementAttributeStr(Element element, String key) String
Returns element attribute with String key.
getElementByHREF(String tag, String href) Element
Selects an Element in DOM with tag and href.
getElementBySRC(String tag, String src) Element
Selects an Element in DOM with tag and src.
getElementByValues<V>(String tag, ElementValueGetter getter, List<V> values) Element
selects in DOM an Element with tag and one of values provided by getter.
getElementHREF(Element element) String
Returns href value for different Element types.
getElementSRC(Element element) String
Returns src value for different Element types.
getElementsWithAttributes(String tag, Map<String, dynamic> matchAttributes) List<Element>
Selects elements from DOM with tag and matches attribute. [...]
getImageDimension(CanvasImageSource image) Rectangle<int>
Gets the width and height from image (CanvasImageSource).
getLinkElementByHREF(String href) LinkElement
Selects an LinkElement in DOM with href.
getMetaTagsContentWithName(String name) List<String>
Returns a list of meta contet with name.
getMetaTagsWithName(String name) List<Element>
Returns a list of meta Element with name.
getScriptElementBySRC(String src) ScriptElement
Selects an ScriptElement in DOM with src.
isCssEmpty(CssStyleDeclaration css) bool
Returns true if CssStyleDeclaration is empty.
isCssNotEmpty(CssStyleDeclaration css) bool
Returns true if CssStyleDeclaration is not empty.
isInDOM(dynamic element) bool
Returns true if element is in DOM tree. [...]
isInViewport(Element element) bool
Returns true if element is visible in viewport.
isMobileAppStatusBarTranslucent() bool
Returns true if meta tag of name apple-mobile-web-app-status-bar-style is translucent.
isNodeInDOM(Node node) bool
Returns true if node is in DOM tree.
isOrientationInLandscapeMode() bool
Returns true if device orientation is in Landscape mode.
isOrientationInPortraitMode() bool
Returns true if device orientation is in Portrait mode.
loadCSS(String cssClassPrefix, Map<String, CSSValue> css) → void
Loads css dynamically. [...]
mapJSFunction(String jsFunctionName, MappedFunction f) → void
Maps a JavaScript function to a Dart function. [...]
markdownToDiv(String markdown, {bool normalize: true, Iterable<BlockSyntax> blockSyntaxes, Iterable<InlineSyntax> inlineSyntaxes, ExtensionSet extensionSet, Resolver linkResolver, Resolver imageLinkResolver, bool inlineOnly: false}) DivElement
Converts a markdown document into a HTML in a div node. [...]
markdownToHtml(String markdown, {bool normalize: true, Iterable<BlockSyntax> blockSyntaxes, Iterable<InlineSyntax> inlineSyntaxes, ExtensionSet extensionSet, Resolver linkResolver, Resolver imageLinkResolver, bool inlineOnly: false}) String
Converts a markdown document into a HTML string. [...]
nodeTreeContains(Node rootNode, Node target) bool
Returns true if rootNode contains target.
nodeTreeContainsAny(Node rootNode, Iterable<Node> list) bool
Returns true if rootNode contains any Node in list.
normalizeIdent(String text) String
Normalizes a ident, removing the common/global ident of the code. [...]
numsToPoints(List<num> perspective) List<Point<num>>
Converts a List<num>, as pairs, to a List<Point>.
onOrientationchange(EventListener listener) bool
Attaches listener to orientationchange event.
parseMetaContent(String content) Map<String, String>
Parses a meta content to Map<String,String>.
resetZoom() → void
Resets viewport zoom.
rotateCanvasImageSource(CanvasImageSource image, int width, int height, [dynamic angleDegree = 90]) CanvasElement
Rotates image (a CanvasImageSource) with angleDegree. [...]
rotateImageElement(ImageElement image, [dynamic angleDegree = 90]) CanvasElement
Rotates image with angleDegree.
scalePoints(List<Point<num>> points, double scale) List<Point<num>>
Scales points to scale.
scalePointsXY(List<Point<num>> points, double scaleX, double scaleY) List<Point<num>>
Scales points to scaleX and scaleY.
scrollToBottom() → void
Scrolls viewport to the bottom.
scrollToLeft() → void
Scrolls viewport to the left border.
scrollToRight() → void
Scrolls viewport to the right border.
scrollToTop() → void
Scrolls viewport to the top.
scrollToTopDelayed(int delayMs) → void
Scrolls viewport to the top with a delay. [...]
setElementInnerHTML(Element element, String html) → void
Sets the inner HTML of element with parsed result of html.
setMetaViewportScale({String minimumScale, String maximumScale}) bool
Sets the meta viewport with minimumScale and maximumScale.
setZoom(String zoom) → void
Sets the viewport zoom.
showDialogElement(Element content, {double transparency, String padding}) DivElement
Shows an Element dialog. [...]
showDialogHTML(String html, {double transparency, String padding}) DivElement
Shows a html dialog. [...]
showDialogImage(String src) → void
Shows an image (src) dialog. [...]
showDialogText(String text, {double transparency, String padding}) DivElement
Shows a text dialog. [...]
toCanvasElement(CanvasImageSource imageSource, int width, int height) CanvasElement
Converts imageSource to CanvasElement. [...]
toHTML(Element element) String
Converts element to HTML.
translatePoints(List<Point<num>> points, num x, num y) List<Point<num>>
Translate pints in x and y.

Enums

DataStorageType
Type of DataStorage.
EditionType
The type of edition for CanvasImageViewer.
FontStyle
Specifies a CSS font style.
FontWeight
Specifies a CSS font weight.
Quality
Quality of an image.
StateOperation
State operation.

Typedefs

ElementValueGetter<T>(Element element) → T
Returns a value from an Element.
FunctionTest() bool
ImageFilter(CanvasImageSource image, int width, int height) CanvasImageSource
Applies a filter to image, of width and height.
MappedFunction(dynamic o) → void
MatchesValue(String value) bool
OnElementEvent(Element element) → void
OnElementTrackValueEvent<T>(Element element, T value) bool
StateEventListener(StateOperation op, State state, String key, dynamic value) → void
StateKeyListener(dynamic value) → void
ValueCopier<T>(T value) → T