@duckafire/html.js 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -93,9 +93,14 @@ div( null,
93
93
  "foo foo"
94
94
  br();
95
95
  "bar bar"
96
+ input( {type: "text", value: "foobar", readOnly: "~"}),
96
97
  div);
97
98
  ```
98
99
 
100
+ > [!TIP]
101
+ > Defining a property as `"~"` makes it equal itself, in other words, `open: "~"` is
102
+ > equal `open: "open"`.
103
+
99
104
  All these functions/methods have the same parameter structure, the only difference it
100
105
  is their names/identifiers, because of this, I will not to list all them here, but I
101
106
  will explain their structure.
package/html.js CHANGED
@@ -112,12 +112,6 @@ const __htmljs_core__ = (elementTag, htmlProperties, ...children) =>
112
112
  case "eventListeners": __htmljs_set_event_listeners__( ELEM, PROPERTY, htmlProperties); continue;
113
113
  }
114
114
 
115
- if(ELEM[PROPERTY] === undefined)
116
- {
117
- __htmljs_debug_func__(new TypeError(`Invalid property (${PROPERTY}) to ${ELEM.constructor.name}.`));
118
- continue;
119
- }
120
-
121
115
  ELEM[PROPERTY] =
122
116
  htmlProperties[PROPERTY] == "~"
123
117
  ? PROPERTY
package/html.min.js CHANGED
@@ -1 +1 @@
1
- "use strict";let __htmljs_ignore_last__=1,__htmljs_debug_func__=console.warn;const __htmljs_is_not_object__=e=>"object"!=typeof e||Array.isArray(e),__htmljs_element_tags__=["area","base","br","col","hr","img","input","link","meta","source","track","wbr","a","abbr","address","article","audio","b","bdi","bdo","blockquote","body","button","canvas","caption","cite","code","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","html","i","iframe","ins","kbd","label","legend","li","main","map","mark","meter","nav","noscript","object","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","samp","script","section","select","small","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","ul","var","video"],__htmljs_check_group_type__=(e,t)=>!__htmljs_is_not_object__(t[e])||(__htmljs_debug_func__(new TypeError(`Invalid value attributed to \`${e}\`, expecting an object.`)),!1),__htmljs_set_group_of_attributes__=(e,t,_,r)=>{if(__htmljs_check_group_type__(_,r))for(const o in r[_])t.setAttribute(e+"-"+o,r[_][o])},__htmljs_set_event_listeners__=(e,t,_)=>{if(__htmljs_check_group_type__(t,_))for(const r in _[t])if(Array.isArray(_[t][r]))for(const o of _[t][r])e.addEventListener(r,o);else e.addEventListener(r,_[t][r])},__htmljs_core__=(e,t,..._)=>{const r=document.createElement(e);if(void 0!==t){let e="";const o=_.length-__htmljs_ignore_last__;if(null!==t){__htmljs_is_not_object__(t)&&(__htmljs_debug_func__(new TypeError(`Excepting Object to \`htmlProperties\`, instead "${typeof t}".`)),t={});for(const e in t){switch(e){case"dataSets":__htmljs_set_group_of_attributes__("data",r,e,t);continue;case"ariaAttributes":__htmljs_set_group_of_attributes__("aria",r,e,t);continue;case"eventListeners":__htmljs_set_event_listeners__(r,e,t);continue}void 0!==r[e]?r[e]="~"==t[e]?e:t[e]:__htmljs_debug_func__(new TypeError(`Invalid property (${e}) to ${r.constructor.name}.`))}}for(let t=0;t<o;t++)if("string"!=typeof _[t])if(_[t]instanceof HTMLElement){""!=e&&(r.appendChild(document.createTextNode(e)),e="");try{r.appendChild(_[t])}catch(e){__htmljs_debug_func__(e);break}}else __htmljs_debug_func__(new TypeError(`Excepting Object or String to \`children[${t}]\`, instead "${typeof _[t]}".`));else e+=(""==e?"":" ")+_[t];""!=e&&r.appendChild(document.createTextNode(e))}return r},htmljs_set_ignore_last=e=>{__htmljs_ignore_last__=e?1:0},htmljs_set_debug_mode=e=>{const t=typeof e;if("number"!=t)throw new TypeError(`Invalid mode type: "${t}". Use only integer numbers.`);if(e>2)throw new RangeError(`Invalid mode value: "${e}". Use only 0, 1, or 2.`);__htmljs_debug_func__=[()=>{},console.warn,e=>{throw e}][Math.floor(e)]},declare_htmljs=(...e)=>{let t,_,r;null!==e[0]&&"object"==typeof e[0]?({prefix:t,createObject:_,useUpperCase:r}=e[0]):[t,_,r]=e;const o=_?{}:window,s=t||"";let n;return __htmljs_element_tags__.forEach((e,t)=>{n=s+e,o[r?n.toUpperCase():n]=t<12?t=>__htmljs_core__(e,t):(t,..._)=>__htmljs_core__(e,t,..._)}),o};
1
+ "use strict";let __htmljs_ignore_last__=1,__htmljs_debug_func__=console.warn;const __htmljs_is_not_object__=e=>"object"!=typeof e||Array.isArray(e),__htmljs_element_tags__=["area","base","br","col","hr","img","input","link","meta","source","track","wbr","a","abbr","address","article","audio","b","bdi","bdo","blockquote","body","button","canvas","caption","cite","code","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","html","i","iframe","ins","kbd","label","legend","li","main","map","mark","meter","nav","noscript","object","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","samp","script","section","select","small","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","ul","var","video"],__htmljs_check_group_type__=(e,t)=>!__htmljs_is_not_object__(t[e])||(__htmljs_debug_func__(new TypeError(`Invalid value attributed to \`${e}\`, expecting an object.`)),!1),__htmljs_set_group_of_attributes__=(e,t,_,r)=>{if(__htmljs_check_group_type__(_,r))for(const o in r[_])t.setAttribute(e+"-"+o,r[_][o])},__htmljs_set_event_listeners__=(e,t,_)=>{if(__htmljs_check_group_type__(t,_))for(const r in _[t])if(Array.isArray(_[t][r]))for(const o of _[t][r])e.addEventListener(r,o);else e.addEventListener(r,_[t][r])},__htmljs_core__=(e,t,..._)=>{const r=document.createElement(e);if(void 0!==t){let e="";const o=_.length-__htmljs_ignore_last__;if(null!==t){__htmljs_is_not_object__(t)&&(__htmljs_debug_func__(new TypeError(`Excepting Object to \`htmlProperties\`, instead "${typeof t}".`)),t={});for(const e in t){switch(e){case"dataSets":__htmljs_set_group_of_attributes__("data",r,e,t);continue;case"ariaAttributes":__htmljs_set_group_of_attributes__("aria",r,e,t);continue;case"eventListeners":__htmljs_set_event_listeners__(r,e,t);continue}r[e]="~"==t[e]?e:t[e]}}for(let t=0;t<o;t++)if("string"!=typeof _[t])if(_[t]instanceof HTMLElement){""!=e&&(r.appendChild(document.createTextNode(e)),e="");try{r.appendChild(_[t])}catch(e){__htmljs_debug_func__(e);break}}else __htmljs_debug_func__(new TypeError(`Excepting Object or String to \`children[${t}]\`, instead "${typeof _[t]}".`));else e+=(""==e?"":" ")+_[t];""!=e&&r.appendChild(document.createTextNode(e))}return r},htmljs_set_ignore_last=e=>{__htmljs_ignore_last__=e?1:0},htmljs_set_debug_mode=e=>{const t=typeof e;if("number"!=t)throw new TypeError(`Invalid mode type: "${t}". Use only integer numbers.`);if(e>2)throw new RangeError(`Invalid mode value: "${e}". Use only 0, 1, or 2.`);__htmljs_debug_func__=[()=>{},console.warn,e=>{throw e}][Math.floor(e)]},declare_htmljs=(...e)=>{let t,_,r;null!==e[0]&&"object"==typeof e[0]?({prefix:t,createObject:_,useUpperCase:r}=e[0]):[t,_,r]=e;const o=_?{}:window,s=t||"";let n;return __htmljs_element_tags__.forEach((e,t)=>{n=s+e,o[r?n.toUpperCase():n]=t<12?t=>__htmljs_core__(e,t):(t,..._)=>__htmljs_core__(e,t,..._)}),o};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@duckafire/html.js",
3
3
  "author": "duckafire",
4
- "version": "0.1.0",
4
+ "version": "0.1.1",
5
5
  "license": "Zlib",
6
6
  "description": "Just a very simple components library.",
7
7
  "keywords": ["front-end", "client", "html", "dom", "light", "components", "web", "simple", "minimalist", "easy"],