@wmfs/cardscript-to-quasar
v1.259.0
Published
Produces HTML with Quasar-markup from Cardscript JSON
Downloads
369
Readme
cardscript-to-quasar
Produces HTML with Quasar-markup from Cardscript JSON
Install
$ npm install @wmfs/cardscript-to-quasar --save
Usage
const cardscriptToQuasar = require('@wmfs/cardscript-to-quasar')
const quasarTemplate = cardscriptToQuasar(
//
// Some Cardscript:
//
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.0",
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"text": "Change me!",
"color": "attention",
"horizontalAlignment": "center"
}
]
},
// Some options:
{
"fieldLabelWidth": 12,
"imageSourceTemplate": "url(statics/${imagePath})"
}
)
// quasarTemplate:
// HTML string with Quasar components all configured to best represent the supplied Cardscript.
API
cardscriptToQuasar(cardscriptJSON, options)
Options
- All options are optional
| Option | Description |
| ------ | ----------- |
| fieldLabelWidth
| For Cardscript components that will be generated within a Quasar field component, this is the value passed to the label-width
property, defaults to 12
(e.g. labels will always be above field components, and not rendered to the side). |
| imageSourceTemplate
| This is a string-template for use by Cardscript components such as Jumbotron to conjure a full reference to an image. Defaults to url(statics/${imagePath})
. Note imagePath
here is the value provided in the Cardscript config for the component (e.g. the value of backgroundImage
in the case of the Jumbotron).|
Testing
$ npm test