dom_builder 3.2.0 copy "dom_builder: ^3.2.0" to clipboard
dom_builder: ^3.2.0 copied to clipboard

Generate and manipulate DOM elements (virtual or real), DSX (like JSX) and HTML declarations (Web and Native support).

3.2.0 #

  • Fix: a false boolean attribute set as a property turned it on. resolveAttributeValue resolves a false boolean attribute to null (no attribute), which setAttribute takes as a bare (true) attribute for the ones set as properties: every selected="false" option (also $option(selected: false)) was selected, so a <select> showed its last option; hidden="false", multiple="false" and inert="false" turned those on too.

    • DOMGenerator.setAttributes now sets each resolved value with the new setResolvedAttribute. resolveAttributeValue and setResolvedAttribute take 2 required named defaults for an attribute without a value: booleanDefault (a boolean attribute: on or off) and valueDefault (any other: that value, or removed when null); setAttributes passes false and null. A false boolean attribute resolves to null (off). New DOMGenerator.resolveAttributeDefaults returns an attribute's value or its default. booleanDefault holds for every boolean attribute (checked, disabled… too), not only the ones set as properties. setAttribute keeps null as a bare attribute (true). The web generator's setElementAttribute takes booleanDefault too (default true). _parseAttributeBoolValue takes the null value as a named defaultValue (web and dart:html generators).
    • Breaking for a class extending DOMGenerator directly: setResolvedAttribute is abstract, and must be implemented (a fallback to setAttribute would turn every false boolean attribute on); a caller or override of resolveAttributeValue must pass or take the 2 new required parameters. The package's generators (web, dart:html, delegate, dummy, none) implement them; subclasses of them are unaffected.
    • A null selected or multiple on an element without that property now removes the attribute (it threw).
  • Fix: one rule for every boolean attribute value, DOMAttribute.parseBooleanValue: on for true, bare, "", the attribute's own name (checked="checked", selected="selected": XHTML form, any case) and on/yes/1; off otherwise ("false", "off", "no", "0": dom_builder reads boolean values, and templates rely on it). Used by DOMAttribute.from, setValue on an existing attribute, resolveAttributeValue (template values too) and the generators' setAttribute/setResolvedAttribute. Before, each read them its own way:

    • checked="checked" and the other own-name forms were off;
    • a boolean attribute with a template value (checked="{{:on}}true{{?}}false{{/}}", disabled="{{d}}") was not a boolean: "false" was set as checked="false"/disabled="false", on in a browser;
    • "false" via setResolvedAttribute/setAttribute turned checked/disabled on, while "" or the own name turned selected/hidden off;
    • setAttribute('checked', 'checked') on an element that already had it turned it off.
  • Fix: the generators set a boolean attribute both as the attribute (present when on, removed when off: the element's default state) and, where it stops following it, as the property (option.selected, input.checked, media.muted). selected was only a property, so option[selected] matched nothing and a form reset selected the first option; checked was only an attribute, so a re-render didn't change a checkbox the user had toggled. setAttribute takes null as a bare attribute (on) for every boolean attribute (it removed checked/disabled).

  • Fix: hidden="until-found" (hidden, but found by find-in-page and fragment navigation) is kept as the value: it was read as a boolean, false, so the element was shown. DOMAttribute.booleanAttributeKeyword lists such keywords.

  • Fix: an empty value is a value: data-x="", a valueless data-x and value="" are kept ([data-x] selectors, dataset.x == ""); they were dropped from the HTML and the DOM. DOMAttributeValueString keeps '' apart from null (no value), and DOMElement.buildHTML writes name="". Behaviour change: DOMAttribute.from('title', '') now builds title="" (it built nothing); an empty class or style is still left out. DOMElement.hasAttributeValue is true for an empty value too (only null, absent or a false boolean attribute, is false), as its doc said ("if attribute exists").

    • Regression tests (dom_builder_web_regression_test.dart).
  • Fix: templates (DOMTemplateVariable):

    • A Set in the context is checked for membership ({{:tags.vip}}), giving true or false: it was converted to a List first and indexed, so its membership branch never ran.
    • A Function(Object?) value is called with any context: it also matched Function(Map?), checked first, which cast the context to Map? and threw for a non-Map one. A Function(Map?) gets null for a non-Map context.
    • A Set (or any other Iterable) value works as a condition and a loop ({{:tags}}, {{*:tags}}): it threw.
  • Fix: an empty string value equals '' (and not null): DOMAttributeValueString('').equalsAttributeValue('') was false.

  • Tests for the boolean attributes (checked, hidden, disabled, selected, multiple, inert, autoplay, controls, muted):

    • dom_builder_boolean_attributes_test.dart (VM): DOMAttribute parsing, HTML output (a false one is left out), templates, resolveAttributeValue, and setAttributes setting every resolved value with setResolvedAttribute (also through DOMGeneratorDelegate and DOMGeneratorDummy).
    • dom_builder_web_boolean_attributes_test.dart (browser): each one on its element's property, "true", bare, "false" and absent, from parsed HTML and $tag attributes; selected options (parsed, $option, a multiple select, a template's language select); setAttribute, setResolvedAttribute (on and off, booleanDefault) and setElementAttribute.
  • Coverage tests (VM): dom_builder_base_coverage_test.dart, dom_builder_css_coverage_test.dart, dom_builder_template_coverage_test.dart, dom_builder_helpers_attribute_coverage_test.dart and dom_builder_generator_coverage_test.dart (generator, runtime, tree map): VM line coverage ~85% -> 97.4%. Suspected bugs found are reproduced as skipped tests (skip: 'Bug: …').

  • README: Codecov badge.

