Skip to content

Latest commit

 

History

History
240 lines (121 loc) · 7.67 KB

reference.md

File metadata and controls

240 lines (121 loc) · 7.67 KB

_dom

Create an HTMLElement

  • parameter {string} tagName the element tagname
  • parameter {object} [datas] element attributes.
  • parameter {Array} [childs] element childs. can contain strings an html elements.
  • parameter {string} [nameSpace] element namesapace if any.
  • returns {HTMLElement} a new html element

_dom.addService

(beta) adds a module service

  • param {string} name
  • param {Class(proxy:DomServiceConstructorProxy)} constructor : service constructor
  • param {array|function():array} args arguments for instanciation
  • returns {any} service

_dom.append

(deprecated,system) adds elements to target

  • param {*} target
  • param {html||text[]} childs

_dom.catchMethod

(beta) Hacks target native methods

  • param {object} target
  • param {string} method
  • param {function} callback
  • returns {CatchMethod}

_dom.cssStatus

(beta) Use with model declaration to handle status binded css

  • param {string|object(prefix?:string,defaultValue?:string,initValue?:string)} options
    css prefix or options :
    - prefix?: the css prefixing status className
    - defaultValue?: the default status when unidentified
    - initValue?: the status when attaching dom.
  • returns {DomCssStatus}

_dom.defaultCss

Get browser native element default css values.

  • parameter {string} tagName : tag name of the native element to test
  • returns {Map} the default css values.

_dom.export

(beta) clone _dom module and obfuscate unreferenced models

  • param {string[]|string} models : reference public models.
  • returns {_dom}

_dom.findParent

Finds dom parent if the condition is fullfilled

  • param {Htmlelement} dom : the starting element
  • param {function():boolean} condition : checks if the element fullfills your conditions
  • param {number>1} maxDeep : how deep in the parent pile you will search
  • returns {Htmlelement}

_dom.has

Checks if a model is available in this module.

  • parameter {string} tagName : the name of the model
  • return {boolean} true if tagName exists.

_dom.import

(beta) import other modules

  • param {Array<_dom|DomModule>} domModules

_dom.instance

Instanciates a declared model.
Useful if you dont want of the __dom property in your html element.
If not, you should instead use _dom and refer to the result __dom attribute.

  • parameter {string} tagName
  • parameter {...} ___ whatever arguments the model constructor uses
  • returns {DomModelInstance} an object with the 'dom' property as the root HTMLElement.

_dom.model

Add a custom element to this module.
NB: the __dom property will be added to the element, pointing to it's interface (model instance).
interface['dom'] : dom element;
interface[tagName] : element tagName;

  • parameter {string} tagName the custom element name. Should contain at least one "-" to avoid conflict with natives HTMLElements.
  • parameter {function} constructor receive the arguments of _dom(...args) but the dont have to respect the nomenclature excepted 'tagName'.
    Must return an HTMLElement.
    NB : constructor Must be a function and NOT a lambda expression because it is scoped to its interface.
  • parameter {object|function} [cssRules] is or returns an object describing rules like _dom.rules,
    but the created collection will be instancied only once and shared among interfaces.
    Adds the 'rules' property to the interface.
  • parameter {boolean|object} [shadowed] If true or object, your model is instanciable via html.
    See _dom.modelShadow.
    if object, shadowed is the arguments types by their name.

_dom.modelShadow

renders your model intanciable via html by using dom shadow

  • parameter {string} tagName the model name.
  • parameter {object} [argTypes] argument types by their name.

_dom.modelShadowed

check if a model has allready been shadowed.

  • parameter {string} tagName the model name.
  • returns {boolean}

_dom.module

(beta) returns an empty module.
Use with export and import to modularise applications

  • param {string} [name]
  • returns {_dom}

_dom.rule

Create a new js cssRule object;

  • parameter {string} selector the new rule css query.
  • parameter {object} [datas] style datas.
  • returns {CSSStyleRule}

_dom.rules

Create a collection of cssRule objects;

  • parameter {object} datas sass like structured object
  • parameter {CSSStyleSheet} [sheet] target stylesheet
  • parameter {string} [uniquePrefix] if set, will encapsulate datas with a unique className.
    an object {className:string,rules:object([ruleName]:CSSStyleRule} will be returned.
  • returns {object([ruleName]:CSSStyleRule)}

_dom.scrollTo

scroll container to target element

  • param {HtmlElement} container
  • param {HtmlElement} target
  • param {[number,number]} [offset] : position offset

_dom.models

  • property {string[]} _dom.models a list of available models in this module.

_dom.moduleName

  • property {string} _dom.moduleName return the handling module name.

_dom.services

  • property {Proxy} _dom.services A proxy to the module services by their name.

_dom.sheet

  • property {CSSStyleSheet} _dom.sheet The last available CSSStyleSheet.

_dom.uid

  • property {uid} _dom.uid a different unique id each time it is read.