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.14.0 to 0.14.1

155

index.js
/**
* @file mofron-comp-text/index.js
* @brief text component for mofron
* @author simpart
* @license MIT
*/

@@ -14,5 +14,5 @@ const comutl = mofron.util.common;

*
* @param (mixed) text: parameter
* object: component
* @pmap text
* @param (mixed) short-form parameter
* key-value: component config
* @short text
* @type private

@@ -24,6 +24,7 @@ */

this.name('Text');
this.shortForm('text');
/* init config */
this.confmng().add("heiWeight", { init:1.5, type:"number" });
this.shortForm('text');
this.confmng().add("weight", { type: "number", select: [100,200,300,400,500,600,700,800,900] });
/* set config */
if (undefined !== prm) {

@@ -46,2 +47,3 @@ this.config(prm);

super.initDomConts();
this.effect(new Font({ tag: "Text", suspend: true }));
this.text(''); // default text

@@ -56,5 +58,6 @@ this.size("0.16rem"); // default size

/**
* text value
* text setter/getter
*
* @param (string) text value
* @param (mixed) string: text value
* undefined: call as getter
* @return (string) text value

@@ -73,7 +76,24 @@ * @type parameter

/**
* text size
* text getter
*
* @return (string) text value
* @type function
*/
toString () {
try {
return this.text();
} catch (e) {
console.error(e.stack);
throw e;
}
}
/**
* text size setter/getter
*
* @param (string (size)) text size
* @param (key-value) style option
* @return (string) css size value
* @param (mixed) string (size): text size
* undefined: call as getter
* @param (key-value) style option [not required]
* @return (mixed) string: text size (default is "0.16rem")
* null: not set
* @type parameter

@@ -91,7 +111,9 @@ */

/**
* text height
* text height setter/getter
*
* @param (string (size)) height (adjust the size according to the height)
* @param (key-value) style option
* @return (string) css size value
* @param (mixed) string (size): text size
* undefined: call as getter
* @param (key-value) style option [not required]
* @return (mixed) string: text height (default is "0.24rem")
* null: not set
* @type parameter

@@ -128,6 +150,9 @@ */

/**
* height-weight for height
* height weight setter/getter
* this value to make 'height' parameter and real dom size the same
* it needs to adjust depending on font difference.
*
* @param (number) height weight
* @return (number) height weight
* @param (mixed) number: height weight rate
* undefined: call as getter
* @return (number) height weight rate
* @type private

@@ -145,8 +170,9 @@ */

/**
* text color
* text color setter/getter
*
* @param (mixed (color)) string: color name, #hex
* array: [red, green, blue, (alpha)]
* @param (key-value) style option
* @return (string) text color
* array: [red, green, blue, (alpha)]
* @param (key-value) style option [not required]
* @return (mixed) string: text color
* null: not set
* @type parameter

@@ -164,29 +190,9 @@ */

/**
* text under line color
* text font setter/getter
*
* @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 (mixed) string: font name
* array: [primary font, secondary font]
* @return (string) font name
* undefined: call as getter
* @param (string) path to font file [not required]
* @return (mixed) array: font name
* null: not set
* @type parameter

@@ -196,19 +202,17 @@ */

try {
let ret = this.effect({ name:"Font" });
let font = this.effect({ name:"Font", tag: "Text" });
if (undefined === fnm) {
/* getter */
return (null === ret) ? null : ret.family();
return font.fname();
}
/* setter */
if (null === ret) {
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);
}
font.suspend(false);
if ("string" === typeof fnm) {
font.fname(fnm);
} else if ((true === Array.isArray(fnm)) && (2 === fnm.length)) {
font.fname(fnm[0], fnm[1]);
} else {
throw new Error("invalid parameter");
}
font.path(pth);
} catch (e) {

@@ -221,7 +225,9 @@ console.error(e.stack);

/**
* character spacing
*
* @param (string (size)) spacing size
* @param (key-value) style option
* @return (string) spacing size
* character spacing setter/getter
*
* @param (mixed) string(size): spacing size
* undefined: call as getter
* @param (key-value) style option [not required]
* @return (mixed) string: spacing size
* null: not set
* @type parameter

@@ -239,7 +245,8 @@ */

/**
* text thickness
*
* text thickness setter/getter
*
* @param (mixed) number: thickness value [100-900]
* null: delete thickness
* @param (key-value) style option
* undefined: call as getter
* @param (key-value) style option [not required]
* @return (number) thickness value

@@ -250,4 +257,8 @@ * @type parameter

try {
let set_val = (undefined === val) ? 'font-weight' : { 'font-weight' : val };
return this.style(set_val, opt);
if (undefined === val) {
/* getter */
return this.style("font-weight");
}
/* setter */
this.style({ 'font-weight' : val }, opt);
} catch (e) {

@@ -254,0 +265,0 @@ console.error(e.stack);

{
"name": "mofron-comp-text",
"version": "0.14.0",
"version": "0.14.1",
"description": "text component for mofron",

@@ -17,3 +17,3 @@ "main": "index.js",

"keywords": [
"front-end"
"front-end","mofron"
],

@@ -20,0 +20,0 @@ "author": "simparts",

@@ -15,29 +15,32 @@ # mofron-comp-text

<require>
<tag module="mofron-comp-text">Text</tag>
<tag load="mofron-comp-text">Text</tag>
</require>
<Text size="0.4rem" font="serif" space="0.1rem">text component</Text>
```
# Parameter
|Simple<br>Param | Parameter Name | Type | Description |
|:--------------:|:---------------|:-----|:------------|
| ◯ | text | string | text value |
| | size | string (size) | text size |
| | | key-value | style option |
| | height | string (size) | height (adjust the size according to the height) |
| | | key-value | style option |
| Short<br>Form | Parameter Name | Type | Description |
|:-------------:|:---------------|:-----|:------------|
| ◯ | text | mixed | string: text value |
| | | | undefined: call as getter |
| | toString | | | size | mixed | string (size): text size |
| | | | undefined: call as getter |
| | | key-value | style option [not required] |
| | height | mixed | string (size): text size |
| | | | undefined: call as getter |
| | | key-value | style option [not required] |
| | mainColor | mixed (color) | string: color name, #hex |
| | | | array: [red, green, blue, (alpha)] |
| | | key-value | style option |
| | accentColor | mixed (color) | string: color name, #hex |
| | | | array: [red, green, blue, (alpha)] |
| | | | null: delete under line |
| | | key-value | style option |
| | | key-value | style option [not required] |
| | font | mixed | string: font name |
| | | | array: [primary font, secondary font] |
| | space | string (size) | spacing size |
| | | key-value | style option |
| | | | undefined: call as getter |
| | | string | path to font file [not required] |
| | space | mixed | string(size): spacing size |
| | | | undefined: call as getter |
| | | key-value | style option [not required] |
| | weight | mixed | number: thickness value [100-900] |
| | | | null: delete thickness |
| | | key-value | style option |
| | | | undefined: call as getter |
| | | key-value | style option [not required] |
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