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} * @returns {Component}
*/ */
div: function (attr = {}) { return builder.genTag("div", attr); }, 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 * @param {Map<string,string>} attr

4
src/commonEvents.js

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

1
src/component.js

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

7
src/context.js

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

4
src/modifier.js

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

Loading…
Cancel
Save