mofron-comp-text
Advanced tools
Comparing version 0.14.1 to 0.15.0
45
index.js
/** | ||
* @file mofron-comp-text/index.js | ||
* @brief text component for mofron | ||
* @file mofron-comp-text/index.js | ||
* @brief text component for mofron | ||
* @license MIT | ||
@@ -8,3 +8,2 @@ */ | ||
const cmputl = mofron.util.component; | ||
const Font = require('mofron-effect-font'); | ||
@@ -23,7 +22,12 @@ module.exports = class extends mofron.class.Component { | ||
super(); | ||
this.name('Text'); | ||
this.modname('Text'); | ||
this.shortForm('text'); | ||
/* init config */ | ||
this.confmng().add("heiWeight", { init:1.5, type:"number" }); | ||
this.confmng().add("weight", { type: "number", select: [100,200,300,400,500,600,700,800,900] }); | ||
this.confmng().add( | ||
"weight", | ||
{ type: "number", select: [100,200,300,400,500,600,700,800,900] } | ||
); | ||
/* set config */ | ||
@@ -47,3 +51,2 @@ if (undefined !== prm) { | ||
super.initDomConts(); | ||
this.effect(new Font({ tag: "Text", suspend: true })); | ||
this.text(''); // default text | ||
@@ -187,5 +190,4 @@ this.size("0.16rem"); // default size | ||
* | ||
* @param (mixed) string: font name | ||
* @param (mixed) string: font name (variable arguments) | ||
* undefined: call as getter | ||
* @param (string) path to font file [not required] | ||
* @return (mixed) array: font name | ||
@@ -195,19 +197,18 @@ * null: not set | ||
*/ | ||
font (fnm, pth) { | ||
font () { | ||
try { | ||
let font = this.effect({ name:"Font", tag: "Text" }); | ||
if (undefined === fnm) { | ||
if (0 === arguments.length) { | ||
/* getter */ | ||
return font.fname(); | ||
} | ||
/* setter */ | ||
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"); | ||
return this.style("font-family"); | ||
} | ||
font.path(pth); | ||
/* setter */ | ||
let set_fnt = ""; | ||
for (let aidx=0;aidx < arguments.length; aidx++) { | ||
if ("string" !== typeof arguments[aidx]) { | ||
throw new Error("invalid parameter"); | ||
} | ||
set_fnt += arguments[aidx] + ","; | ||
} | ||
set_fnt = set_fnt.substring(0, set_fnt.length-1); | ||
this.style({ "font-family": set_fnt }); | ||
} catch (e) { | ||
@@ -214,0 +215,0 @@ console.error(e.stack); |
{ | ||
"name": "mofron-comp-text", | ||
"version": "0.14.1", | ||
"version": "0.15.0", | ||
"description": "text component for mofron", | ||
@@ -13,5 +13,2 @@ "main": "index.js", | ||
}, | ||
"dependencies": { | ||
"mofron-effect-font" : "" | ||
}, | ||
"keywords": [ | ||
@@ -18,0 +15,0 @@ "front-end","mofron" |
@@ -1,5 +0,5 @@ | ||
# mofron-comp-text | ||
# mofron-comp-text | ||
[mofron](https://mofron.github.io/mofron/) is module based frontend framework. | ||
text component for mofron | ||
text component for mofron | ||
@@ -9,3 +9,3 @@ | ||
``` | ||
npm install mofron mofron-comp-text | ||
npm install mofron mofron-comp-text | ||
``` | ||
@@ -27,3 +27,3 @@ | ||
| | | | undefined: call as getter | | ||
| | toString | | | size | mixed | string (size): text size | | ||
| | toString | ||| | size | mixed | string (size): text size | | ||
| | | | undefined: call as getter | | ||
@@ -37,5 +37,4 @@ | | | key-value | style option [not required] | | ||
| | | key-value | style option [not required] | | ||
| | font | mixed | string: font name | | ||
| | font | mixed | string: font name (variable arguments) | | ||
| | | | undefined: call as getter | | ||
| | | string | path to font file [not required] | | ||
| | space | mixed | string(size): spacing size | | ||
@@ -42,0 +41,0 @@ | | | | undefined: call as getter | |
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
0
1
9693
244
45
- Removedmofron-effect-font@
- Removedmofron-effect-font@0.2.5(transitive)