Money.Input.Visualizer (Money.Input v0.1.0)

View Source

A web-based visualizer for Money.Input.

This module is a Plug.Router that can be mounted inside a Phoenix or Plug application, or run standalone during development via Money.Input.Visualizer.Standalone.

Views

  • /input — interactive number and money input demo. Pick a locale + currency, type a value, submit, and see the parsed Decimal/Money, the canonical wire form, the blur-formatted output, and validator results.

  • /parse — cross-locale parsing table. One input string, every locale, side-by-side.

  • /format — cross-locale formatting table. One parsed value, every locale, side-by-side.

  • /locale — locale display data: decimal/grouping separators, native digit system, currency-symbol position. This is the snapshot the JS hook would read from data- attributes.

Mounting in Phoenix

In your router.ex:

forward "/money-input", Money.Input.Visualizer

Running standalone

Money.Input.Visualizer.Standalone.start(port: 4002)

Optional dependencies

The visualizer pulls in :plug (required for the router) and :bandit (only used by the standalone helper). Both are declared optional: true in this library's mix.exs, so you must add them to your own project's deps to use the visualizer:

{:plug, "~> 1.15"},
{:bandit, "~> 1.5"}

Enable flag

The visualizer module is always compiled when :plug is present, but Money.Input.Visualizer.Standalone.start/1 refuses to start unless :ex_money_input, :visualizer is set to true in config, or enabled: true is passed explicitly. Mounting under forward/2 in a Phoenix router is not gated — the host app is the one who decided to expose it.

Summary

Functions

Callback implementation for Plug.call/2.

Callback implementation for Plug.init/1.

Functions

call(conn, opts)

Callback implementation for Plug.call/2.

init(opts)

Callback implementation for Plug.init/1.