/mavo-snippets

An extension for Visual Studio Code with snippets for Mavo.

Primary LanguageJavaScript

Snippets for Mavo

This is an extension for Visual Studio Code with snippets for Mavo.

Preview

Prefix Description
mv-accepts The mv-accepts attribute takes a space-separated list of property names as its value and is specified on properties with mv-multiple.
mv-alias If provided, Mavo will read data from this property instead of its real property name. Useful to read stored data properly after renaming a property in the HTML.
mv-app Defines a Mavo app.
mv-attribute Mavo automatically assumes that the data each property element holds is stored either as its content or in a "primary" attribute, different per element type. Most of the time this works great, and you don't have to think about it. However, sometimes this heuristic will fail. In those cases, you can correct Mavo's prediction by using the mv-attribute attribute. Its value is either the name of the attribute that holds data, or none for no attribute (element contents).
mv-autosave Save automatically when the data changes. Its value is the number of seconds to throttle saving, or 0 for no throttling (save immediately). The default throttling delay is 3 seconds, used when the attribute is specified without a value. Unless throttling is disabled, The Save button will still be present in the Mavo bar.
mv-bar Control which buttons may appear in the toolbar and in what order, or hide the toolbar completely.
mv-clicked The number of times the button has been clicked.
mv-default The mv-default attribute lets you set default values for properties that have no data yet.
mv-edit The value of mv-edit is a CSS selector. If the CSS selector matches multiple elements on the page, the first one will be used.
mv-edit-* In some cases, you don’t want to entirely replace the element used for editing by default, but merely to set a few attributes on it.
mv-expressions Change the expression syntax or disable expressions altogether.
mv-format By default, Mavo saves and reads data in JSON. While you don’t need to understand JSON to use Mavo, you may need to use a different file format at some point. This is exactly what mv-format is for.
mv-if Remove an element from the DOM if the expression doesn't match and re-add it when it does.
mv-init If no data is stored, mv-init will be used to load initial data. Same values as mv-storage.
mv-mode Possible values: edit or read.
mv-multiple Tells Mavo that this element can be multiplied.
mv-order mv-order="desc" does not sort the collection. Instead, it affects the behavior of the controls that add new items.
mv-path Render and edit only a subset of the stored data.
mv-permissions Space-separated list of permissions (read, edit, add, delete, login, logout, save)
mv-progress Only set when an event is in progress. Its value reflects what event, e.g. "Saving" or "Loading".
mv-source Tells Mavo where to get data from.
mv-storage Tells Mavo where to store any data.
mv-value Set an element's content to the result of an expressions.
property The property attribute tells Mavo which elements are saved.
typeof The value of this property element is not just an attribute or its text content, but the union of the values of the properties inside it. This is almost always inferred from the structure of your properties and added automatically, but you can use it to force an element to be a group, or to declare the type of the group (e.g. typeof="Person") for better semantic value. Elements with this attribute are called groups, objects, or complex properties.