3.1.0 #

  • sdk: ^3.13.0

  • $asyncContent: removed final from parameters (a compile error with the Dart 3.13 language version).

  • Adopted Dart 3.8–3.13 language features (flagged by lints 6):

    • Null-aware collection elements and map values (?x, 'k': ?v) in element constructors, $tag helpers ($a, $img, $label, $button, $td, $th) and DOMElement.allEventHandlers.
    • Super parameters in DIVElement, INPUTElement, SELECTElement, OPTIONElement, TEXTAREAElement and the table elements (TABLEElement, CAPTIONElement, THEADElement, TBODYElement, TFOOTElement, TRowElement, THElement, TDElement).
    • CSSEntry._: private named parameter this._comment (Dart 3.12).
    • Explicit types for DOMNode({content}), DOMElement.apply, createTableContent, $b and DSXObjectType.forObject.
  • DOMHtmlBrowserWeb / DOMGeneratorWebImpl:

    • Use Object?.isA<T>() (Dart 3.12) instead of asJSAny.isA<T>().
  • DOMTreeMap:

    • Fix (dart2wasm): getElementDOMTreeMap (and so DOMHtml.toDOMElement) missed generated nodes reached through a different JS wrapper (e.g. element.firstChild). The element association was an Expando keyed by the Dart wrapper; it's now a DOMWeakStore, keyed by JS identity (a JS WeakMap) on the web.
  • DOMNode / DOMElement fixes:

    • apply/applyWhere(classes:): add to the class attribute (used to create a classes attribute).
    • equals: compares attributes and content by value (equal elements used to never match).
    • Content given as a List<DOMNode> subtype is copied: the caller's list is no longer mutated, and adding text to a List<DOMElement> content no longer throws.
    • insertAt of a single parsed node now sets its parent.
    • DOMNode({content}): fixed LateInitializationError (_commented wasn't initialized); a bare DOMNode no longer indents its content.
    • DOMElement.buildHTML: commented elements are omitted, as documented and as DOMNode.buildHTML and the generators already did (e.g. $br(amount: 0) renders '').
  • Tables:

    • Empty TBODYElement/THEADElement/TFOOTElement no longer render a phantom <tr><td></td></tr>.
    • A TDElement in a header row is converted to th (it was nested as <th><td>), and a THElement in a body row is kept (it was nested as <td><th>).
  • DOMAction.parseParameters: fixed ArgumentError for actions with 2+ parameters (e.g. addClass(a, b)).

  • DSX:

    • DSX.varArgs: fixed the 10th argument being replaced by the literal 10.
    • DSXResolver.setResolvedValue: fixed the resolved value (e.g. of a future DSX) being cleared when the previous element wasn't in the DOM.
  • toIntlMessageResolver: a dynamic Function() resolver converts its result with parseString (it threw a TypeError for non-String results).

  • DOMGenerator:

    • buildElement: named elements use the context passed to generate(), falling back to domContext.
    • generateWithRoot/generateFromHTML: fixed a null-check crash when generating into an unmapped parent without a domParent.
  • CSS:

    • Comments of color, width, height, border, opacity, display, background and background-color entries are no longer dropped.
    • CSSMax/CSSMin.compute(): work when all arguments are plain numbers (e.g. max(1, 3, 2) → 3).
    • CSSColorName: keeps its alpha (hasAlpha is false for opaque names, true for transparent).
    • Background repeat-x/repeat-y are no longer parsed as repeat.
  • DOMTemplate:

    • copy() of condition blocks keeps their {{?:x}}/{{?!x}}/{{?}} else branches.
    • A {{?!x}} block no longer renders inside the preceding if-block's content.
    • DOMTemplateBlockElseNot.toString() emits a valid {{?!x}}… block (templates with else-not blocks round-trip).
  • Now based on web_utils 1.1.0 and js_interop_utils 1.1.0, which bring:

    • Node.clear()/clearNodes() fixed for non-Element nodes (used by the web runtime clear).
    • isA-based asJSAny/asJSObject and typed lists .toJS producing JS typed arrays.
  • Dependencies:

    • web_utils: ^1.1.0
    • js_interop_utils: ^1.1.0
    • html: ^0.15.7
    • lints: ^6.1.0
    • test: ^1.32.0
    • dependency_validator: ^5.1.0
    • coverage: ^1.15.1
  • Tests:

    • Added test/dom_builder_web_integration_test.dart: real browser DOM through the package:web generator (events, runtime, tree map, actions, DOMAsync, templates, DSX).
    • Added test/dom_builder_elements_test.dart and test/dom_builder_node_test.dart: elements, helpers, attributes, tables. (dom_builder_node_test.dart isn't compiled with dart2wasm: it triggers a dart2wasm compiler crash, still present in 3.13.5: https://github.com/dart-lang/sdk/issues/64428.)
    • Added test/dom_builder_dsx_css_generator_test.dart: DSX, CSS, generators, templates, context and actions.

3.0.10 #

  • DOMGeneratorWebImpl:

    • addExternalElementToElement: fixed NoSuchMethodError with a List of nodes (the asJSAny extension was called on a dynamic element).
  • DOMNodeRuntimeWebImpl / DOMNodeRuntimeDartHTMLImpl:

    • clearClasses: fixed removing the element's children instead of its classes.
  • DOMActionExecutor:

    • call: fixed removeclass/removeclasses being dispatched to callAddClass instead of callRemoveClass.
  • Element constructors (DIVElement, INPUTElement, SELECTElement, OPTIONElement, TEXTAREAElement and the table elements): use super parameters (use_super_parameters lint).

  • Added test/dom_builder_web_regression_test.dart.

3.0.9 #

  • DOMGeneratorWebImpl:
    • createDOMEvent: fixed argument passed to DOMEvent constructor from eventTarget to webEvent.

3.0.8 #

  • DOMNode:

    • Added method hasFutureElement({bool recursive = false}) to check if the node contains any Future element.
      • If recursive is false, only direct children are checked.
      • If recursive is true, the entire subtree is traversed using an explicit stack in left-to-right DFS order.
  • ExternalElementNode:

    • Added private field _isFutureElement to track if externalElement is a Future.
    • Overridden hasFutureElement to return isFutureElement.
    • Added getter isFutureElement to indicate if externalElement is a Future.
  • dom_builder_helpers.dart:

    • Added $b function to create a b node.
    • Added $h function to create heading nodes (h1, h2, h3, etc.) dynamically.

3.0.7 #

  • DOMContext:

    • copy: fixed copying of _domGenerator field by assigning _domGenerator instead of domGenerator.
    • resolveViewportCSSLength: added local variable viewport to avoid repeated null checks.
    • _computeViewportCSSLength: changed parameter viewport from nullable to non-nullable and removed redundant null assertions.
  • DOMGeneratorWebImpl:

    • Fixed incorrect variable usage in addExternalElementToElement loop by replacing externalElement.asJSAny with e.asJSAny.
  • dom_builder_dsx.dart:

    • _dsxJoinStrings:
      • updated parameter type to List<Object?>.
      • fixed list.remove(i) to list.removeAt(i) to correctly remove element by index.
  • dom_builder_template.dart:

    • DOMTemplateVariable:
      • Improved index bounds check to ensure idx is non-negative before accessing context list elements.

3.0.6 #

  • DOMElement:

    • Added method containsAttribute to check for attribute existence.
  • DOMGeneratorWebImpl:

    • Optimized setAttributes to batch attribute setting for non-special attributes.
    • Added _setElementAttributeSpecial to handle special attributes (selected, multiple, hidden, inert, id, class, style) with direct property manipulation.
    • Updated event listener registration to use weak references to DOMElement to avoid retaining stale references.
    • Improved event listener callbacks to retrieve the actual event target node.
    • Added helper methods _setElementAttribute.
  • DOMTreeMap:

    • Replaced WeakKeyMap with LazyWeakKeyMap for _elementsSubscriptions to improve subscription management.
    • Used LazyWeakReferenceManagerByType for weak reference management.
    • Simplified disposal of event handlers by directly closing streams instead of using finalizers.
    • Removed ExpandoWithFinalizer usage for event handler disposal.
    • Improved internal weak reference handling and subscription cleanup.
  • Dependencies:

    • Updated web_utils from ^1.0.21 to ^1.0.23.
    • Updated js_interop_utils from ^1.0.9 to ^1.0.11.
    • Updated swiss_knife from ^3.3.9 to ^3.3.14.

3.0.5 #

  • DOMTreeMap:

    • Rollback:
      • Replaced _elementToDOMNodeMap type from DualWeakMap to DualMap.
      • Updated usage of _elementToDOMNodeMap methods to non-weak variants (get, containsKey).
      • Removed call to _elementToDOMNodeMap?.purge() in purge() method.
  • Dependencies:

    • Updated swiss_knife dependency from ^3.3.7 to ^3.3.9.

3.0.4 #

  • DOMGenerator:
    • Added method isMappable to check if a DOMNode can be mapped by a DOMTreeMap with a given context.
    • Updated all calls to DOMTreeMap.map and mapTree to pass generator: this and context parameters.
    • Updated build and related methods to pass generator and context when mapping nodes.
  • DOMGeneratorDelegate and DOMGeneratorDummy:
    • Implemented isMappable.
  • DOMTreeMap:
    • Updated map and mapTree methods to accept optional generator and context parameters.
    • map method now calls generator.isMappable to decide whether to perform mapping; skips mapping if not mappable.
  • DOMTreeMapDummy:
    • Updated overridden map and mapTree methods to accept new parameters.

3.0.3 #

  • DOMElement:

    • Added method allEventHandlers to return a snapshot list of all initialized event handlers.
    • Renamed closeAllEventListeners to closeAllEventHandlers and updated documentation accordingly.
  • DSX:

    • Replaced WeakKeyMap with Expando for internal mappings to improve memory management.
    • Fixed key lookups by removing unnecessary casts and using direct keys.
  • DOMTreeMap:

    • Changed _elementsDOMTreeMap to use Expando<WeakReference<DOMTreeMap>> for better lifecycle handling.
    • Improved map method to avoid redundant mappings and update treeMap references correctly.
    • Updated isMappedElement to use containsKeyNoPurge for accurate presence checks.
    • Removed domElementsEventListeners parameter from cancelAllSubscriptions.
    • Added closeDOMElementsEventHandlers method to close all event handlers on DOM elements.
    • Added private _disposeDOMElementsEventHandlers method using ExpandoWithFinalizer to schedule closing event handlers asynchronously.
    • Updated dispose method to optionally dispose event handlers with a new disposeEventHandlers parameter.
    • Updated DOMTreeMapDummy to implement new methods and parameters accordingly.
  • Dependencies:

    • Updated swiss_knife dependency from ^3.3.5 to ^3.3.7.

3.0.2 #

  • DOMGenerator:
    • Refactored setAttributes to use new helper method resolveAttributeValue for attribute value resolution.
    • Added resolveAttributeValue method to handle attribute value computation with support for preserveClass, preserveStyle, boolean attributes, and source resolution.
  • DOMGeneratorDelegate:
    • Added override for resolveAttributeValue delegating to internal domGenerator.
  • DOMGeneratorDummy:
    • Added stub override for resolveAttributeValue returning null.
  • DOMGeneratorWebImpl:
    • Changed setAttribute method to setAttributes accepting DOMElement, Node, and DOMTreeMap with optional preserveClass and preserveStyle flags.
    • Added setAttribute override accepting single attribute name and value.
    • Introduced private helper setElementAttribute to set attributes on Element with special handling for boolean and common attributes (selected, multiple, hidden, inert, id, class, style).
    • Replaced deprecated append calls with appendChild for DOM node insertion.
  • DOMNodeRuntimeWebImpl:
    • Replaced element?.attributes.put(name, value) with element?.setAttribute(name, value).
    • Replaced element?.append(child) with element?.appendChild(child).

3.0.1 #

  • DOMElement:

    • Added getter hasAnyEventListener to check if any event callback is attached.
    • Added method closeAllEventListeners to asynchronously close and remove all attached event listeners.
  • DOMTreeMap:

    • Added method documentation:
      • mapTree, mapSubscriptions, elementsWithSubscriptions, getSubscriptions, cancelSubscriptions, cancelAllSubscriptions.
    • Added method domElementsWithEventListener to return all mapped DOMElements with event listeners.
    • Updated cancelAllSubscriptions to optionally cancel element subscriptions and/or close DOM event listeners attached to elements.
  • DOMTreeMapDummy:

    • Updated cancelAllSubscriptions signature to match DOMTreeMap with optional parameters for subscription and event listener cancellation.

3.0.0 #

  • DOMGenerator:
    • createDOMMouseEvent and createDOMEvent methods:
      • Added optional parameters domTarget and target.
    • DOMGeneratorDelegate:
      • Updated createDOMMouseEvent and createDOMEvent to forward new parameters domTarget and target.
    • DOMGeneratorDummy:
      • Updated createDOMMouseEvent and createDOMEvent signatures to include optional domTarget and target parameters.
  • DOMGeneratorDartHTMLImpl:
    • registerEventListeners:
      • Pass domTarget and target when calling createDOMMouseEvent and createDOMEvent.
    • createDOMMouseEvent and createDOMEvent:
      • Use target parameter if provided; otherwise, use event's target.
      • Use domTarget parameter if provided; otherwise, map event target to DOM node.
  • DOMGeneratorWebImpl:
    • registerEventListeners:
      • Pass domTarget and target when calling createDOMMouseEvent and createDOMEvent.
    • createDOMMouseEvent and createDOMEvent:
      • Use target parameter if provided; otherwise, use event's target.
      • Use domTarget parameter if provided; otherwise, map event target to DOM node.
      • Adjusted parameter order and usage for DOMMouseEvent and DOMEvent constructors.

3.0.0-beta.11 #

  • DSX:

    • Added DSXObjectType enum to classify DSX objects (function, future, generic).
    • Changed internal DSX storage to use WeakKeyMap and WeakReference for better memory management.
    • Added lifecycle management support with DSXLifecycleManager interface and integration in DSX and DSXResolver.
    • Added DSXResolution class to control DSX resolution behavior and lifecycle manager usage.
    • Updated DSXResolver to support lifecycle management and improved resolved value handling.
    • Improved DSX equality and disposal logic.
  • DOMAttribute:

    • Updated buildHTML and related methods to use DSXResolution instead of a boolean resolveDSX.
    • Added support for DSX lifecycle management in attribute value resolution.
  • DOMNode and subclasses (TextNode, TemplateNode, DOMElement, ExternalElementNode):

    • Updated buildHTML methods to accept DSXResolution parameter instead of boolean resolveDSX.
    • DOMElement:
      • Added _resolvedDSXEventAttributes field and methods to resolve DSX event attributes.
      • Added resolvedDSXs() method to iterate resolved DSX objects.
      • Updated HTML building methods to use DSXResolution.
      • Added resolveDSX() method to resolve DSX attributes.
      • Integrated DSX lifecycle management for resolved DSX event attributes.
    • ExternalElementNode:
      • Updated buildHTML to accept DSXResolution.
  • DOMTemplate and subclasses:

    • Replaced boolean resolveDSX parameters with DSXResolution for DSX resolution control.
    • Updated copy methods to accept DSXResolution.
    • Updated build methods to propagate DSXResolution.
    • Updated DOMTemplateVariable to evaluate and resolve values with DSXResolution.
    • Updated conditional blocks (DOMTemplateBlockIf, DOMTemplateBlockIfCmp, DOMTemplateBlockNot, etc.) to evaluate with DSXResolution.
    • Updated string conversion and copy logic to respect DSX resolution.
  • DOMGenerator:

    • Updated buildTemplate to use DSXResolution.lifecycleManager when building templates.
  • DOMGeneratorWebImpl:

    • Replaced event listener subscriptions with addEventListenerTyped calls.
    • Removed unused subscription list and mapping.
  • DOMTreeMap:

    • Implemented DSXLifecycleManager interface.
    • Added DSX lifecycle management methods: manageDSX, disposeDSX, disposeManagedDSXs, isManagedDSX.
    • Added manageDOMElementDSXs to manage DSX objects in DOMElement.
    • Added queryElement and queryElementAsHTML methods for querying and rendering elements.
    • Updated mapping to store weak references and manage DSX lifecycle.
    • Added cancelAllSubscriptions method.
    • Added dispose method to clean up mappings and managed DSXs.
      • added optional parameters cancelSubscriptions and disposeDSXs to control whether subscriptions are canceled and DSXs are disposed during disposal.
    • Updated purge to remove disposed DSXs.
    • Added toString override for debugging.
  • DOMTreeMapDummy:

    • Implemented DSXLifecycleManager interface with no-op methods.
  • pubspec.yaml:

    • Updated web_utils dependency from ^1.0.20 to ^1.0.21.
    • swiss_knife: ^3.3.4 -> ^3.3.5

3.0.0-beta.10 #

  • DOMTreeMap:
    • Added private field _purgeCount and public getter purgeCount.
    • purge():
      • Updated purge method to increment _purgeCount
      • Fix: removed null assignments to _elementToDOMNodeMap and _elementsSubscriptions (breaks DOMNode.runtimeNode).

3.0.0-beta.9 #

  • DOMNode:

    • buildDOM: added parameters treeMap and setTreeMapRoot, passed to DOMGenerator.generate.
    • Added nodesView getter returning an unmodifiable list of children nodes.
  • DOMGenerator:

    • getElementNodes: added named parameter asView.
    • Added caching of a generic DOMTreeMapDummy instance.
    • Added treeMap and setTreeMapRoot parameters to generate, resolveElements, toElements, addExternalElementToElement, and related methods.
    • Updated attachFutureElement to pass treeMap and context to resolveElements.
    • Added cancelEventSubscriptions method with default implementation returning false.
    • Updated resolveActionAttribute to fix event stream assignment for non-form elements.
    • Updated DOMGeneratorDelegate to forward new parameters and cancelEventSubscriptions.
    • Updated DOMGeneratorDummy to implement new method signatures and add cancelEventSubscriptions returning false.
    • Updated DOMGeneratorDartHTMLImpl and DOMGeneratorWebImpl:
      • Added treeMap and context parameters to addExternalElementToElement.
      • Refactored registerEventListeners to collect subscriptions and map them in treeMap.
      • Added cancelEventSubscriptions implementation to cancel all mapped subscriptions asynchronously.
      • Fixed type checks and casts in addExternalElementToElement.
      • Added missing event listeners for onError.
  • DOMTreeMap:

    • Replaced internal maps with DualWeakMap for element-to-DOMNode mapping.
    • Added subscription management with WeakKeyMap and automatic purge handling.
    • Added methods mapSubscriptions, getSubscriptions, cancelSubscriptions, and elementsWithSubscriptions.
    • Updated mapping methods to use new map structure.
    • Added purge method to clear internal maps.
    • Updated getMappedElement and matchesMapping to use new map.
    • Updated isMappedDOMNode to use new map.
    • Updated mapTree to maintain mapping consistency.
  • DOMNodeRuntime:

    • Updated replaceBy to pass treeMap and setTreeMapRoot to toElements.
  • DSX:

    • Replaced Expando with DualWeakMap for internal mappings.
    • Added static purge method to clean unused entries.
    • Updated check method to remove mappings properly.
    • Updated generic type constraints to T extends Object.
    • Updated dsx extension on FutureOr<T?> to handle null safety and typing.
    • Updated DSXResolver generic constraint to T extends Object.
    • Updated $dsxCall to assert non-null return.
    • Updated DSXType generic constraint to T extends Object.
  • pubspec.yaml:

    • Updated swiss_knife dependency from ^3.3.3 to ^3.3.4.
    • web_utils: ^1.0.20

3.0.0-beta.8 #

  • DOMAttribute:

    • Added appendTo.
    • Optimize string building/concatenation.
  • DOMElement

    • buildHTML: Optimize string building/concatenation.
  • DOMGenerator:

    • Added createSVGElement.
  • DOMGeneratorWebImpl: implement createSVGElement.

3.0.0-beta.7 #

  • DOMNodeRuntime:

    • getAttribute: fix, use getAttributeValue.
  • web_utils: ^1.0.19

3.0.0-beta.6 #

  • web_utils: ^1.0.18

3.0.0-beta.5 #

  • DOMGenerator:

    • _parseExternalElement:
      • Improve element resolution.
      • Allow unresolved Object as toString.
    • toElements: optimize and allow unresolved Object as toString.
    • Added resolveElements.
    • Added wrapElements.
  • web_utils: ^1.0.16

  • js_interop_utils: ^1.0.9

  • html: ^0.15.6

  • swiss_knife: ^3.3.3

  • test: ^1.26.3

  • dependency_validator: ^4.1.3

  • coverage: ^1.15.0

3.0.0-beta.4 #

  • DOMGeneratorWebImpl:
    • Optimize setAttribute for common attributes (avoid call to Element.setAttribute).

3.0.0-beta.3 #

  • DOMGenerator:

    • Added equalsNodes (avoids using identical with JSObject and inconsistencies in Wasm).
  • DOMTreeMap:

    • Fix matchesMapping: use _domNodeToElementMap instead of _elementToDOMNodeMap.
  • web_utils: ^1.0.9

  • js_interop_utils: ^1.0.6

  • swiss_knife: ^3.3.0

  • web: ^1.1.1

3.0.0-beta.2 #

  • web_utils: ^1.0.6

3.0.0-beta.1 #

  • DOMGenerator:

    • T now extends Object (non-nullable): DOMGenerator<T extends Object>
  • DOMNode:

    • defaultDomGenerator: change to DOMGenerator.web().
  • DOMGeneratorDartHTMLUnsupported renamed to DOMGeneratorUnsupported as a generic DOMGenerator unsupported class.

  • New library dom_builder_web.dart.

    • New DOMGeneratorWeb and DOMHtmlBrowserWeb.
    • Added DOMGenerator.web and DOMGenerator.setDefaultDomGeneratorToWeb.
    • Change from dart:html to package:web/web.dart.
    • Change to dart:js_interop.
  • Deprecate DOMGenerator.dartHTML, DOMGeneratorDartHTML and DOMGeneratorDartHTMLImpl.

  • Deprecate library dom_builder_dart_html.dart.

  • CI: test with dart2js and dart2wasm (on Chrome).

  • sdk: '>=3.6.0 <4.0.0'

  • web: ^1.1.0

  • web_utils: ^1.0.5

  • js_interop_utils: ^1.0.5

  • collection: ^1.19.0

  • lints: ^5.1.1

  • test: ^1.25.15

2.2.9 #

  • DOMGeneratorDartHTMLImpl:
    • Optimize setAttribute for common attributes (avoid call to Element.setAttribute).

2.2.8 #

  • sdk: '>=3.6.0 <4.0.0'

  • swiss_knife: ^3.3.0

  • collection: ^1.19.0

  • lints: ^5.1.1

  • test: ^1.25.15

2.2.7 #

  • Improve null-safe code.

  • DOMGenerator:

    • Added isChildOfElement.
    • buildElement: call setAttributes before addChildToElement, to avoid DOM state update.
  • DOMGeneratorDartHTMLImpl:

    • Optimize addChildToElement and removeChildFromElement.
  • sdk: '>=3.4.0 <4.0.0'

  • html: ^0.15.5

  • swiss_knife: ^3.2.3

  • collection: ^1.18.0

  • lints: ^4.0.0

  • test: ^1.25.14

  • dependency_validator: ^4.1.2

  • coverage: ^1.11.1

2.2.6 #

  • DOMElement: added validator.

  • Change whereNotNull() to nonNulls.

  • swiss_knife: ^3.2.1

  • test: ^1.25.8

  • coverage: ^1.9.0

2.2.5 #

  • DOMHtmlBrowser:

    • Optimize parse.
  • DOMNode:

    • Added parseString and parseStringNodes.
  • $html: optimize using DOMNode.parseStringNodes.

2.2.4 #

  • $p: added parameter content.

  • Added $emsp.

  • Optimized $nbsp.

  • Optimized _parseStringNodes and _parseListNodes.

2.2.3 #

  • Added possiblyWithHTMLTag and possiblyWithHTMLEntity.

  • possiblyWithHTML: also check for HTML entities.

  • DOMGenerator.buildTemplate: fix resolution of entries with an HTML entity but without an HTML tag.

  • swiss_knife: ^3.2.0

  • test: ^1.25.5

  • coverage: ^1.8.0

2.2.2 #

  • Added DOMTreeMap.getElementDOMTreeMap.

2.2.1 #

  • DOMHtmlBrowser:

    • Fix toDOMElement for checkbox.
  • New CHECKBOXElement.

  • $checkbox: added parameter checked.

  • WithValue:

    • Changed from interface to mixin.
    • Added valueAsBool, valueAsInt, valueAsDouble, valueAsNum.
  • dependency_validator: ^3.2.3

2.2.0 #

  • DOMEvent:

    • Change field target from DOMElement to DOMNode to allow ExternalElementNode as target or any other DOMNode implementation.
  • Dart CI: update and optimize jobs.

  • sdk: '>=3.0.0 <4.0.0'

  • html: ^0.15.4

  • collection: ^1.18.0

  • lints: ^2.1.1

  • test: ^1.24.6

2.1.9 #

  • Fix onKeyDown handling and building.

2.1.8 #

  • Optimize:
    • DOMAttribute.from:
      • Check DOMTemplate.possiblyATemplate before call DOMTemplate.parse.
    • DOMTemplate:
      • possiblyATemplate and _parse: check for minimal template length.
    • DOMNode:
      • from, parseNodes and _parseNode: optimize Iterable nodes resolution.
      • _addListToContent and __insertListToContent: Avoid input list copy.
    • DOMElement:
      • Field tag:
        • Changed to NOT null.
        • Always lower-case.
  • html: ^0.15.3

2.1.7 #

  • Added CSSFunction (extends CSSValues):
    • New CSSValues: CSSMax and CSSMin.
    • CSSCalc now extends CSSFunction.
  • swiss_knife: ^3.1.5

2.1.6 #

  • Fix createTableCells.

2.1.5 #

  • DOMAction: implement == and hashCode.
  • DOMGenerator:
    • resolveActionAttribute: ensure that eventStream.listen is singleton.
  • swiss_knife: ^3.1.4

2.1.4 #

  • DOMHtmlBrowser:
    • toDOMElement: resolve input value as attribute.
  • DOMElement constructor:
    • Optimize tag resolution.

2.1.3 #

  • DOMNode:
    • buildHTML: added parameter buildTemplates = false.
  • TemplateNode:
    • buildHTML:
      • respect buildTemplates parameter.
      • pass domContext to build calls.
  • html: ^0.15.2
  • swiss_knife: ^3.1.3
  • lints: ^2.0.1
  • test: ^1.23.1
  • coverage: ^1.6.3

2.1.2 #

  • $button: Added name and disabled.
  • $input, $checkbox, $radiobutton, $select, $option: Added disabled.
  • INPUTElement, TEXTAREAElement, SELECTElement, OPTIONElement: Added disabled.
  • collection: ^1.17.0

2.1.1 #

  • Added element events for onKeyPress, onKeyDown and onKeyUp.

2.1.0 #

  • Added helpers $ul, $ol, $li.
  • Better handling of content as Iterable (auto converted to List, to avoid re-iteration).
  • Updated list of self-closing tags:
    • area, base, br, embed, hr, img, input, link, meta, param, source, track, wbr.
  • sdk: '>=2.15.0 <3.0.0'
  • dependency_validator: ^3.2.2
  • coverage: ^1.5.0

2.0.10 #

  • CSS:
    • Added putIfAbsent and putAllIfAbsent.
    • Ensure that number values when converted to String won't end in unnecessary .0.
    • CSSColorRGBA: ensure that when alpha is 1.0 it will generate rgb (not rgba) with only 3 elements.
  • $table:
    • Parameters thsStyle, trsStyle and tdsStyle won't override a CSS style already defined in the table elements.
  • GitHub CI:
    • Remove use of Dart container.
    • Fix coverage command for dart 2.17+
  • swiss_knife: ^3.1.1
  • collection: ^1.16.0
  • lints: ^2.0.0

2.0.9 #

  • Dart 2.16:
    • Organize imports.
    • Fix new lints.
  • sdk: '>=2.13.0 <3.0.0'
  • Added helper $radiobutton.
  • Tag video:
    • Allow boolean attributes: 'autoplay', 'controls' and 'muted'.

2.0.8 #

  • dom_builder_html_browser.dart: reuse DomParser instance.

2.0.7 #

  • Added DOMHtml, a portable HTML handler and parser.
    • When compiling to the browser uses dart:html.
  • Fix OPTIONElement.toOptions:
  • Migrated from package pedantic to lints.
  • Using Dart coverage.
  • lints: ^1.0.1
  • coverage: ^1.0.3

2.0.6 #

  • Allow built of DOMTemplate without resolve DSX entries.
  • DOMNodeRuntime:
    • added remap parameter to replaceBy.
    • Improved documentation.
  • Improved test coverage.
  • swiss_knife: ^3.0.8
  • test: ^1.17.10

2.0.5 #

  • Added DOMTreeMap.queryElement.
  • Fix resolution of attributes with templates in some scenarios.
  • Added code coverage.

2.0.4 #

  • Templates now can also generate a DOMNode and not only texts/String.
  • DSX:
    • Allow DOM elements.
    • Allow observation of mapped DSX.
  • Fix hidden parameter, to not be defined when null (default was false now is null).

2.0.3 #

  • Implemented DSX support, similar to JSX.
    • Templates also accepts DSX references, including functions/lambdas.

2.0.2 #

  • Null Safety adjustments.
  • swiss_knife: ^3.0.6

2.0.1 #

  • Null Safety adjustments.
  • swiss_knife: ^3.0.5

2.0.0 #

  • Dart 2.12.0:
    • Sound null safety compatibility.
    • Update CI dart commands.
    • sdk: '>=2.12.0 <3.0.0'
  • html: ^0.15.0
  • swiss_knife: ^3.0.1
  • pedantic: ^1.11.0
  • test: ^1.16.5

1.0.26 #

  • Improved boolean attributes: 'selected', 'multiple', 'inert'.
  • Help $divCenteredContent: added style and class.
  • New helper: $checkbox.
  • Ensure that all element classes and helpers have the global attribute hidden.
  • swiss_knife: ^2.5.26

1.0.25 #

  • DOMElement: added event handler onLoad and onError.
  • DOMTemplate: added support to {{intl:key}}.
  • swiss_knife: ^2.5.25

1.0.24 #

  • Added support to content as Future.
    • When a Future is completed, the result will be inserted in the generated DOM tree.
  • Added DOMAsync for async nodes.
    • With support for loading content, that will be replaced by result of async content.
  • Added interfaces AsDOMElement and AsDOMNode.
  • Added $select and $option helpers.

1.0.23 #

  • Table:
    • Added support to table caption.
    • Added colspan and rowspan to helpers.
    • Added thsStyle and tdsStyle to $table helper.
  • DOMTemplate:
    • Added tryParse and possiblyATemplate.
    • Now TextNode with a template code is mapped to TemplateNode.
    • toString() now re-builds the template text code.
    • Improved tests.

1.0.22 #

  • DOMTemplate:
    • added locale call action.
    • Added multiple actions using ; delimiter.
    • Added variable comparison.
  • DOMElement: added onChange events.
  • swiss_knife: ^2.5.18

1.0.21 #

  • DOMTemplate:
    • Added support to {{.}} syntax.
    • Better resolution of variables.

1.0.20 #

  • DOMTemplate: support to template syntax, using {{...}} blocks.
  • Added DOMAction and DOMActionExecutor, that can perform operations over DOMElement based into a simple syntax.
  • DOMNode:
    • Added selectWithAllClass, selectWithAnyClass, selectByTag.
    • Added containsAllClasses and containsAnyClass.
  • CSSColor: added inverse getter.

1.0.19 #

  • Added CSSNumber.
  • Added CSSBackground.
  • CSS:
    • Added support to parse comments.
    • Added support to CSS background and opacity.
  • CSSColorName: support for name transparent.
  • CSSBorder: improve parsing.
  • DOMNode:
    • Added onGenerate event.
    • Added containsNode.
    • Added root getter.
  • Added helper $img.
  • Added helper $divCenteredContent: A div that centers vertically and horizontally content.
  • Fix DOMElement.buildHTML for self-closing tags.
  • Improved DOMElement.possibleAttributes.
  • DOMGenerator: added revertElementAttributes.
  • DOMContext: Added resolveCSSURL and cssURLResolver.

1.0.18 #

  • Added option to generate XHTML.
  • Added resolveSource, to translate any src or href attribute.
  • Added DOMGeneratorDelegate.
  • Fix CSSLength, to parse double.
  • swiss_knife: ^2.5.14
  • pedantic: ^1.9.2
  • test: ^1.15.4
  • test_coverage: ^0.4.3

1.0.17 #

  • DOMNodeRuntime: Can manipulate CSS/style.
  • Added DOMContext and Viewport for DOMGenerator.
  • CSS: now is capable to convert viewport units to pixel units, based into [DOMContext] and [Viewport].
  • Better CSSLength, CSSBorder, CSSColorRGB, CSSColorHEX and CSSURL parsing.
  • swiss_knife: ^2.5.12

1.0.16 #

  • Added CSS.parseList.
  • Added new base class DOMAttributeValueCollection.
  • Improved DOMGenerator.revert.
  • Fix typo.

1.0.15 #

  • DOMGenerator: New revert feature.
  • DOMGenerator: registerElementGenerator now receives a class ElementGenerator, that implements generate and revert.
  • DOMGenerator: Added getElementTag and getElementAttributes.
  • DOMAttribute fix: Avoid adicional space to HTML tags when DOMAttribute.buildHTML() generates an empty string (usually false boolean attributes).

1.0.14 #

  • Many improvements into CSS support.
  • Added CSSURL, CSSColorName, CSSGeneric, CSSCalc.
  • Added abstract class DOMAttributeValue for: DOMAttributeValueBoolean, DOMAttributeValueString, DOMAttributeValueList, DOMAttributeValueSet, DOMAttributeValueCSS.
  • DOMNode.buildDOM now accepts a T parent parameter.
  • swiss_knife: ^2.5.8

1.0.13 #

  • More CSS support: CSSBorder.
  • Preserve CSS entries order.
  • dartfmt.

1.0.12 #

  • Added initial CSS support.

1.0.11 #

  • DOMElement: fix absorbNode.
  • Removed helper $node
  • dartfmt.

1.0.10 #

  • DOMElement: added isCompatibleForMerge.
  • DOMGenerator: added ignoreAttributeEquivalence.
  • DOMTreeMap: added: matchesMapping.
  • DOMTreeMap: fixed duplicateByDOMNode, mergeNearNodes.
  • DOMNodeRuntime: fixed mergeNode, isPreviousNode, isNextNode.
  • Fix $br for amount = 0.

1.0.9 #

  • dartfmt.

1.0.8 #

  • Added DOMTreeMap: can be used to map a DOMNode to a generated node.
  • Added DOMNodeRuntime and DOMNode.runtime to manipulate and access the actual generated node from the virtual node.
  • Added onClick and DOMEvent.
  • Added DOMNode.copy.
  • Added node operations: moveUp, moveUpNode, moveDown, moveDownNode, duplicate, duplicateNode, clearNodes, delete, deleteNode.
  • Added: absorbNode, merge.
  • Added: isInSameParent, isPreviousNode, isNextNode, isConsecutiveNode, isConsecutiveNode.
  • Added: isStringElement, isWhiteSpace.
  • refactor DOMAttribute: set values.
  • Added: DOMElement.addClass.
  • buildHTML: prioritize attributes: id, class and style. Also shows boolean attributes at end of tag.
  • buildHTML: Char \xa0 is replaced to &nbsp; to rollback conversion.
  • External element function: now accepts non argument version.
  • Optimize call to asNodeSelector.
  • Added tests.
  • Added test_coverage.
  • swiss_knife: ^2.5.5

1.0.7 #

  • Added helpers for header and footer.
  • dartfmt

1.0.6 #

  • dartfmt.

1.0.5 #

  • Added API Documentation.
  • dartfmt.
  • swiss_knife: ^2.5.2

1.0.4 #

  • Fix README example and new examples.
  • Fix 'dartdoc' issues.

1.0.3 #

  • Better handling of selectors formats: .class, #id, tag
  • Table support.
  • Fix build HTML with ident.
  • Element helpers: $input, $textarea, $button, $label, $p, $br, $hr, $table, $thead, $tfoot, $tbody, $tr, $td, $th, $$divInline.

1.0.2 #

  • Added support for external elements.

1.0.1 #

  • Add generic DOMGenerator and support for dart:html.

1.0.0 #

  • Initial version, created by Stagehand
19
likes
155
points
3k
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Generate and manipulate DOM elements (virtual or real), DSX (like JSX) and HTML declarations (Web and Native support).

Repository (GitHub)
View/report issues

License

BSD-3-Clause (license)

Dependencies

collection, html, js_interop_utils, swiss_knife, web_utils

More

Packages that depend on dom_builder