New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mofron-comp-text

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mofron-comp-text - npm Package Compare versions

Comparing version 0.13.10 to 0.14.0

141

index.js

@@ -6,21 +6,26 @@ /**

*/
const mf = require('mofron');
const comutl = mofron.util.common;
const cmputl = mofron.util.component;
const Font = require('mofron-effect-font');
mf.comp.Text = class extends mf.Component {
module.exports = class extends mofron.class.Component {
/**
* constructor
*
* @param (mixed) text parameter
* object: component option
* @param (mixed) text: parameter
* object: component
* @pmap text
* @type private
*/
constructor (po) {
constructor (prm) {
try {
super();
this.name('Text');
this.prmMap('text');
this.prmOpt(po);
this.confmng().add("heiWeight", { init:1.5, type:"number" });
this.shortForm('text');
if (undefined !== prm) {
this.config(prm);
}
} catch (e) {

@@ -53,6 +58,8 @@ console.error(e.stack);

* @return (string) text value
* @type tag parameter
* @type parameter
*/
text (val) {
try { return this.target().text(val); } catch (e) {
try {
return this.childDom().text(val);
} catch (e) {
console.error(e.stack);

@@ -67,8 +74,10 @@ throw e;

* @param (string (size)) text size
* @param (option) style option
* @param (key-value) style option
* @return (string) css size value
* @type tag parameter
* @type parameter
*/
size (val, opt) {
try { return mf.func.cmpSize(this, 'font-size', [val,opt]); } catch (e) {
try {
return cmputl.size(this, "font-size", val, opt);
} catch (e) {
console.error(e.stack);

@@ -80,26 +89,12 @@ throw e;

/**
* forced size
*
* @param (string (size)) text size
* @return (string (size)) text size
* @type private
*/
fsize (prm) {
try { this.size(prm,{locked:true}); } catch (e) {
console.error(e.stack);
throw e;
}
}
/**
* text height
*
* @param (string (size)) text size
* @param (option) style option
* @param (string (size)) height (adjust the size according to the height)
* @param (key-value) style option
* @return (string) css size value
* @type tag parameter
* @type parameter
*/
height (prm, opt) {
try {
let siz = mf.func.getSize(
let siz = comutl.getsize(
(undefined === prm) ? this.size() : prm

@@ -114,3 +109,3 @@ );

}
siz_buf = mf.func.roundUp(siz_buf) + siz.type();
siz_buf = comutl.roundup(siz_buf) + siz.type();
} else {

@@ -132,3 +127,3 @@ siz_buf = siz.toString();

/**
* height weight
* height-weight for height
*

@@ -141,3 +136,3 @@ * @param (number) height weight

try {
return this.member("heiWeight", "number", prm, 1.5);
return this.confmng("heiWeight", prm);
} catch (e) {

@@ -153,9 +148,11 @@ console.error(e.stack);

* @param (mixed (color)) string: color name, #hex
* array: [red, green, blue, (alpha)]
* @param (option) style option
* array: [red, green, blue, (alpha)]
* @param (key-value) style option
* @return (string) text color
* @type tag parameter
* @type parameter
*/
mainColor (val, opt) {
try { return mf.func.cmpColor(this, 'color', [val, opt]); } catch (e) {
try {
return cmputl.color(this, 'color', val, opt);
} catch (e) {
console.error(e.stack);

@@ -167,20 +164,48 @@ throw e;

/**
* text under line color
*
* @param (mixed (color)) string: color name, #hex
* array: [red, green, blue, (alpha)]
* null: delete under line
* @param (key-value) style option
* @return (string) text under line color
* @type parameter
*/
accentColor (val, opt) {
try {
if (undefined !== val) {
this.style({ "text-decoration" : (null === val) ? null : "underline" });
}
return cmputl.color(this, "text-decoration-color", val, opt);
} catch (e) {
console.error(e.stack);
throw e;
}
}
/**
* text font
*
* @param (string) font name
* @return (array) font name
* @type tag parameter
* @param (mixed) string: font name
* array: [primary font, secondary font]
* @return (string) font name
* @type parameter
*/
font (fnm, pth) {
try {
let ret = this.effect('Font');
let ret = this.effect({ name:"Font" });
if (undefined === fnm) {
/* getter */
return (null === ret) ? null : ret.fontName();
return (null === ret) ? null : ret.family();
}
/* setter */
if (null === ret) {
this.effect(new Font(fnm, pth));
} else {
ret.fontName(fnm);
let set_fnm = (true === Array.isArray(fnm)) ? new mofron.class.ConfArg(fnm[0],fnm[1]) : fnm;
this.effect(new Font(set_fnm, pth));
} else if (true === comutl.isinc(ret,"Font")) {
if (true === Array.isArray(fnm)) {
ret.family(fnm[0], fnm[1]);
} else {
ret.family(fnm);
}
ret.path(pth);

@@ -196,9 +221,12 @@ }

* character spacing
*
*
* @param (string (size)) spacing size
* @param (key-value) style option
* @return (string) spacing size
* @type tag parameter
* @type parameter
*/
space (val) {
try { return mf.func.cmpSize(this, 'letter-spacing', val); } catch (e) {
space (val, opt) {
try {
return cmputl.size(this, 'letter-spacing', val, opt);
} catch (e) {
console.error(e.stack);

@@ -211,13 +239,13 @@ throw e;

* text thickness
*
*
* @param (mixed) number: thickness value [100-900]
* null: delete thickness
* @param (key-value) style option
* @return (number) thickness value
* @type tag parameter
* @type parameter
*/
weight (val) {
weight (val, opt) {
try {
return this.style(
(undefined === val) ? 'font-weight' : { 'font-weight' : val }
);
let set_val = (undefined === val) ? 'font-weight' : { 'font-weight' : val };
return this.style(set_val, opt);
} catch (e) {

@@ -229,3 +257,2 @@ console.error(e.stack);

}
module.exports = mofron.comp.Text;
/* end of file */
{
"name": "mofron-comp-text",
"version": "0.13.10",
"version": "0.14.0",
"description": "text component for mofron",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -25,12 +25,19 @@ # mofron-comp-text

| | size | string (size) | text size |
| | | option | style option |
| | height | string (size) | text size |
| | | option | style option |
| | | key-value | style option |
| | height | string (size) | height (adjust the size according to the height) |
| | | key-value | style option |
| | mainColor | mixed (color) | string: color name, #hex |
| | | | array: [red, green, blue, (alpha)] |
| | | option | style option |
| | font | string | font name |
| | | key-value | style option |
| | accentColor | mixed (color) | string: color name, #hex |
| | | | array: [red, green, blue, (alpha)] |
| | | | null: delete under line |
| | | key-value | style option |
| | font | mixed | string: font name |
| | | | array: [primary font, secondary font] |
| | space | string (size) | spacing size |
| | | key-value | style option |
| | weight | mixed | number: thickness value [100-900] |
| | | | null: delete thickness |
| | | key-value | style option |

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc