npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@getodk/web-forms

v0.5.0

Published

ODK Web Forms

Downloads

1,596

Readme

@getodk/web-forms

This package is a Vue component library that uses @getodk/xforms-engine to render ODK XForms. These forms are generally authored by end users in Excel using the XLSForm standard. Learn more on the ODK website and the ODK Web Form project's main README.

Usage

To use this library in a Vue.js application:

  1. Import @getodk/web-forms as a dependency in the application
  2. Install the exported plugin by adding app.use(WebFormsPlugin) in entry component (usually App.vue)
  3. Add the exported component anywhere in the application:
<OdkWebForm :form-xml="formVersionXml.data" @submit="handleSubmit" />

Plugin:

The plugin is there to initialize PrimeVue, currently it exposes no options. In the future, configuration options may be added to the plugin.

Props and Events:

  • form-xml: the XML of the ODK XForm to be rendered.
  • submit: it is raised when user pressed "Send" button on the Form.

What if I don't use Vue?

We will eventually publish a framework-agnostic custom element.

Development

To run in development, run this command at the monorepo root:

yarn workspace @getodk/web-forms dev

Individual test environments, and their corresponding watch modes, also have separate commands which can be found in package.json.

Upload XLSForm and XForm functionality in demo app and in dev mode depends on XLSForm-online. Run the xlsform-online locally. By default it runs on port 8000, if you are running it on another port then you should update the config file.

Material Design

This package uses the Material Design system for the UI, though not strictly. The idea is to closely match the design to that of ODK Collect.

It uses the PrimeVue component library.

Theme and Styles

We are using a customized version of the Material Light Indigo theme provided by PrimeVue.

Icons

We use Material Icons using IcoMoon to select a subset of icons in order to minimize the size. The font files are located in ./src/assets/fonts/, and the CSS is ./src/assets/css/icomoon.css. Our IcoMoon definition is in the root directory of this package at ./icomoon.json.

To update the icons using the IcoMoon website:

  1. Click the "Import Icons" button in IcoMoon. Select icomoon.json. When prompted, load the settings stored in the file.
  2. Scroll down to the "Add Icons From Library" link and add Material Icons.
  3. Move the imported set above Material Icons, using the 3-bar icon to the right of the imported set's title. (This should help preserve the icon order and minimize the diff.)
  4. Update the icons by selecting (highlighting) the new icons to add. They don't need to be moved or altered.
  5. Download the new font, then copy the files (icomoon.css, fonts/*, icomoon.json) into their locations in the repository.
    • You will need to rename the files and update the paths in the CSS (fonts/icomoon.ttf?... becomes /fonts/icomoon.ttf?... with a beginning slash).
    • You will also need to prettify the JSON file to use two space indentation.

By following the steps above, you should minimize the diff. However, in the JSON file, you may still see changes for properties like id, iconIdx, setId, and setIdx.

Material Icons are available under the Apache License Version 2.0. Copy of the license can be found at ./src/assets/fonts/LICENSE-2.0.txt