Browse Source

IMPRO,REFA: Minor changes

removing logs
added span element to builder
typos
added docu
master
chris 6 months ago
parent
commit
012e2e8afa
  1. 6
      src/builder.js
  2. 4
      src/commonEvents.js
  3. 1
      src/component.js
  4. 7
      src/context.js
  5. 4
      src/modifier.js

6
src/builder.js

@ -48,6 +48,12 @@ const builder = {
* @returns {Component}
*/
div: function (attr = {}) { return builder.genTag("div", attr); },
/**
*
* @param {Map<string,string>} attr
* @returns {Component}
*/
span: function (attr = {}) { return builder.genTag("span", attr); },
/**
*
* @param {Map<string,string>} attr

4
src/commonEvents.js

@ -2,7 +2,7 @@
* Enum to access common events
*/
const CommonEvents = Object.freeze({
ONCLICK: "onClick",
ONCHANGE: "onChange"
ONCLICK: "onclick",
ONCHANGE: "onchange"
})

1
src/component.js

@ -131,7 +131,6 @@ class Component {
* @returns {Component} this component object
*/
childContext(component) {
console.log(arguments, arguments.length > 1)
if (arguments.length > 1) {
for (let i = 0; i < arguments.length; i++) {
this.childContext(arguments[i]);

7
src/context.js

@ -21,7 +21,7 @@ class PageBuilder {
*/
registerFunction(name, fun) {
if (!this.#functionNames.includes(name)) {
this.#functions.innerText += `const ${name} = ${fun}`;
this.#functions.innerText += `const ${name} = ${fun};`;
this.#functionNames.push(name);
}
}
@ -51,9 +51,12 @@ class PageBuilder {
head.appendChild(this.#functions)
head.appendChild(this.#cssClasses)
console.log(this.#functionNames)
}
/**
*
* @param {number} relaunchSeconds timeinterval for page to reload (changes)
*/
inDev(relaunchSeconds = 20) {
let head = document.querySelector("head");
let meta = document.createElement("meta");

4
src/modifier.js

@ -79,7 +79,7 @@ class Modifier {
* @returns {Modifier} this modifier object
*/
margin(siding) {
this._modifications["margin"] = siding.getOrderedValues();
this._modifications["margin"] = siding.getOrderedValues().join(' ');
return this;
}
@ -203,7 +203,7 @@ class Modifier {
if (borderWidth === -1) {
return new BorderChain(this);
} else {
return new BorderChain(this).all(borderWidth);
return new BorderChain(this).width(borderWidth);
}
}

Loading…
Cancel
Save